@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.
- package/dist/components/ActionMenu/ActionMenu.cjs.js +1 -1
- package/dist/components/ActionMenu/ActionMenu.cjs.js.map +1 -1
- package/dist/components/ActionMenu/ActionMenu.es.js +77 -76
- package/dist/components/ActionMenu/ActionMenu.es.js.map +1 -1
- package/dist/components/Banner/Banner.cjs.js +1 -1
- package/dist/components/Banner/Banner.cjs.js.map +1 -1
- package/dist/components/Banner/Banner.es.js +77 -77
- package/dist/components/Banner/Banner.es.js.map +1 -1
- package/dist/components/ButtonWithSelect/ButtonWithSelect.cjs.js +1 -1
- package/dist/components/ButtonWithSelect/ButtonWithSelect.cjs.js.map +1 -1
- package/dist/components/ButtonWithSelect/ButtonWithSelect.es.js +9 -9
- package/dist/components/ButtonWithSelect/ButtonWithSelect.es.js.map +1 -1
- package/dist/components/Icon/IconComponents/AlertCircle.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/AlertCircle.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/AlertCircle.es.js +56 -0
- package/dist/components/Icon/IconComponents/AlertCircle.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/AmazonMusicLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/AmazonMusicLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/AmazonMusicLogo.es.js +27 -0
- package/dist/components/Icon/IconComponents/AmazonMusicLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/AppleMusicLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/AppleMusicLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/AppleMusicLogo.es.js +42 -0
- package/dist/components/Icon/IconComponents/AppleMusicLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/ArrowLeft.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/ArrowLeft.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/ArrowLeft.es.js +27 -0
- package/dist/components/Icon/IconComponents/ArrowLeft.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/BandcampLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/BandcampLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/BandcampLogo.es.js +27 -0
- package/dist/components/Icon/IconComponents/BandcampLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/BeatportLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/BeatportLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/BeatportLogo.es.js +29 -0
- package/dist/components/Icon/IconComponents/BeatportLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Bell.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Bell.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Bell.es.js +31 -0
- package/dist/components/Icon/IconComponents/Bell.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/CaretDown.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/CaretDown.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/CaretDown.es.js +27 -0
- package/dist/components/Icon/IconComponents/CaretDown.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/CaretRight.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/CaretRight.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/CaretRight.es.js +27 -0
- package/dist/components/Icon/IconComponents/CaretRight.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Chart.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Chart.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Chart.es.js +31 -0
- package/dist/components/Icon/IconComponents/Chart.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/CheckCircle.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/CheckCircle.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/CheckCircle.es.js +27 -0
- package/dist/components/Icon/IconComponents/CheckCircle.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/ChevronDown.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/ChevronDown.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/ChevronDown.es.js +23 -0
- package/dist/components/Icon/IconComponents/ChevronDown.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/ChevronLeft.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/ChevronLeft.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/ChevronLeft.es.js +23 -0
- package/dist/components/Icon/IconComponents/ChevronLeft.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/ChevronRight.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/ChevronRight.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/ChevronRight.es.js +27 -0
- package/dist/components/Icon/IconComponents/ChevronRight.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/ChevronSquareDown.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/ChevronSquareDown.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/ChevronSquareDown.es.js +27 -0
- package/dist/components/Icon/IconComponents/ChevronSquareDown.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/ChevronUp.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/ChevronUp.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/ChevronUp.es.js +27 -0
- package/dist/components/Icon/IconComponents/ChevronUp.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Close.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Close.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Close.es.js +27 -0
- package/dist/components/Icon/IconComponents/Close.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Cog.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Cog.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Cog.es.js +30 -0
- package/dist/components/Icon/IconComponents/Cog.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Copy.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Copy.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Copy.es.js +26 -0
- package/dist/components/Icon/IconComponents/Copy.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/DangerCircle.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/DangerCircle.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/DangerCircle.es.js +33 -0
- package/dist/components/Icon/IconComponents/DangerCircle.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Dashboard.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Dashboard.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Dashboard.es.js +27 -0
- package/dist/components/Icon/IconComponents/Dashboard.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/DeezerLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/DeezerLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/DeezerLogo.es.js +27 -0
- package/dist/components/Icon/IconComponents/DeezerLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Download.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Download.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Download.es.js +27 -0
- package/dist/components/Icon/IconComponents/Download.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/DragHandle.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/DragHandle.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/DragHandle.es.js +30 -0
- package/dist/components/Icon/IconComponents/DragHandle.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Edit.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Edit.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Edit.es.js +23 -0
- package/dist/components/Icon/IconComponents/Edit.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Ellipsis.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Ellipsis.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Ellipsis.es.js +27 -0
- package/dist/components/Icon/IconComponents/Ellipsis.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/EmailThick.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/EmailThick.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/EmailThick.es.js +30 -0
- package/dist/components/Icon/IconComponents/EmailThick.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/EmailThin.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/EmailThin.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/EmailThin.es.js +28 -0
- package/dist/components/Icon/IconComponents/EmailThin.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/ExternalLink.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/ExternalLink.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/ExternalLink.es.js +30 -0
- package/dist/components/Icon/IconComponents/ExternalLink.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/FacebookLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/FacebookLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/FacebookLogo.es.js +27 -0
- package/dist/components/Icon/IconComponents/FacebookLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Globe.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Globe.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Globe.es.js +30 -0
- package/dist/components/Icon/IconComponents/Globe.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Hamburger.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Hamburger.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Hamburger.es.js +27 -0
- package/dist/components/Icon/IconComponents/Hamburger.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Heartbeat.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Heartbeat.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Heartbeat.es.js +23 -0
- package/dist/components/Icon/IconComponents/Heartbeat.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Info.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Info.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Info.es.js +27 -0
- package/dist/components/Icon/IconComponents/Info.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/InfoOutline.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/InfoOutline.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/InfoOutline.es.js +30 -0
- package/dist/components/Icon/IconComponents/InfoOutline.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/InstagramLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/InstagramLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/InstagramLogo.es.js +30 -0
- package/dist/components/Icon/IconComponents/InstagramLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/IntercomLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/IntercomLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/IntercomLogo.es.js +47 -0
- package/dist/components/Icon/IconComponents/IntercomLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Lightning.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Lightning.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Lightning.es.js +26 -0
- package/dist/components/Icon/IconComponents/Lightning.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Link.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Link.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Link.es.js +23 -0
- package/dist/components/Icon/IconComponents/Link.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/MessengerLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/MessengerLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/MessengerLogo.es.js +27 -0
- package/dist/components/Icon/IconComponents/MessengerLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/MusicNote.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/MusicNote.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/MusicNote.es.js +31 -0
- package/dist/components/Icon/IconComponents/MusicNote.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Pause.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Pause.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Pause.es.js +23 -0
- package/dist/components/Icon/IconComponents/Pause.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Pencil.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Pencil.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Pencil.es.js +23 -0
- package/dist/components/Icon/IconComponents/Pencil.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/PhoneThick.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/PhoneThick.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/PhoneThick.es.js +27 -0
- package/dist/components/Icon/IconComponents/PhoneThick.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/PhoneThin.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/PhoneThin.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/PhoneThin.es.js +27 -0
- package/dist/components/Icon/IconComponents/PhoneThin.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Play.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Play.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Play.es.js +23 -0
- package/dist/components/Icon/IconComponents/Play.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/ProtonLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/ProtonLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/ProtonLogo.es.js +30 -0
- package/dist/components/Icon/IconComponents/ProtonLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Quote.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Quote.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Quote.es.js +27 -0
- package/dist/components/Icon/IconComponents/Quote.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Search.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Search.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Search.es.js +27 -0
- package/dist/components/Icon/IconComponents/Search.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Share.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Share.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Share.es.js +27 -0
- package/dist/components/Icon/IconComponents/Share.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/SignOut.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/SignOut.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/SignOut.es.js +32 -0
- package/dist/components/Icon/IconComponents/SignOut.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/SoundcloudLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/SoundcloudLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/SoundcloudLogo.es.js +27 -0
- package/dist/components/Icon/IconComponents/SoundcloudLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/SpotifyLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/SpotifyLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/SpotifyLogo.es.js +41 -0
- package/dist/components/Icon/IconComponents/SpotifyLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Spy.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Spy.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Spy.es.js +23 -0
- package/dist/components/Icon/IconComponents/Spy.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/SuccessCircle.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/SuccessCircle.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/SuccessCircle.es.js +33 -0
- package/dist/components/Icon/IconComponents/SuccessCircle.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/TelegramLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/TelegramLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/TelegramLogo.es.js +27 -0
- package/dist/components/Icon/IconComponents/TelegramLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/TiktokLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/TiktokLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/TiktokLogo.es.js +27 -0
- package/dist/components/Icon/IconComponents/TiktokLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Tracklist.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Tracklist.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Tracklist.es.js +27 -0
- package/dist/components/Icon/IconComponents/Tracklist.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/TrashCan.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/TrashCan.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/TrashCan.es.js +23 -0
- package/dist/components/Icon/IconComponents/TrashCan.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/TraxsourceLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/TraxsourceLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/TraxsourceLogo.es.js +27 -0
- package/dist/components/Icon/IconComponents/TraxsourceLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/User.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/User.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/User.es.js +35 -0
- package/dist/components/Icon/IconComponents/User.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/Users.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/Users.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/Users.es.js +23 -0
- package/dist/components/Icon/IconComponents/Users.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/WarningTriangle.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/WarningTriangle.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/WarningTriangle.es.js +27 -0
- package/dist/components/Icon/IconComponents/WarningTriangle.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/WhatsappLogoThick.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/WhatsappLogoThick.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/WhatsappLogoThick.es.js +47 -0
- package/dist/components/Icon/IconComponents/WhatsappLogoThick.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/WhatsappLogoThin.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/WhatsappLogoThin.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/WhatsappLogoThin.es.js +33 -0
- package/dist/components/Icon/IconComponents/WhatsappLogoThin.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/XTwitterLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/XTwitterLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/XTwitterLogo.es.js +27 -0
- package/dist/components/Icon/IconComponents/XTwitterLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/YandexLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/YandexLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/YandexLogo.es.js +33 -0
- package/dist/components/Icon/IconComponents/YandexLogo.es.js.map +1 -0
- package/dist/components/Icon/IconComponents/YoutubeLogo.cjs.js +2 -0
- package/dist/components/Icon/IconComponents/YoutubeLogo.cjs.js.map +1 -0
- package/dist/components/Icon/IconComponents/YoutubeLogo.es.js +35 -0
- package/dist/components/Icon/IconComponents/YoutubeLogo.es.js.map +1 -0
- package/dist/components/Icon/IconProps.cjs.js +2 -0
- package/dist/components/Icon/IconProps.cjs.js.map +1 -0
- package/dist/components/Icon/IconProps.es.js +35 -0
- package/dist/components/Icon/IconProps.es.js.map +1 -0
- package/dist/components/Input/CopyInput/CopyInput.cjs.js +1 -1
- package/dist/components/Input/CopyInput/CopyInput.cjs.js.map +1 -1
- package/dist/components/Input/CopyInput/CopyInput.es.js +26 -48
- package/dist/components/Input/CopyInput/CopyInput.es.js.map +1 -1
- package/dist/components/Input/SearchInput/SearchInput.cjs.js.map +1 -1
- package/dist/components/Input/SearchInput/SearchInput.es.js.map +1 -1
- package/dist/components/Menu/MenuTrigger.cjs.js +1 -1
- package/dist/components/Menu/MenuTrigger.cjs.js.map +1 -1
- package/dist/components/Menu/MenuTrigger.es.js +51 -54
- package/dist/components/Menu/MenuTrigger.es.js.map +1 -1
- package/dist/components/Menu/PopoverMenu.cjs.js +1 -1
- package/dist/components/Menu/PopoverMenu.cjs.js.map +1 -1
- package/dist/components/Menu/PopoverMenu.es.js +23 -36
- package/dist/components/Menu/PopoverMenu.es.js.map +1 -1
- package/dist/components/Select/Select.cjs.js +1 -1
- package/dist/components/Select/Select.cjs.js.map +1 -1
- package/dist/components/Select/Select.es.js +81 -98
- package/dist/components/Select/Select.es.js.map +1 -1
- package/dist/components/Table/DataTable/DataTable.cjs.js +1 -1
- package/dist/components/Table/DataTable/DataTable.cjs.js.map +1 -1
- package/dist/components/Table/DataTable/DataTable.es.js +5 -6
- package/dist/components/Table/DataTable/DataTable.es.js.map +1 -1
- package/dist/components/Tooltip/ResponsiveTooltip.cjs.js +1 -1
- package/dist/components/Tooltip/ResponsiveTooltip.cjs.js.map +1 -1
- package/dist/components/Tooltip/ResponsiveTooltip.es.js +37 -36
- package/dist/components/Tooltip/ResponsiveTooltip.es.js.map +1 -1
- package/dist/hooks.cjs.js +1 -1
- package/dist/hooks.d.ts +0 -18
- package/dist/hooks.es.js +5 -9
- package/dist/hooks.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +568 -19
- package/dist/index.es.js +206 -73
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/svg/icons.svg.cjs.js +0 -2
- package/dist/assets/svg/icons.svg.cjs.js.map +0 -1
- package/dist/assets/svg/icons.svg.es.js +0 -5
- package/dist/assets/svg/icons.svg.es.js.map +0 -1
- package/dist/components/Icon/Icon.cjs.js +0 -2
- package/dist/components/Icon/Icon.cjs.js.map +0 -1
- package/dist/components/Icon/Icon.es.js +0 -42
- package/dist/components/Icon/Icon.es.js.map +0 -1
- package/dist/hooks/useResponsiveDevice.cjs.js +0 -2
- package/dist/hooks/useResponsiveDevice.cjs.js.map +0 -1
- package/dist/hooks/useResponsiveDevice.es.js +0 -14
- package/dist/hooks/useResponsiveDevice.es.js.map +0 -1
- package/dist/hooks/useTouchDevice.cjs.js +0 -2
- package/dist/hooks/useTouchDevice.cjs.js.map +0 -1
- package/dist/hooks/useTouchDevice.es.js +0 -13
- package/dist/hooks/useTouchDevice.es.js.map +0 -1
- 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"),
|
|
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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cC,EACd,gBAAeL,EAAY,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,EAA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kB+D,CAAW,CAC/B,CAAA,EAECN,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
|
|
3
|
-
import { useIsClosing as
|
|
4
|
-
import { useLockBodyScroll as
|
|
5
|
-
import { Button as
|
|
6
|
-
import { ScreenOverlay as
|
|
7
|
-
import { DropdownMenu as
|
|
8
|
-
import {
|
|
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
|
|
11
|
-
const
|
|
11
|
+
import { isUrlExternal as V, handleInternalNavigation as W } from "../../utils/navigation.es.js";
|
|
12
|
+
const cn = ({
|
|
12
13
|
isOpen: n,
|
|
13
|
-
actions:
|
|
14
|
-
children:
|
|
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":
|
|
24
|
+
"data-testid": o
|
|
24
25
|
}) => {
|
|
25
26
|
var E;
|
|
26
|
-
|
|
27
|
-
const [
|
|
27
|
+
P(n);
|
|
28
|
+
const [i, c] = $(0), [t, d] = $([]), [g, I] = $({
|
|
28
29
|
title: h,
|
|
29
|
-
actions:
|
|
30
|
+
actions: a,
|
|
30
31
|
key: null,
|
|
31
32
|
previousKey: null
|
|
32
|
-
}), M = b(null),
|
|
33
|
-
function
|
|
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
|
-
]),
|
|
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
|
|
50
|
+
function G() {
|
|
50
51
|
if (t.length > 0) {
|
|
51
52
|
const j = t[t.length - 1];
|
|
52
|
-
|
|
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(
|
|
62
|
-
|
|
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(
|
|
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":
|
|
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: `${
|
|
87
|
-
children: /* @__PURE__ */ e.jsx("div", { ref:
|
|
88
|
-
|
|
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
|
-
|
|
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:
|
|
98
|
+
handleSubmenuOpen: B,
|
|
98
99
|
title: g.title,
|
|
99
|
-
isInSubmenu:
|
|
100
|
-
handleBack:
|
|
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(
|
|
106
|
-
/* @__PURE__ */ e.jsx(
|
|
107
|
-
|
|
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
|
-
},
|
|
128
|
+
}, J = ({
|
|
128
129
|
actions: n,
|
|
129
|
-
selectionMode:
|
|
130
|
-
selectedKeys:
|
|
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
|
-
|
|
143
|
+
s.Item,
|
|
143
144
|
{
|
|
144
145
|
className: "proton-ActionMenu__back-button",
|
|
145
|
-
onSelect: (
|
|
146
|
-
|
|
146
|
+
onSelect: (o) => {
|
|
147
|
+
o.preventDefault(), p();
|
|
147
148
|
},
|
|
148
149
|
"aria-label": `Go back to ${k || "previous menu"}`,
|
|
149
|
-
children: /* @__PURE__ */ e.jsx(
|
|
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(
|
|
162
|
+
/* @__PURE__ */ e.jsx(s.Separator, {})
|
|
162
163
|
] }),
|
|
163
|
-
n.map((
|
|
164
|
+
n.map((o, i) => {
|
|
164
165
|
var t;
|
|
165
|
-
const c = n[
|
|
166
|
+
const c = n[i];
|
|
166
167
|
return /* @__PURE__ */ e.jsx(
|
|
167
|
-
|
|
168
|
+
Q,
|
|
168
169
|
{
|
|
169
|
-
item:
|
|
170
|
+
item: o,
|
|
170
171
|
isSubmenu: !!((t = c.children) != null && t.length),
|
|
171
|
-
selectionMode:
|
|
172
|
+
selectionMode: a,
|
|
172
173
|
onSelectionChange: l,
|
|
173
|
-
selectedKeys:
|
|
174
|
+
selectedKeys: r,
|
|
174
175
|
disabledKeys: x,
|
|
175
176
|
handleSubmenuOpen: m
|
|
176
177
|
},
|
|
177
|
-
|
|
178
|
+
o.key
|
|
178
179
|
);
|
|
179
180
|
})
|
|
180
181
|
] });
|
|
181
182
|
return /* @__PURE__ */ e.jsx(
|
|
182
183
|
"div",
|
|
183
184
|
{
|
|
184
|
-
"aria-disabled":
|
|
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:
|
|
190
|
-
|
|
190
|
+
children: a === "single" ? /* @__PURE__ */ e.jsx(
|
|
191
|
+
s.RadioGroup,
|
|
191
192
|
{
|
|
192
|
-
value: (
|
|
193
|
-
onValueChange: (
|
|
193
|
+
value: (r == null ? void 0 : r[0]) || "",
|
|
194
|
+
onValueChange: (o) => {
|
|
194
195
|
var c;
|
|
195
|
-
const
|
|
196
|
-
(c =
|
|
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(
|
|
201
|
+
) : /* @__PURE__ */ e.jsx(s.Group, { children: /* @__PURE__ */ e.jsx(h, {}) })
|
|
201
202
|
}
|
|
202
203
|
);
|
|
203
|
-
},
|
|
204
|
+
}, Q = ({
|
|
204
205
|
item: n,
|
|
205
|
-
isSubmenu:
|
|
206
|
-
selectionMode:
|
|
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 &&
|
|
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
|
-
},
|
|
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
|
-
|
|
231
|
+
a && /* @__PURE__ */ e.jsx(U, { size: 16 })
|
|
231
232
|
] });
|
|
232
|
-
return n.to ? /* @__PURE__ */
|
|
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":
|
|
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 ||
|
|
244
|
+
p || !n.to || W(t, n.to);
|
|
244
245
|
},
|
|
245
246
|
children: c
|
|
246
247
|
}
|
|
247
|
-
)) :
|
|
248
|
-
|
|
248
|
+
)) : r === "multiple" ? /* @__PURE__ */ C(
|
|
249
|
+
s.CheckboxItem,
|
|
249
250
|
{
|
|
250
|
-
...
|
|
251
|
+
...o,
|
|
251
252
|
key: n.key,
|
|
252
253
|
checked: h,
|
|
253
|
-
onSelect:
|
|
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__ */
|
|
262
|
-
|
|
262
|
+
) : /* @__PURE__ */ C(
|
|
263
|
+
s.RadioItem,
|
|
263
264
|
{
|
|
264
|
-
...
|
|
265
|
+
...o,
|
|
265
266
|
value: n.key,
|
|
266
267
|
key: n.key,
|
|
267
268
|
"aria-checked": h,
|
|
268
|
-
"aria-expanded":
|
|
269
|
-
onSelect:
|
|
269
|
+
"aria-expanded": a ? !1 : void 0,
|
|
270
|
+
onSelect: i
|
|
270
271
|
},
|
|
271
272
|
c
|
|
272
273
|
);
|
|
273
274
|
};
|
|
274
275
|
export {
|
|
275
|
-
|
|
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,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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;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;A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BAAeL,IAAY,KAAQ;AAAA,MACnC,MAAMD,EAAK;AAAA,MACX,QAAQG,IAAa,WAAW;AAAA,MAChC,KAAKA,IAAa,wBAAwB;AAAA,MAC1C,SAAS,CAACS,MAA2C;AAC/C,QAAAT,KAAc,CAACH,EAAK,MAGCa,EAAAD,GAAGZ,EAAK,EAAE;AAAA,MACrC;AAAA,MAEC,UAAAS;AAAA,IAAA;AAAA,EAAA,CAEL,IAIA3D,MAAkB,aAElB,gBAAA6D;AAAA,IAACxB,EAAa;AAAA,IAAb;AAAA,MACE,GAAGoB;AAAA,MACJ,KAAKP,EAAK;AAAA,MACV,SAASM;AAAA,MACT,UAAAE;AAAA,MACA,iBAAiB,CAACM,MAAqB;AACrC,YAAI,CAAC7D,EAAmB;AAElB,cAAA8D,IAAc,IAAI,IAAIhE,CAAY;AACxC,QAAI+D,IACUC,EAAA,IAAIf,EAAK,GAAG,IAEZe,EAAA,OAAOf,EAAK,GAAG,GAE7B/C,EAAkB8D,CAAW;AAAA,MAC/B;AAAA,IAAA;AAAA,IAECN;AAAA,EAAA,IAML,gBAAAE;AAAA,IAACxB,EAAa;AAAA,IAAb;AAAA,MACE,GAAGoB;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,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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
|