@metamask/design-system-react-native 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -1
- package/dist/components/AvatarBase/AvatarBase.cjs +9 -11
- package/dist/components/AvatarBase/AvatarBase.cjs.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.d.cts.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.d.mts.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.mjs +9 -11
- package/dist/components/AvatarBase/AvatarBase.mjs.map +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.cjs +2 -2
- package/dist/components/AvatarFavicon/AvatarFavicon.cjs.map +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.d.cts +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.d.cts.map +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.d.mts +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.d.mts.map +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.mjs +2 -2
- package/dist/components/AvatarFavicon/AvatarFavicon.mjs.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.cjs +4 -5
- package/dist/components/AvatarGroup/AvatarGroup.cjs.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.d.cts.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.d.mts.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.mjs +4 -5
- package/dist/components/AvatarGroup/AvatarGroup.mjs.map +1 -1
- package/dist/components/AvatarIcon/AvatarIcon.cjs +5 -6
- package/dist/components/AvatarIcon/AvatarIcon.cjs.map +1 -1
- package/dist/components/AvatarIcon/AvatarIcon.d.cts.map +1 -1
- package/dist/components/AvatarIcon/AvatarIcon.d.mts.map +1 -1
- package/dist/components/AvatarIcon/AvatarIcon.mjs +5 -6
- package/dist/components/AvatarIcon/AvatarIcon.mjs.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.cjs +2 -2
- package/dist/components/AvatarNetwork/AvatarNetwork.cjs.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.d.cts +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.d.cts.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.d.mts +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.d.mts.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.mjs +2 -2
- package/dist/components/AvatarNetwork/AvatarNetwork.mjs.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.cjs +2 -2
- package/dist/components/AvatarToken/AvatarToken.cjs.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.d.cts +1 -1
- package/dist/components/AvatarToken/AvatarToken.d.cts.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.d.mts +1 -1
- package/dist/components/AvatarToken/AvatarToken.d.mts.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.mjs +2 -2
- package/dist/components/AvatarToken/AvatarToken.mjs.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.cjs +5 -10
- package/dist/components/BadgeCount/BadgeCount.cjs.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.d.cts.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.d.mts.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.mjs +5 -10
- package/dist/components/BadgeCount/BadgeCount.mjs.map +1 -1
- package/dist/components/BadgeIcon/BadgeIcon.cjs +5 -10
- package/dist/components/BadgeIcon/BadgeIcon.cjs.map +1 -1
- package/dist/components/BadgeIcon/BadgeIcon.d.cts.map +1 -1
- package/dist/components/BadgeIcon/BadgeIcon.d.mts.map +1 -1
- package/dist/components/BadgeIcon/BadgeIcon.mjs +5 -10
- package/dist/components/BadgeIcon/BadgeIcon.mjs.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.cjs +5 -5
- package/dist/components/BadgeStatus/BadgeStatus.cjs.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.d.cts.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.d.mts.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.mjs +5 -5
- package/dist/components/BadgeStatus/BadgeStatus.mjs.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.cjs +3 -3
- package/dist/components/BadgeWrapper/BadgeWrapper.cjs.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.d.cts.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.d.mts.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.mjs +3 -3
- package/dist/components/BadgeWrapper/BadgeWrapper.mjs.map +1 -1
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.cjs +51 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.cjs.map +1 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.constants.cjs +7 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.constants.cjs.map +1 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.constants.d.cts +3 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.constants.d.cts.map +1 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.constants.d.mts +3 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.constants.d.mts.map +1 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.constants.mjs +4 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.constants.mjs.map +1 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.d.cts +4 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.d.cts.map +1 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.d.mts +4 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.d.mts.map +1 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.mjs +31 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.mjs.map +1 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.cjs +3 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.cjs.map +1 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.d.cts +20 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.d.cts.map +1 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.d.mts +20 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.d.mts.map +1 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.mjs +2 -0
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.mjs.map +1 -0
- package/dist/components/BottomSheetOverlay/index.cjs +6 -0
- package/dist/components/BottomSheetOverlay/index.cjs.map +1 -0
- package/dist/components/BottomSheetOverlay/index.d.cts +3 -0
- package/dist/components/BottomSheetOverlay/index.d.cts.map +1 -0
- package/dist/components/BottomSheetOverlay/index.d.mts +3 -0
- package/dist/components/BottomSheetOverlay/index.d.mts.map +1 -0
- package/dist/components/BottomSheetOverlay/index.mjs +2 -0
- package/dist/components/BottomSheetOverlay/index.mjs.map +1 -0
- package/dist/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.cjs +35 -0
- package/dist/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.cjs.map +1 -0
- package/dist/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.d.cts +4 -0
- package/dist/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.d.cts.map +1 -0
- package/dist/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.d.mts +4 -0
- package/dist/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.d.mts.map +1 -0
- package/dist/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.mjs +35 -0
- package/dist/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.mjs.map +1 -0
- package/dist/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.types.cjs +12 -0
- package/dist/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.types.cjs.map +1 -0
- package/dist/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.types.d.cts +41 -0
- package/dist/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.types.d.cts.map +1 -0
- package/dist/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.types.d.mts +41 -0
- package/dist/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.types.d.mts.map +1 -0
- package/dist/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.types.mjs +9 -0
- package/dist/components/BottomSheets/BottomSheetFooter/BottomSheetFooter.types.mjs.map +1 -0
- package/dist/components/BottomSheets/BottomSheetFooter/index.cjs +8 -0
- package/dist/components/BottomSheets/BottomSheetFooter/index.cjs.map +1 -0
- package/dist/components/BottomSheets/BottomSheetFooter/index.d.cts +4 -0
- package/dist/components/BottomSheets/BottomSheetFooter/index.d.cts.map +1 -0
- package/dist/components/BottomSheets/BottomSheetFooter/index.d.mts +4 -0
- package/dist/components/BottomSheets/BottomSheetFooter/index.d.mts.map +1 -0
- package/dist/components/BottomSheets/BottomSheetFooter/index.mjs +3 -0
- package/dist/components/BottomSheets/BottomSheetFooter/index.mjs.map +1 -0
- package/dist/components/Box/Box.cjs +12 -27
- package/dist/components/Box/Box.cjs.map +1 -1
- package/dist/components/Box/Box.d.cts.map +1 -1
- package/dist/components/Box/Box.d.mts.map +1 -1
- package/dist/components/Box/Box.mjs +12 -27
- package/dist/components/Box/Box.mjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.cjs +50 -41
- package/dist/components/ButtonBase/ButtonBase.cjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.d.cts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.d.mts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.mjs +50 -41
- package/dist/components/ButtonBase/ButtonBase.mjs.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.cjs +5 -10
- package/dist/components/ButtonIcon/ButtonIcon.cjs.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.d.cts.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.d.mts.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.mjs +5 -10
- package/dist/components/ButtonIcon/ButtonIcon.mjs.map +1 -1
- package/dist/components/Card/Card.cjs +26 -0
- package/dist/components/Card/Card.cjs.map +1 -0
- package/dist/components/Card/Card.d.cts +4 -0
- package/dist/components/Card/Card.d.cts.map +1 -0
- package/dist/components/Card/Card.d.mts +4 -0
- package/dist/components/Card/Card.d.mts.map +1 -0
- package/dist/components/Card/Card.mjs +26 -0
- package/dist/components/Card/Card.mjs.map +1 -0
- package/dist/components/Card/Card.types.cjs +3 -0
- package/dist/components/Card/Card.types.cjs.map +1 -0
- package/dist/components/Card/Card.types.d.cts +25 -0
- package/dist/components/Card/Card.types.d.cts.map +1 -0
- package/dist/components/Card/Card.types.d.mts +25 -0
- package/dist/components/Card/Card.types.d.mts.map +1 -0
- package/dist/components/Card/Card.types.mjs +2 -0
- package/dist/components/Card/Card.types.mjs.map +1 -0
- package/dist/components/Card/index.cjs +6 -0
- package/dist/components/Card/index.cjs.map +1 -0
- package/dist/components/Card/index.d.cts +3 -0
- package/dist/components/Card/index.d.cts.map +1 -0
- package/dist/components/Card/index.d.mts +3 -0
- package/dist/components/Card/index.d.mts.map +1 -0
- package/dist/components/Card/index.mjs +2 -0
- package/dist/components/Card/index.mjs.map +1 -0
- package/dist/components/Checkbox/Checkbox.cjs +4 -4
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.cts.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.mts.map +1 -1
- package/dist/components/Checkbox/Checkbox.mjs +4 -4
- package/dist/components/Checkbox/Checkbox.mjs.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.cjs +123 -0
- package/dist/components/HeaderBase/HeaderBase.cjs.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.d.cts +4 -0
- package/dist/components/HeaderBase/HeaderBase.d.cts.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.d.mts +4 -0
- package/dist/components/HeaderBase/HeaderBase.d.mts.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.mjs +103 -0
- package/dist/components/HeaderBase/HeaderBase.mjs.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.types.cjs +3 -0
- package/dist/components/HeaderBase/HeaderBase.types.cjs.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.types.d.cts +71 -0
- package/dist/components/HeaderBase/HeaderBase.types.d.cts.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.types.d.mts +71 -0
- package/dist/components/HeaderBase/HeaderBase.types.d.mts.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.types.mjs +2 -0
- package/dist/components/HeaderBase/HeaderBase.types.mjs.map +1 -0
- package/dist/components/HeaderBase/index.cjs +6 -0
- package/dist/components/HeaderBase/index.cjs.map +1 -0
- package/dist/components/HeaderBase/index.d.cts +3 -0
- package/dist/components/HeaderBase/index.d.cts.map +1 -0
- package/dist/components/HeaderBase/index.d.mts +3 -0
- package/dist/components/HeaderBase/index.d.mts.map +1 -0
- package/dist/components/HeaderBase/index.mjs +2 -0
- package/dist/components/HeaderBase/index.mjs.map +1 -0
- package/dist/components/Icon/Icon.assets.cjs +4 -0
- package/dist/components/Icon/Icon.assets.cjs.map +1 -1
- package/dist/components/Icon/Icon.assets.d.cts.map +1 -1
- package/dist/components/Icon/Icon.assets.d.mts.map +1 -1
- package/dist/components/Icon/Icon.assets.mjs +4 -0
- package/dist/components/Icon/Icon.assets.mjs.map +1 -1
- package/dist/components/Icon/Icon.cjs +4 -32
- package/dist/components/Icon/Icon.cjs.map +1 -1
- package/dist/components/Icon/Icon.d.cts.map +1 -1
- package/dist/components/Icon/Icon.d.mts.map +1 -1
- package/dist/components/Icon/Icon.mjs +2 -10
- package/dist/components/Icon/Icon.mjs.map +1 -1
- package/dist/components/Icon/assets/after-hours.svg +1 -0
- package/dist/components/Icon/assets/corporate-fare.svg +1 -0
- package/dist/components/Input/Input.cjs +53 -0
- package/dist/components/Input/Input.cjs.map +1 -0
- package/dist/components/Input/Input.d.cts +10 -0
- package/dist/components/Input/Input.d.cts.map +1 -0
- package/dist/components/Input/Input.d.mts +10 -0
- package/dist/components/Input/Input.d.mts.map +1 -0
- package/dist/components/Input/Input.mjs +50 -0
- package/dist/components/Input/Input.mjs.map +1 -0
- package/dist/components/Input/Input.types.cjs +3 -0
- package/dist/components/Input/Input.types.cjs.map +1 -0
- package/dist/components/Input/Input.types.d.cts +33 -0
- package/dist/components/Input/Input.types.d.cts.map +1 -0
- package/dist/components/Input/Input.types.d.mts +33 -0
- package/dist/components/Input/Input.types.d.mts.map +1 -0
- package/dist/components/Input/Input.types.mjs +2 -0
- package/dist/components/Input/Input.types.mjs.map +1 -0
- package/dist/components/Input/index.cjs +6 -0
- package/dist/components/Input/index.cjs.map +1 -0
- package/dist/components/Input/index.d.cts +3 -0
- package/dist/components/Input/index.d.cts.map +1 -0
- package/dist/components/Input/index.d.mts +3 -0
- package/dist/components/Input/index.d.mts.map +1 -0
- package/dist/components/Input/index.mjs +2 -0
- package/dist/components/Input/index.mjs.map +1 -0
- package/dist/components/Label/Label.cjs +11 -0
- package/dist/components/Label/Label.cjs.map +1 -0
- package/dist/components/Label/Label.d.cts +4 -0
- package/dist/components/Label/Label.d.cts.map +1 -0
- package/dist/components/Label/Label.d.mts +4 -0
- package/dist/components/Label/Label.d.mts.map +1 -0
- package/dist/components/Label/Label.mjs +11 -0
- package/dist/components/Label/Label.mjs.map +1 -0
- package/dist/components/Label/Label.types.cjs +3 -0
- package/dist/components/Label/Label.types.cjs.map +1 -0
- package/dist/components/Label/Label.types.d.cts +9 -0
- package/dist/components/Label/Label.types.d.cts.map +1 -0
- package/dist/components/Label/Label.types.d.mts +9 -0
- package/dist/components/Label/Label.types.d.mts.map +1 -0
- package/dist/components/Label/Label.types.mjs +2 -0
- package/dist/components/Label/Label.types.mjs.map +1 -0
- package/dist/components/Label/index.cjs +6 -0
- package/dist/components/Label/index.cjs.map +1 -0
- package/dist/components/Label/index.d.cts +3 -0
- package/dist/components/Label/index.d.cts.map +1 -0
- package/dist/components/Label/index.d.mts +3 -0
- package/dist/components/Label/index.d.mts.map +1 -0
- package/dist/components/Label/index.mjs +2 -0
- package/dist/components/Label/index.mjs.map +1 -0
- package/dist/components/Skeleton/Skeleton.cjs +86 -0
- package/dist/components/Skeleton/Skeleton.cjs.map +1 -0
- package/dist/components/Skeleton/Skeleton.d.cts +5 -0
- package/dist/components/Skeleton/Skeleton.d.cts.map +1 -0
- package/dist/components/Skeleton/Skeleton.d.mts +5 -0
- package/dist/components/Skeleton/Skeleton.d.mts.map +1 -0
- package/dist/components/Skeleton/Skeleton.mjs +68 -0
- package/dist/components/Skeleton/Skeleton.mjs.map +1 -0
- package/dist/components/Skeleton/Skeleton.types.cjs +3 -0
- package/dist/components/Skeleton/Skeleton.types.cjs.map +1 -0
- package/dist/components/Skeleton/Skeleton.types.d.cts +51 -0
- package/dist/components/Skeleton/Skeleton.types.d.cts.map +1 -0
- package/dist/components/Skeleton/Skeleton.types.d.mts +51 -0
- package/dist/components/Skeleton/Skeleton.types.d.mts.map +1 -0
- package/dist/components/Skeleton/Skeleton.types.mjs +2 -0
- package/dist/components/Skeleton/Skeleton.types.mjs.map +1 -0
- package/dist/components/Skeleton/index.cjs +9 -0
- package/dist/components/Skeleton/index.cjs.map +1 -0
- package/dist/components/Skeleton/index.d.cts +3 -0
- package/dist/components/Skeleton/index.d.cts.map +1 -0
- package/dist/components/Skeleton/index.d.mts +3 -0
- package/dist/components/Skeleton/index.d.mts.map +1 -0
- package/dist/components/Skeleton/index.mjs +2 -0
- package/dist/components/Skeleton/index.mjs.map +1 -0
- package/dist/components/Text/Text.cjs +9 -14
- package/dist/components/Text/Text.cjs.map +1 -1
- package/dist/components/Text/Text.d.cts.map +1 -1
- package/dist/components/Text/Text.d.mts.map +1 -1
- package/dist/components/Text/Text.mjs +10 -15
- package/dist/components/Text/Text.mjs.map +1 -1
- package/dist/components/Toast/Toast.cjs +174 -0
- package/dist/components/Toast/Toast.cjs.map +1 -0
- package/dist/components/Toast/Toast.constants.cjs +12 -0
- package/dist/components/Toast/Toast.constants.cjs.map +1 -0
- package/dist/components/Toast/Toast.constants.d.cts +8 -0
- package/dist/components/Toast/Toast.constants.d.cts.map +1 -0
- package/dist/components/Toast/Toast.constants.d.mts +8 -0
- package/dist/components/Toast/Toast.constants.d.mts.map +1 -0
- package/dist/components/Toast/Toast.constants.mjs +9 -0
- package/dist/components/Toast/Toast.constants.mjs.map +1 -0
- package/dist/components/Toast/Toast.context.cjs +40 -0
- package/dist/components/Toast/Toast.context.cjs.map +1 -0
- package/dist/components/Toast/Toast.context.d.cts +7 -0
- package/dist/components/Toast/Toast.context.d.cts.map +1 -0
- package/dist/components/Toast/Toast.context.d.mts +7 -0
- package/dist/components/Toast/Toast.context.d.mts.map +1 -0
- package/dist/components/Toast/Toast.context.mjs +20 -0
- package/dist/components/Toast/Toast.context.mjs.map +1 -0
- package/dist/components/Toast/Toast.d.cts +8 -0
- package/dist/components/Toast/Toast.d.cts.map +1 -0
- package/dist/components/Toast/Toast.d.mts +8 -0
- package/dist/components/Toast/Toast.d.mts.map +1 -0
- package/dist/components/Toast/Toast.mjs +156 -0
- package/dist/components/Toast/Toast.mjs.map +1 -0
- package/dist/components/Toast/Toast.types.cjs +19 -0
- package/dist/components/Toast/Toast.types.cjs.map +1 -0
- package/dist/components/Toast/Toast.types.d.cts +123 -0
- package/dist/components/Toast/Toast.types.d.cts.map +1 -0
- package/dist/components/Toast/Toast.types.d.mts +123 -0
- package/dist/components/Toast/Toast.types.d.mts.map +1 -0
- package/dist/components/Toast/Toast.types.mjs +16 -0
- package/dist/components/Toast/Toast.types.mjs.map +1 -0
- package/dist/components/Toast/index.cjs +19 -0
- package/dist/components/Toast/index.cjs.map +1 -0
- package/dist/components/Toast/index.d.cts +6 -0
- package/dist/components/Toast/index.d.cts.map +1 -0
- package/dist/components/Toast/index.d.mts +6 -0
- package/dist/components/Toast/index.d.mts.map +1 -0
- package/dist/components/Toast/index.mjs +5 -0
- package/dist/components/Toast/index.mjs.map +1 -0
- package/dist/components/index.cjs +21 -2
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +16 -0
- package/dist/components/index.d.cts.map +1 -1
- package/dist/components/index.d.mts +16 -0
- package/dist/components/index.d.mts.map +1 -1
- package/dist/components/index.mjs +8 -0
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.cjs +17 -9
- package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.cjs.map +1 -1
- package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.d.cts +1 -1
- package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.d.cts.map +1 -1
- package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.d.mts +1 -1
- package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.d.mts.map +1 -1
- package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.mjs +17 -6
- package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.mjs.map +1 -1
- package/dist/components/temp-components/Spinner/Spinner.cjs +2 -2
- package/dist/components/temp-components/Spinner/Spinner.cjs.map +1 -1
- package/dist/components/temp-components/Spinner/Spinner.d.cts.map +1 -1
- package/dist/components/temp-components/Spinner/Spinner.d.mts.map +1 -1
- package/dist/components/temp-components/Spinner/Spinner.mjs +2 -2
- package/dist/components/temp-components/Spinner/Spinner.mjs.map +1 -1
- package/dist/types/index.cjs +19 -17
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +19 -17
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.mts +19 -17
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs +19 -17
- package/dist/types/index.mjs.map +1 -1
- package/package.json +13 -9
- package/dist/components/Icon/Icon.utilities.cjs +0 -31
- package/dist/components/Icon/Icon.utilities.cjs.map +0 -1
- package/dist/components/Icon/Icon.utilities.d.cts +0 -22
- package/dist/components/Icon/Icon.utilities.d.cts.map +0 -1
- package/dist/components/Icon/Icon.utilities.d.mts +0 -22
- package/dist/components/Icon/Icon.utilities.d.mts.map +0 -1
- package/dist/components/Icon/Icon.utilities.mjs +0 -27
- package/dist/components/Icon/Icon.utilities.mjs.map +0 -1
- package/dist/components/Text/Text.utilities.cjs +0 -46
- package/dist/components/Text/Text.utilities.cjs.map +0 -1
- package/dist/components/Text/Text.utilities.d.cts +0 -32
- package/dist/components/Text/Text.utilities.d.cts.map +0 -1
- package/dist/components/Text/Text.utilities.d.mts +0 -32
- package/dist/components/Text/Text.utilities.d.mts.map +0 -1
- package/dist/components/Text/Text.utilities.mjs +0 -42
- package/dist/components/Text/Text.utilities.mjs.map +0 -1
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
function $importDefault(module) {
|
|
2
|
+
if (module?.__esModule) {
|
|
3
|
+
return module.default;
|
|
4
|
+
}
|
|
5
|
+
return module;
|
|
6
|
+
}
|
|
7
|
+
// Third party dependencies.
|
|
8
|
+
import { useTailwind } from "@metamask/design-system-twrnc-preset";
|
|
9
|
+
import $React, { forwardRef, isValidElement, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
10
|
+
const React = $importDefault($React);
|
|
11
|
+
import { Dimensions, View } from "react-native/index.js";
|
|
12
|
+
// eslint-disable-next-line import-x/default
|
|
13
|
+
import Animated, { cancelAnimation, runOnJS, useAnimatedStyle, useSharedValue, withDelay, withTiming } from "react-native-reanimated";
|
|
14
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
15
|
+
// External dependencies.
|
|
16
|
+
import { AvatarAccount, AvatarAccountSize } from "../AvatarAccount/index.mjs";
|
|
17
|
+
import { AvatarFavicon, AvatarFaviconSize } from "../AvatarFavicon/index.mjs";
|
|
18
|
+
import { AvatarIcon, AvatarIconSize } from "../AvatarIcon/index.mjs";
|
|
19
|
+
import { AvatarNetwork, AvatarNetworkSize } from "../AvatarNetwork/index.mjs";
|
|
20
|
+
import { Button, ButtonVariant } from "../Button/index.mjs";
|
|
21
|
+
import { ButtonIcon } from "../ButtonIcon/index.mjs";
|
|
22
|
+
import { Text, TextVariant, TextColor, FontWeight } from "../Text/index.mjs";
|
|
23
|
+
// Internal dependencies.
|
|
24
|
+
import { TOAST_VISIBILITY_DURATION, TOAST_ANIMATION_DURATION, TOAST_BOTTOM_PADDING } from "./Toast.constants.mjs";
|
|
25
|
+
import { ButtonIconVariant, ToastVariant } from "./Toast.types.mjs";
|
|
26
|
+
const screenHeight = Dimensions.get('window').height;
|
|
27
|
+
const Toast = forwardRef(({ twClassName, labelsContainerProps, ...props }, ref) => {
|
|
28
|
+
const tw = useTailwind();
|
|
29
|
+
const [toastOptions, setToastOptions] = useState(undefined);
|
|
30
|
+
const replacementTimerRef = useRef(null);
|
|
31
|
+
const { bottom: bottomNotchSpacing } = useSafeAreaInsets();
|
|
32
|
+
const translateYProgress = useSharedValue(screenHeight);
|
|
33
|
+
const bottomOffset = toastOptions?.bottomOffset ?? 0;
|
|
34
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
35
|
+
transform: [{ translateY: translateYProgress.value - bottomOffset }],
|
|
36
|
+
}));
|
|
37
|
+
const baseStyle = useMemo(() => [
|
|
38
|
+
tw.style('absolute left-4 right-4 bottom-0 bg-background-section border border-border-muted rounded-xl p-3 flex-row items-center', twClassName),
|
|
39
|
+
animatedStyle,
|
|
40
|
+
], [tw, animatedStyle, twClassName]);
|
|
41
|
+
const resetState = () => setToastOptions(undefined);
|
|
42
|
+
const showToast = (options) => {
|
|
43
|
+
let timeoutDuration = 0;
|
|
44
|
+
if (toastOptions) {
|
|
45
|
+
cancelAnimation(translateYProgress);
|
|
46
|
+
timeoutDuration = 100;
|
|
47
|
+
// Clear existing toast state to prevent animation conflicts when showing rapid successive toasts
|
|
48
|
+
setToastOptions(undefined);
|
|
49
|
+
}
|
|
50
|
+
if (replacementTimerRef.current !== null) {
|
|
51
|
+
clearTimeout(replacementTimerRef.current);
|
|
52
|
+
}
|
|
53
|
+
replacementTimerRef.current = setTimeout(() => {
|
|
54
|
+
replacementTimerRef.current = null;
|
|
55
|
+
setToastOptions(options);
|
|
56
|
+
}, timeoutDuration);
|
|
57
|
+
};
|
|
58
|
+
const closeToast = () => {
|
|
59
|
+
if (replacementTimerRef.current !== null) {
|
|
60
|
+
clearTimeout(replacementTimerRef.current);
|
|
61
|
+
replacementTimerRef.current = null;
|
|
62
|
+
}
|
|
63
|
+
translateYProgress.value = withTiming(screenHeight, { duration: TOAST_ANIMATION_DURATION }, () => {
|
|
64
|
+
runOnJS(resetState)();
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
useImperativeHandle(ref, () => ({
|
|
68
|
+
showToast,
|
|
69
|
+
closeToast,
|
|
70
|
+
}));
|
|
71
|
+
const onAnimatedViewLayout = (e) => {
|
|
72
|
+
/* istanbul ignore next - guard only; layout fires when toastOptions is set */
|
|
73
|
+
if (toastOptions) {
|
|
74
|
+
const { height } = e.nativeEvent.layout;
|
|
75
|
+
const translateYToValue = -(TOAST_BOTTOM_PADDING + bottomNotchSpacing);
|
|
76
|
+
translateYProgress.value = height;
|
|
77
|
+
if (toastOptions.hasNoTimeout) {
|
|
78
|
+
translateYProgress.value = withTiming(translateYToValue, {
|
|
79
|
+
duration: TOAST_ANIMATION_DURATION,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
translateYProgress.value = withTiming(translateYToValue, { duration: TOAST_ANIMATION_DURATION }, () => {
|
|
84
|
+
translateYProgress.value = withDelay(TOAST_VISIBILITY_DURATION, withTiming(height, { duration: TOAST_ANIMATION_DURATION }, runOnJS(resetState)));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const renderLabel = (labelOptions) => (<Text variant={TextVariant.BodyMd}>
|
|
90
|
+
{labelOptions.map(({ label, isBold }, index) => (<Text key={`toast-label-${index}`} variant={TextVariant.BodyMd} fontWeight={isBold ? FontWeight.Bold : undefined} color={TextColor.TextDefault}>
|
|
91
|
+
{label}
|
|
92
|
+
</Text>))}
|
|
93
|
+
</Text>);
|
|
94
|
+
const renderDescription = (descriptionOptions) => descriptionOptions && (<Text variant={TextVariant.BodySm} color={TextColor.TextAlternative} style={tw.style('mt-1')}>
|
|
95
|
+
{descriptionOptions.description}
|
|
96
|
+
</Text>);
|
|
97
|
+
const renderActionButton = (linkButtonOptions) => linkButtonOptions && (<Button variant={ButtonVariant.Secondary} onPress={linkButtonOptions.onPress} style={tw.style('mt-2')}>
|
|
98
|
+
{linkButtonOptions.label}
|
|
99
|
+
</Button>);
|
|
100
|
+
const renderCloseButton = (closeButtonOptions) => {
|
|
101
|
+
if (closeButtonOptions?.variant === ButtonIconVariant.Icon) {
|
|
102
|
+
return (<ButtonIcon onPress={(e) => closeButtonOptions?.onPress?.(e)} iconName={closeButtonOptions?.iconName}/>);
|
|
103
|
+
}
|
|
104
|
+
return (<Button variant={ButtonVariant.Primary} onPress={(e) => closeButtonOptions?.onPress?.(e)} startIconName={closeButtonOptions?.startIconName} endIconName={closeButtonOptions?.endIconName} style={closeButtonOptions?.style}>
|
|
105
|
+
{closeButtonOptions?.children}
|
|
106
|
+
</Button>);
|
|
107
|
+
};
|
|
108
|
+
const renderAvatar = () => {
|
|
109
|
+
switch (toastOptions?.variant) {
|
|
110
|
+
case ToastVariant.Plain:
|
|
111
|
+
return null;
|
|
112
|
+
case ToastVariant.Account: {
|
|
113
|
+
const { accountAddress, accountAvatarType } = toastOptions;
|
|
114
|
+
return (<AvatarAccount address={accountAddress} variant={accountAvatarType} size={AvatarAccountSize.Md} style={tw.style('mr-4')}/>);
|
|
115
|
+
}
|
|
116
|
+
case ToastVariant.Network: {
|
|
117
|
+
const { networkImageSource, networkName } = toastOptions;
|
|
118
|
+
return (<AvatarNetwork name={networkName} src={networkImageSource} size={AvatarNetworkSize.Md} style={tw.style('mr-4')}/>);
|
|
119
|
+
}
|
|
120
|
+
case ToastVariant.App: {
|
|
121
|
+
const { appIconSource } = toastOptions;
|
|
122
|
+
return (<AvatarFavicon src={appIconSource} size={AvatarFaviconSize.Md} style={tw.style('mr-4')}/>);
|
|
123
|
+
}
|
|
124
|
+
case ToastVariant.Icon: {
|
|
125
|
+
const { iconName, severity } = toastOptions;
|
|
126
|
+
return (<AvatarIcon iconName={iconName} severity={severity} size={AvatarIconSize.Md} style={tw.style('mr-4')}/>);
|
|
127
|
+
}
|
|
128
|
+
/* istanbul ignore next - all variants handled above */
|
|
129
|
+
default:
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const renderToastContent = (options) => {
|
|
134
|
+
const { labelOptions, descriptionOptions, linkButtonOptions, closeButtonOptions, startAccessory, } = options;
|
|
135
|
+
const isStartAccessoryValid = startAccessory !== null &&
|
|
136
|
+
startAccessory !== undefined &&
|
|
137
|
+
isValidElement(startAccessory);
|
|
138
|
+
return (<>
|
|
139
|
+
{isStartAccessoryValid ? startAccessory : renderAvatar()}
|
|
140
|
+
<View style={tw.style('flex-1 justify-center')} {...labelsContainerProps}>
|
|
141
|
+
{renderLabel(labelOptions)}
|
|
142
|
+
{renderDescription(descriptionOptions)}
|
|
143
|
+
{renderActionButton(linkButtonOptions)}
|
|
144
|
+
</View>
|
|
145
|
+
{closeButtonOptions ? renderCloseButton(closeButtonOptions) : null}
|
|
146
|
+
</>);
|
|
147
|
+
};
|
|
148
|
+
if (!toastOptions) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
return (<Animated.View onLayout={onAnimatedViewLayout} style={baseStyle} {...props}>
|
|
152
|
+
{renderToastContent(toastOptions)}
|
|
153
|
+
</Animated.View>);
|
|
154
|
+
});
|
|
155
|
+
export default Toast;
|
|
156
|
+
//# sourceMappingURL=Toast.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.mjs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B,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,GACf,GAAG,OAAO,CAAC;QAEZ,MAAM,qBAAqB,GACzB,cAAc,KAAK,IAAI;YACvB,cAAc,KAAK,SAAS;YAC5B,cAAc,CAAC,cAAc,CAAC,CAAC;QAEjC,OAAO,CACL,EACE;UAAA,CAAC,qBAAqB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,YAAY,EAAE,CACxD;UAAA,CAAC,IAAI,CACH,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,CACzC,IAAI,oBAAoB,CAAC,CAEzB;YAAA,CAAC,WAAW,CAAC,YAAY,CAAC,CAC1B;YAAA,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CACtC;YAAA,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CACxC;UAAA,EAAE,IAAI,CACN;UAAA,CAAC,kBAAkB,CAAC,CAAC,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,IAAI,CACpE;QAAA,GAAG,CACJ,CAAC;IACJ,CAAC,CAAC;IAEF,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,CAAC,QAAQ,CAAC,IAAI,CACZ,QAAQ,CAAC,CAAC,oBAAoB,CAAC,CAC/B,KAAK,CAAC,CAAC,SAAS,CAAC,CACjB,IAAI,KAAK,CAAC,CAEV;QAAA,CAAC,kBAAkB,CAAC,YAAY,CAAC,CACnC;MAAA,EAAE,QAAQ,CAAC,IAAI,CAAC,CACjB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["// Third party dependencies.\nimport { useTailwind } from '@metamask/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n isValidElement,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Dimensions, View } from 'react-native';\nimport type { LayoutChangeEvent, StyleProp, ViewStyle } from 'react-native';\n// eslint-disable-next-line import-x/default\nimport Animated, {\n cancelAnimation,\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n withDelay,\n withTiming,\n} from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\n// External dependencies.\nimport { AvatarAccount, AvatarAccountSize } from '../AvatarAccount';\nimport { AvatarFavicon, AvatarFaviconSize } from '../AvatarFavicon';\nimport { AvatarIcon, AvatarIconSize } from '../AvatarIcon';\nimport { AvatarNetwork, AvatarNetworkSize } from '../AvatarNetwork';\nimport { Button, ButtonVariant } from '../Button';\nimport { ButtonIcon } from '../ButtonIcon';\nimport { Text, TextVariant, TextColor, FontWeight } from '../Text';\n\n// Internal dependencies.\nimport {\n TOAST_VISIBILITY_DURATION,\n TOAST_ANIMATION_DURATION,\n TOAST_BOTTOM_PADDING,\n} from './Toast.constants';\nimport type {\n ToastCloseButtonOptions,\n ToastDescriptionOptions,\n ToastLabelOptions,\n ToastLinkButtonOptions,\n ToastOptions,\n ToastProps,\n ToastRef,\n} from './Toast.types';\nimport { ButtonIconVariant, ToastVariant } from './Toast.types';\n\nconst screenHeight = Dimensions.get('window').height;\n\nconst Toast = forwardRef<ToastRef, ToastProps>(\n ({ twClassName, labelsContainerProps, ...props }, ref) => {\n const tw = useTailwind();\n const [toastOptions, setToastOptions] = useState<ToastOptions | undefined>(\n undefined,\n );\n const replacementTimerRef = useRef<ReturnType<typeof setTimeout> | null>(\n null,\n );\n const { bottom: bottomNotchSpacing } = useSafeAreaInsets();\n const translateYProgress = useSharedValue(screenHeight);\n const bottomOffset = toastOptions?.bottomOffset ?? 0;\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ translateY: translateYProgress.value - bottomOffset }],\n }));\n const baseStyle: StyleProp<ViewStyle> = useMemo(\n () => [\n tw.style(\n 'absolute left-4 right-4 bottom-0 bg-background-section border border-border-muted rounded-xl p-3 flex-row items-center',\n twClassName,\n ),\n animatedStyle,\n ],\n [tw, animatedStyle, twClassName],\n );\n\n const resetState = () => setToastOptions(undefined);\n\n const showToast = (options: ToastOptions) => {\n let timeoutDuration = 0;\n if (toastOptions) {\n cancelAnimation(translateYProgress);\n timeoutDuration = 100;\n // Clear existing toast state to prevent animation conflicts when showing rapid successive toasts\n setToastOptions(undefined);\n }\n if (replacementTimerRef.current !== null) {\n clearTimeout(replacementTimerRef.current);\n }\n replacementTimerRef.current = setTimeout(() => {\n replacementTimerRef.current = null;\n setToastOptions(options);\n }, timeoutDuration);\n };\n\n const closeToast = () => {\n if (replacementTimerRef.current !== null) {\n clearTimeout(replacementTimerRef.current);\n replacementTimerRef.current = null;\n }\n translateYProgress.value = withTiming(\n screenHeight,\n { duration: TOAST_ANIMATION_DURATION },\n () => {\n runOnJS(resetState)();\n },\n );\n };\n\n useImperativeHandle(ref, () => ({\n showToast,\n closeToast,\n }));\n\n const onAnimatedViewLayout = (e: LayoutChangeEvent) => {\n /* istanbul ignore next - guard only; layout fires when toastOptions is set */\n if (toastOptions) {\n const { height } = e.nativeEvent.layout;\n const translateYToValue = -(TOAST_BOTTOM_PADDING + bottomNotchSpacing);\n\n translateYProgress.value = height;\n\n if (toastOptions.hasNoTimeout) {\n translateYProgress.value = withTiming(translateYToValue, {\n duration: TOAST_ANIMATION_DURATION,\n });\n } else {\n translateYProgress.value = withTiming(\n translateYToValue,\n { duration: TOAST_ANIMATION_DURATION },\n () => {\n translateYProgress.value = withDelay(\n TOAST_VISIBILITY_DURATION,\n withTiming(\n height,\n { duration: TOAST_ANIMATION_DURATION },\n runOnJS(resetState),\n ),\n );\n },\n );\n }\n }\n };\n\n const renderLabel = (labelOptions: ToastLabelOptions) => (\n <Text variant={TextVariant.BodyMd}>\n {labelOptions.map(({ label, isBold }, index) => (\n <Text\n key={`toast-label-${index}`}\n variant={TextVariant.BodyMd}\n fontWeight={isBold ? FontWeight.Bold : undefined}\n color={TextColor.TextDefault}\n >\n {label}\n </Text>\n ))}\n </Text>\n );\n\n const renderDescription = (descriptionOptions?: ToastDescriptionOptions) =>\n descriptionOptions && (\n <Text\n variant={TextVariant.BodySm}\n color={TextColor.TextAlternative}\n style={tw.style('mt-1')}\n >\n {descriptionOptions.description}\n </Text>\n );\n\n const renderActionButton = (linkButtonOptions?: ToastLinkButtonOptions) =>\n linkButtonOptions && (\n <Button\n variant={ButtonVariant.Secondary}\n onPress={linkButtonOptions.onPress}\n style={tw.style('mt-2')}\n >\n {linkButtonOptions.label}\n </Button>\n );\n\n const renderCloseButton = (\n closeButtonOptions?: ToastCloseButtonOptions,\n ) => {\n if (closeButtonOptions?.variant === ButtonIconVariant.Icon) {\n return (\n <ButtonIcon\n onPress={(e) => closeButtonOptions?.onPress?.(e)}\n iconName={closeButtonOptions?.iconName}\n />\n );\n }\n return (\n <Button\n variant={ButtonVariant.Primary}\n onPress={(e) => closeButtonOptions?.onPress?.(e)}\n startIconName={closeButtonOptions?.startIconName}\n endIconName={closeButtonOptions?.endIconName}\n style={closeButtonOptions?.style}\n >\n {closeButtonOptions?.children}\n </Button>\n );\n };\n\n const renderAvatar = () => {\n switch (toastOptions?.variant) {\n case ToastVariant.Plain:\n return null;\n case ToastVariant.Account: {\n const { accountAddress, accountAvatarType } = toastOptions;\n return (\n <AvatarAccount\n address={accountAddress}\n variant={accountAvatarType}\n size={AvatarAccountSize.Md}\n style={tw.style('mr-4')}\n />\n );\n }\n case ToastVariant.Network: {\n const { networkImageSource, networkName } = toastOptions;\n return (\n <AvatarNetwork\n name={networkName}\n src={networkImageSource}\n size={AvatarNetworkSize.Md}\n style={tw.style('mr-4')}\n />\n );\n }\n case ToastVariant.App: {\n const { appIconSource } = toastOptions;\n return (\n <AvatarFavicon\n src={appIconSource}\n size={AvatarFaviconSize.Md}\n style={tw.style('mr-4')}\n />\n );\n }\n case ToastVariant.Icon: {\n const { iconName, severity } = toastOptions;\n return (\n <AvatarIcon\n iconName={iconName}\n severity={severity}\n size={AvatarIconSize.Md}\n style={tw.style('mr-4')}\n />\n );\n }\n /* istanbul ignore next - all variants handled above */\n default:\n return null;\n }\n };\n\n const renderToastContent = (options: ToastOptions) => {\n const {\n labelOptions,\n descriptionOptions,\n linkButtonOptions,\n closeButtonOptions,\n startAccessory,\n } = options;\n\n const isStartAccessoryValid =\n startAccessory !== null &&\n startAccessory !== undefined &&\n isValidElement(startAccessory);\n\n return (\n <>\n {isStartAccessoryValid ? startAccessory : renderAvatar()}\n <View\n style={tw.style('flex-1 justify-center')}\n {...labelsContainerProps}\n >\n {renderLabel(labelOptions)}\n {renderDescription(descriptionOptions)}\n {renderActionButton(linkButtonOptions)}\n </View>\n {closeButtonOptions ? renderCloseButton(closeButtonOptions) : null}\n </>\n );\n };\n\n if (!toastOptions) {\n return null;\n }\n\n return (\n <Animated.View\n onLayout={onAnimatedViewLayout}\n style={baseStyle}\n {...props}\n >\n {renderToastContent(toastOptions)}\n </Animated.View>\n );\n },\n);\n\nexport default Toast;\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ButtonIconVariant = exports.ToastVariant = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Toast variants.
|
|
6
|
+
*/
|
|
7
|
+
var ToastVariant;
|
|
8
|
+
(function (ToastVariant) {
|
|
9
|
+
ToastVariant["Plain"] = "Plain";
|
|
10
|
+
ToastVariant["Account"] = "Account";
|
|
11
|
+
ToastVariant["Network"] = "Network";
|
|
12
|
+
ToastVariant["App"] = "App";
|
|
13
|
+
ToastVariant["Icon"] = "Icon";
|
|
14
|
+
})(ToastVariant || (exports.ToastVariant = ToastVariant = {}));
|
|
15
|
+
var ButtonIconVariant;
|
|
16
|
+
(function (ButtonIconVariant) {
|
|
17
|
+
ButtonIconVariant["Icon"] = "Icon";
|
|
18
|
+
})(ButtonIconVariant || (exports.ButtonIconVariant = ButtonIconVariant = {}));
|
|
19
|
+
//# sourceMappingURL=Toast.types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.types.cjs","sourceRoot":"","sources":["../../../src/components/Toast/Toast.types.ts"],"names":[],"mappings":";;;AAYA;;GAEG;AACH,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,+BAAe,CAAA;IACf,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;IACnB,2BAAW,CAAA;IACX,6BAAa,CAAA;AACf,CAAC,EANW,YAAY,4BAAZ,YAAY,QAMvB;AA0CD,IAAY,iBAEX;AAFD,WAAY,iBAAiB;IAC3B,kCAAa,CAAA;AACf,CAAC,EAFW,iBAAiB,iCAAjB,iBAAiB,QAE5B","sourcesContent":["// Third party dependencies.\nimport type { ReactElement } from 'react';\nimport type { ViewProps } from 'react-native';\n\n// External Dependencies.\nimport type { AvatarIconSeverity } from '../../types';\nimport type { AvatarAccountVariant } from '../AvatarAccount';\nimport type { ButtonProps } from '../Button';\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport type { IconName } from '../Icon';\nimport type { ImageOrSvgSrc } from '../temp-components/ImageOrSvg';\n\n/**\n * Toast variants.\n */\nexport enum ToastVariant {\n Plain = 'Plain',\n Account = 'Account',\n Network = 'Network',\n App = 'App',\n Icon = 'Icon',\n}\n\n/**\n * Options for the main text in the toast.\n */\nexport type ToastLabelOptions = {\n label: string;\n isBold?: boolean;\n}[];\n\n/**\n * Options for the description text in the toast.\n */\nexport type ToastDescriptionOptions = {\n description: string;\n};\n\n/**\n * Options for displaying a Link in the toast.\n */\nexport type ToastLinkButtonOptions = {\n label: string;\n onPress: () => void;\n};\n\n/**\n * Common toast option shared between all other options.\n */\ntype BaseToastVariants = {\n hasNoTimeout: boolean;\n labelOptions: ToastLabelOptions;\n descriptionOptions?: ToastDescriptionOptions;\n linkButtonOptions?: ToastLinkButtonOptions;\n closeButtonOptions?: ToastCloseButtonOptions;\n startAccessory?: ReactElement;\n bottomOffset?: number;\n};\n\nexport type ToastCloseButtonOptions =\n | ButtonProps\n | (ButtonIconProps & { variant: ButtonIconVariant });\n\nexport enum ButtonIconVariant {\n Icon = 'Icon',\n}\n\n/**\n * Plain toast option.\n */\ntype PlainToastOption = {\n variant: ToastVariant.Plain;\n} & BaseToastVariants;\n\n/**\n * Account toast option.\n */\ntype AccountToastOption = {\n variant: ToastVariant.Account;\n accountAddress: string;\n accountAvatarType: AvatarAccountVariant;\n} & BaseToastVariants;\n\n/**\n * Network toast option.\n */\ntype NetworkToastOption = {\n variant: ToastVariant.Network;\n networkName?: string;\n networkImageSource: ImageOrSvgSrc;\n} & BaseToastVariants;\n\n/**\n * App toast option.\n */\ntype AppToastOption = {\n variant: ToastVariant.App;\n appIconSource: ImageOrSvgSrc;\n} & BaseToastVariants;\n\ntype IconToastOption = {\n variant: ToastVariant.Icon;\n iconName: IconName;\n severity?: AvatarIconSeverity;\n} & BaseToastVariants;\n\n/**\n * Different toast options combined in a union type.\n */\nexport type ToastOptions =\n | PlainToastOption\n | AccountToastOption\n | NetworkToastOption\n | AppToastOption\n | IconToastOption;\n\n/**\n * Toast component reference.\n */\nexport type ToastRef = {\n showToast: (toastOptions: ToastOptions) => void;\n closeToast: () => void;\n};\n\n/**\n * Toast component props.\n * Extends ViewProps to inherit standard React Native props such as testID and accessibilityLabel.\n */\nexport type ToastProps = {\n /**\n * Optional Tailwind CSS classes for the toast container.\n */\n twClassName?: string;\n /**\n * Props spread to the labels container View (e.g., testID for testing).\n */\n labelsContainerProps?: Omit<ViewProps, 'children' | 'style'>;\n} & Omit<ViewProps, 'style'>;\n\n/**\n * Toast context parameters.\n */\nexport type ToastContextParams = {\n toastRef: React.RefObject<ToastRef> | undefined;\n};\n"]}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { ViewProps } from "react-native/index.js";
|
|
3
|
+
import type { AvatarIconSeverity } from "../../types/index.cjs";
|
|
4
|
+
import type { AvatarAccountVariant } from "../AvatarAccount/index.cjs";
|
|
5
|
+
import type { ButtonProps } from "../Button/index.cjs";
|
|
6
|
+
import type { ButtonIconProps } from "../ButtonIcon/index.cjs";
|
|
7
|
+
import type { IconName } from "../Icon/index.cjs";
|
|
8
|
+
import type { ImageOrSvgSrc } from "../temp-components/ImageOrSvg/index.cjs";
|
|
9
|
+
/**
|
|
10
|
+
* Toast variants.
|
|
11
|
+
*/
|
|
12
|
+
export declare enum ToastVariant {
|
|
13
|
+
Plain = "Plain",
|
|
14
|
+
Account = "Account",
|
|
15
|
+
Network = "Network",
|
|
16
|
+
App = "App",
|
|
17
|
+
Icon = "Icon"
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Options for the main text in the toast.
|
|
21
|
+
*/
|
|
22
|
+
export type ToastLabelOptions = {
|
|
23
|
+
label: string;
|
|
24
|
+
isBold?: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
/**
|
|
27
|
+
* Options for the description text in the toast.
|
|
28
|
+
*/
|
|
29
|
+
export type ToastDescriptionOptions = {
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Options for displaying a Link in the toast.
|
|
34
|
+
*/
|
|
35
|
+
export type ToastLinkButtonOptions = {
|
|
36
|
+
label: string;
|
|
37
|
+
onPress: () => void;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Common toast option shared between all other options.
|
|
41
|
+
*/
|
|
42
|
+
type BaseToastVariants = {
|
|
43
|
+
hasNoTimeout: boolean;
|
|
44
|
+
labelOptions: ToastLabelOptions;
|
|
45
|
+
descriptionOptions?: ToastDescriptionOptions;
|
|
46
|
+
linkButtonOptions?: ToastLinkButtonOptions;
|
|
47
|
+
closeButtonOptions?: ToastCloseButtonOptions;
|
|
48
|
+
startAccessory?: ReactElement;
|
|
49
|
+
bottomOffset?: number;
|
|
50
|
+
};
|
|
51
|
+
export type ToastCloseButtonOptions = ButtonProps | (ButtonIconProps & {
|
|
52
|
+
variant: ButtonIconVariant;
|
|
53
|
+
});
|
|
54
|
+
export declare enum ButtonIconVariant {
|
|
55
|
+
Icon = "Icon"
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Plain toast option.
|
|
59
|
+
*/
|
|
60
|
+
type PlainToastOption = {
|
|
61
|
+
variant: ToastVariant.Plain;
|
|
62
|
+
} & BaseToastVariants;
|
|
63
|
+
/**
|
|
64
|
+
* Account toast option.
|
|
65
|
+
*/
|
|
66
|
+
type AccountToastOption = {
|
|
67
|
+
variant: ToastVariant.Account;
|
|
68
|
+
accountAddress: string;
|
|
69
|
+
accountAvatarType: AvatarAccountVariant;
|
|
70
|
+
} & BaseToastVariants;
|
|
71
|
+
/**
|
|
72
|
+
* Network toast option.
|
|
73
|
+
*/
|
|
74
|
+
type NetworkToastOption = {
|
|
75
|
+
variant: ToastVariant.Network;
|
|
76
|
+
networkName?: string;
|
|
77
|
+
networkImageSource: ImageOrSvgSrc;
|
|
78
|
+
} & BaseToastVariants;
|
|
79
|
+
/**
|
|
80
|
+
* App toast option.
|
|
81
|
+
*/
|
|
82
|
+
type AppToastOption = {
|
|
83
|
+
variant: ToastVariant.App;
|
|
84
|
+
appIconSource: ImageOrSvgSrc;
|
|
85
|
+
} & BaseToastVariants;
|
|
86
|
+
type IconToastOption = {
|
|
87
|
+
variant: ToastVariant.Icon;
|
|
88
|
+
iconName: IconName;
|
|
89
|
+
severity?: AvatarIconSeverity;
|
|
90
|
+
} & BaseToastVariants;
|
|
91
|
+
/**
|
|
92
|
+
* Different toast options combined in a union type.
|
|
93
|
+
*/
|
|
94
|
+
export type ToastOptions = PlainToastOption | AccountToastOption | NetworkToastOption | AppToastOption | IconToastOption;
|
|
95
|
+
/**
|
|
96
|
+
* Toast component reference.
|
|
97
|
+
*/
|
|
98
|
+
export type ToastRef = {
|
|
99
|
+
showToast: (toastOptions: ToastOptions) => void;
|
|
100
|
+
closeToast: () => void;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Toast component props.
|
|
104
|
+
* Extends ViewProps to inherit standard React Native props such as testID and accessibilityLabel.
|
|
105
|
+
*/
|
|
106
|
+
export type ToastProps = {
|
|
107
|
+
/**
|
|
108
|
+
* Optional Tailwind CSS classes for the toast container.
|
|
109
|
+
*/
|
|
110
|
+
twClassName?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Props spread to the labels container View (e.g., testID for testing).
|
|
113
|
+
*/
|
|
114
|
+
labelsContainerProps?: Omit<ViewProps, 'children' | 'style'>;
|
|
115
|
+
} & Omit<ViewProps, 'style'>;
|
|
116
|
+
/**
|
|
117
|
+
* Toast context parameters.
|
|
118
|
+
*/
|
|
119
|
+
export type ToastContextParams = {
|
|
120
|
+
toastRef: React.RefObject<ToastRef> | undefined;
|
|
121
|
+
};
|
|
122
|
+
export {};
|
|
123
|
+
//# sourceMappingURL=Toast.types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.types.d.cts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,8BAAqB;AAG9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,8BAAoB;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,mCAAyB;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,4BAAkB;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,0BAAgB;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,gDAAsC;AAEnE;;GAEG;AACH,oBAAY,YAAY;IACtB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,EAAE,CAAC;AAEJ;;GAEG;AAC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AC;CAC9B,GAAG,iBAAiB,CAAC;AAEtB,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;CAC/B,GAAG,iBAAiB,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,SAAS,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IAChD,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,oBAAoB,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC;CAC9D,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAE7B;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;CACjD,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { ViewProps } from "react-native/index.js";
|
|
3
|
+
import type { AvatarIconSeverity } from "../../types/index.mjs";
|
|
4
|
+
import type { AvatarAccountVariant } from "../AvatarAccount/index.mjs";
|
|
5
|
+
import type { ButtonProps } from "../Button/index.mjs";
|
|
6
|
+
import type { ButtonIconProps } from "../ButtonIcon/index.mjs";
|
|
7
|
+
import type { IconName } from "../Icon/index.mjs";
|
|
8
|
+
import type { ImageOrSvgSrc } from "../temp-components/ImageOrSvg/index.mjs";
|
|
9
|
+
/**
|
|
10
|
+
* Toast variants.
|
|
11
|
+
*/
|
|
12
|
+
export declare enum ToastVariant {
|
|
13
|
+
Plain = "Plain",
|
|
14
|
+
Account = "Account",
|
|
15
|
+
Network = "Network",
|
|
16
|
+
App = "App",
|
|
17
|
+
Icon = "Icon"
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Options for the main text in the toast.
|
|
21
|
+
*/
|
|
22
|
+
export type ToastLabelOptions = {
|
|
23
|
+
label: string;
|
|
24
|
+
isBold?: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
/**
|
|
27
|
+
* Options for the description text in the toast.
|
|
28
|
+
*/
|
|
29
|
+
export type ToastDescriptionOptions = {
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Options for displaying a Link in the toast.
|
|
34
|
+
*/
|
|
35
|
+
export type ToastLinkButtonOptions = {
|
|
36
|
+
label: string;
|
|
37
|
+
onPress: () => void;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Common toast option shared between all other options.
|
|
41
|
+
*/
|
|
42
|
+
type BaseToastVariants = {
|
|
43
|
+
hasNoTimeout: boolean;
|
|
44
|
+
labelOptions: ToastLabelOptions;
|
|
45
|
+
descriptionOptions?: ToastDescriptionOptions;
|
|
46
|
+
linkButtonOptions?: ToastLinkButtonOptions;
|
|
47
|
+
closeButtonOptions?: ToastCloseButtonOptions;
|
|
48
|
+
startAccessory?: ReactElement;
|
|
49
|
+
bottomOffset?: number;
|
|
50
|
+
};
|
|
51
|
+
export type ToastCloseButtonOptions = ButtonProps | (ButtonIconProps & {
|
|
52
|
+
variant: ButtonIconVariant;
|
|
53
|
+
});
|
|
54
|
+
export declare enum ButtonIconVariant {
|
|
55
|
+
Icon = "Icon"
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Plain toast option.
|
|
59
|
+
*/
|
|
60
|
+
type PlainToastOption = {
|
|
61
|
+
variant: ToastVariant.Plain;
|
|
62
|
+
} & BaseToastVariants;
|
|
63
|
+
/**
|
|
64
|
+
* Account toast option.
|
|
65
|
+
*/
|
|
66
|
+
type AccountToastOption = {
|
|
67
|
+
variant: ToastVariant.Account;
|
|
68
|
+
accountAddress: string;
|
|
69
|
+
accountAvatarType: AvatarAccountVariant;
|
|
70
|
+
} & BaseToastVariants;
|
|
71
|
+
/**
|
|
72
|
+
* Network toast option.
|
|
73
|
+
*/
|
|
74
|
+
type NetworkToastOption = {
|
|
75
|
+
variant: ToastVariant.Network;
|
|
76
|
+
networkName?: string;
|
|
77
|
+
networkImageSource: ImageOrSvgSrc;
|
|
78
|
+
} & BaseToastVariants;
|
|
79
|
+
/**
|
|
80
|
+
* App toast option.
|
|
81
|
+
*/
|
|
82
|
+
type AppToastOption = {
|
|
83
|
+
variant: ToastVariant.App;
|
|
84
|
+
appIconSource: ImageOrSvgSrc;
|
|
85
|
+
} & BaseToastVariants;
|
|
86
|
+
type IconToastOption = {
|
|
87
|
+
variant: ToastVariant.Icon;
|
|
88
|
+
iconName: IconName;
|
|
89
|
+
severity?: AvatarIconSeverity;
|
|
90
|
+
} & BaseToastVariants;
|
|
91
|
+
/**
|
|
92
|
+
* Different toast options combined in a union type.
|
|
93
|
+
*/
|
|
94
|
+
export type ToastOptions = PlainToastOption | AccountToastOption | NetworkToastOption | AppToastOption | IconToastOption;
|
|
95
|
+
/**
|
|
96
|
+
* Toast component reference.
|
|
97
|
+
*/
|
|
98
|
+
export type ToastRef = {
|
|
99
|
+
showToast: (toastOptions: ToastOptions) => void;
|
|
100
|
+
closeToast: () => void;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Toast component props.
|
|
104
|
+
* Extends ViewProps to inherit standard React Native props such as testID and accessibilityLabel.
|
|
105
|
+
*/
|
|
106
|
+
export type ToastProps = {
|
|
107
|
+
/**
|
|
108
|
+
* Optional Tailwind CSS classes for the toast container.
|
|
109
|
+
*/
|
|
110
|
+
twClassName?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Props spread to the labels container View (e.g., testID for testing).
|
|
113
|
+
*/
|
|
114
|
+
labelsContainerProps?: Omit<ViewProps, 'children' | 'style'>;
|
|
115
|
+
} & Omit<ViewProps, 'style'>;
|
|
116
|
+
/**
|
|
117
|
+
* Toast context parameters.
|
|
118
|
+
*/
|
|
119
|
+
export type ToastContextParams = {
|
|
120
|
+
toastRef: React.RefObject<ToastRef> | undefined;
|
|
121
|
+
};
|
|
122
|
+
export {};
|
|
123
|
+
//# sourceMappingURL=Toast.types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.types.d.mts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,8BAAqB;AAG9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,8BAAoB;AACtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,mCAAyB;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,4BAAkB;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,0BAAgB;AACxC,OAAO,KAAK,EAAE,aAAa,EAAE,gDAAsC;AAEnE;;GAEG;AACH,oBAAY,YAAY;IACtB,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,EAAE,CAAC;AAEJ;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,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kB,CAAC;CAC/B,GAAG,iBAAiB,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,SAAS,EAAE,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;IAChD,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,oBAAoB,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC;CAC9D,GAAG,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAE7B;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;CACjD,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toast variants.
|
|
3
|
+
*/
|
|
4
|
+
export var ToastVariant;
|
|
5
|
+
(function (ToastVariant) {
|
|
6
|
+
ToastVariant["Plain"] = "Plain";
|
|
7
|
+
ToastVariant["Account"] = "Account";
|
|
8
|
+
ToastVariant["Network"] = "Network";
|
|
9
|
+
ToastVariant["App"] = "App";
|
|
10
|
+
ToastVariant["Icon"] = "Icon";
|
|
11
|
+
})(ToastVariant || (ToastVariant = {}));
|
|
12
|
+
export var ButtonIconVariant;
|
|
13
|
+
(function (ButtonIconVariant) {
|
|
14
|
+
ButtonIconVariant["Icon"] = "Icon";
|
|
15
|
+
})(ButtonIconVariant || (ButtonIconVariant = {}));
|
|
16
|
+
//# sourceMappingURL=Toast.types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.types.mjs","sourceRoot":"","sources":["../../../src/components/Toast/Toast.types.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,MAAM,CAAN,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,+BAAe,CAAA;IACf,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;IACnB,2BAAW,CAAA;IACX,6BAAa,CAAA;AACf,CAAC,EANW,YAAY,KAAZ,YAAY,QAMvB;AA0CD,MAAM,CAAN,IAAY,iBAEX;AAFD,WAAY,iBAAiB;IAC3B,kCAAa,CAAA;AACf,CAAC,EAFW,iBAAiB,KAAjB,iBAAiB,QAE5B","sourcesContent":["// Third party dependencies.\nimport type { ReactElement } from 'react';\nimport type { ViewProps } from 'react-native';\n\n// External Dependencies.\nimport type { AvatarIconSeverity } from '../../types';\nimport type { AvatarAccountVariant } from '../AvatarAccount';\nimport type { ButtonProps } from '../Button';\nimport type { ButtonIconProps } from '../ButtonIcon';\nimport type { IconName } from '../Icon';\nimport type { ImageOrSvgSrc } from '../temp-components/ImageOrSvg';\n\n/**\n * Toast variants.\n */\nexport enum ToastVariant {\n Plain = 'Plain',\n Account = 'Account',\n Network = 'Network',\n App = 'App',\n Icon = 'Icon',\n}\n\n/**\n * Options for the main text in the toast.\n */\nexport type ToastLabelOptions = {\n label: string;\n isBold?: boolean;\n}[];\n\n/**\n * Options for the description text in the toast.\n */\nexport type ToastDescriptionOptions = {\n description: string;\n};\n\n/**\n * Options for displaying a Link in the toast.\n */\nexport type ToastLinkButtonOptions = {\n label: string;\n onPress: () => void;\n};\n\n/**\n * Common toast option shared between all other options.\n */\ntype BaseToastVariants = {\n hasNoTimeout: boolean;\n labelOptions: ToastLabelOptions;\n descriptionOptions?: ToastDescriptionOptions;\n linkButtonOptions?: ToastLinkButtonOptions;\n closeButtonOptions?: ToastCloseButtonOptions;\n startAccessory?: ReactElement;\n bottomOffset?: number;\n};\n\nexport type ToastCloseButtonOptions =\n | ButtonProps\n | (ButtonIconProps & { variant: ButtonIconVariant });\n\nexport enum ButtonIconVariant {\n Icon = 'Icon',\n}\n\n/**\n * Plain toast option.\n */\ntype PlainToastOption = {\n variant: ToastVariant.Plain;\n} & BaseToastVariants;\n\n/**\n * Account toast option.\n */\ntype AccountToastOption = {\n variant: ToastVariant.Account;\n accountAddress: string;\n accountAvatarType: AvatarAccountVariant;\n} & BaseToastVariants;\n\n/**\n * Network toast option.\n */\ntype NetworkToastOption = {\n variant: ToastVariant.Network;\n networkName?: string;\n networkImageSource: ImageOrSvgSrc;\n} & BaseToastVariants;\n\n/**\n * App toast option.\n */\ntype AppToastOption = {\n variant: ToastVariant.App;\n appIconSource: ImageOrSvgSrc;\n} & BaseToastVariants;\n\ntype IconToastOption = {\n variant: ToastVariant.Icon;\n iconName: IconName;\n severity?: AvatarIconSeverity;\n} & BaseToastVariants;\n\n/**\n * Different toast options combined in a union type.\n */\nexport type ToastOptions =\n | PlainToastOption\n | AccountToastOption\n | NetworkToastOption\n | AppToastOption\n | IconToastOption;\n\n/**\n * Toast component reference.\n */\nexport type ToastRef = {\n showToast: (toastOptions: ToastOptions) => void;\n closeToast: () => void;\n};\n\n/**\n * Toast component props.\n * Extends ViewProps to inherit standard React Native props such as testID and accessibilityLabel.\n */\nexport type ToastProps = {\n /**\n * Optional Tailwind CSS classes for the toast container.\n */\n twClassName?: string;\n /**\n * Props spread to the labels container View (e.g., testID for testing).\n */\n labelsContainerProps?: Omit<ViewProps, 'children' | 'style'>;\n} & Omit<ViewProps, 'style'>;\n\n/**\n * Toast context parameters.\n */\nexport type ToastContextParams = {\n toastRef: React.RefObject<ToastRef> | undefined;\n};\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TOAST_BOTTOM_PADDING = exports.TOAST_ANIMATION_DURATION = exports.TOAST_VISIBILITY_DURATION = exports.ToastContextWrapper = exports.ToastContext = exports.ButtonIconVariant = exports.ToastVariant = exports.Toast = void 0;
|
|
7
|
+
var Toast_1 = require("./Toast.cjs");
|
|
8
|
+
Object.defineProperty(exports, "Toast", { enumerable: true, get: function () { return __importDefault(Toast_1).default; } });
|
|
9
|
+
var Toast_types_1 = require("./Toast.types.cjs");
|
|
10
|
+
Object.defineProperty(exports, "ToastVariant", { enumerable: true, get: function () { return Toast_types_1.ToastVariant; } });
|
|
11
|
+
Object.defineProperty(exports, "ButtonIconVariant", { enumerable: true, get: function () { return Toast_types_1.ButtonIconVariant; } });
|
|
12
|
+
var Toast_context_1 = require("./Toast.context.cjs");
|
|
13
|
+
Object.defineProperty(exports, "ToastContext", { enumerable: true, get: function () { return Toast_context_1.ToastContext; } });
|
|
14
|
+
Object.defineProperty(exports, "ToastContextWrapper", { enumerable: true, get: function () { return Toast_context_1.ToastContextWrapper; } });
|
|
15
|
+
var Toast_constants_1 = require("./Toast.constants.cjs");
|
|
16
|
+
Object.defineProperty(exports, "TOAST_VISIBILITY_DURATION", { enumerable: true, get: function () { return Toast_constants_1.TOAST_VISIBILITY_DURATION; } });
|
|
17
|
+
Object.defineProperty(exports, "TOAST_ANIMATION_DURATION", { enumerable: true, get: function () { return Toast_constants_1.TOAST_ANIMATION_DURATION; } });
|
|
18
|
+
Object.defineProperty(exports, "TOAST_BOTTOM_PADDING", { enumerable: true, get: function () { return Toast_constants_1.TOAST_BOTTOM_PADDING; } });
|
|
19
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/Toast/index.ts"],"names":[],"mappings":";;;;;;AAAA,qCAA2C;AAAlC,+GAAA,OAAO,OAAS;AACzB,iDAAgE;AAAvD,2GAAA,YAAY,OAAA;AAAE,gHAAA,iBAAiB,OAAA;AAWxC,qDAAoE;AAA3D,6GAAA,YAAY,OAAA;AAAE,oHAAA,mBAAmB,OAAA;AAC1C,yDAI2B;AAHzB,4HAAA,yBAAyB,OAAA;AACzB,2HAAA,wBAAwB,OAAA;AACxB,uHAAA,oBAAoB,OAAA","sourcesContent":["export { default as Toast } from './Toast';\nexport { ToastVariant, ButtonIconVariant } from './Toast.types';\nexport type {\n ToastOptions,\n ToastProps,\n ToastRef,\n ToastContextParams,\n ToastLabelOptions,\n ToastDescriptionOptions,\n ToastLinkButtonOptions,\n ToastCloseButtonOptions,\n} from './Toast.types';\nexport { ToastContext, ToastContextWrapper } from './Toast.context';\nexport {\n TOAST_VISIBILITY_DURATION,\n TOAST_ANIMATION_DURATION,\n TOAST_BOTTOM_PADDING,\n} from './Toast.constants';\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Toast } from "./Toast.cjs";
|
|
2
|
+
export { ToastVariant, ButtonIconVariant } from "./Toast.types.cjs";
|
|
3
|
+
export type { ToastOptions, ToastProps, ToastRef, ToastContextParams, ToastLabelOptions, ToastDescriptionOptions, ToastLinkButtonOptions, ToastCloseButtonOptions, } from "./Toast.types.cjs";
|
|
4
|
+
export { ToastContext, ToastContextWrapper } from "./Toast.context.cjs";
|
|
5
|
+
export { TOAST_VISIBILITY_DURATION, TOAST_ANIMATION_DURATION, TOAST_BOTTOM_PADDING, } from "./Toast.constants.cjs";
|
|
6
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,oBAAgB;AAC3C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,0BAAsB;AAChE,YAAY,EACV,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,GACxB,0BAAsB;AACvB,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,4BAAwB;AACpE,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,GACrB,8BAA0B"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as Toast } from "./Toast.mjs";
|
|
2
|
+
export { ToastVariant, ButtonIconVariant } from "./Toast.types.mjs";
|
|
3
|
+
export type { ToastOptions, ToastProps, ToastRef, ToastContextParams, ToastLabelOptions, ToastDescriptionOptions, ToastLinkButtonOptions, ToastCloseButtonOptions, } from "./Toast.types.mjs";
|
|
4
|
+
export { ToastContext, ToastContextWrapper } from "./Toast.context.mjs";
|
|
5
|
+
export { TOAST_VISIBILITY_DURATION, TOAST_ANIMATION_DURATION, TOAST_BOTTOM_PADDING, } from "./Toast.constants.mjs";
|
|
6
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/Toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,oBAAgB;AAC3C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,0BAAsB;AAChE,YAAY,EACV,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,GACxB,0BAAsB;AACvB,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,4BAAwB;AACpE,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,GACrB,8BAA0B"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Toast } from "./Toast.mjs";
|
|
2
|
+
export { ToastVariant, ButtonIconVariant } from "./Toast.types.mjs";
|
|
3
|
+
export { ToastContext, ToastContextWrapper } from "./Toast.context.mjs";
|
|
4
|
+
export { TOAST_VISIBILITY_DURATION, TOAST_ANIMATION_DURATION, TOAST_BOTTOM_PADDING } from "./Toast.constants.mjs";
|
|
5
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/Toast/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,oBAAgB;AAC3C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,0BAAsB;AAWhE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,4BAAwB;AACpE,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,oBAAoB,EACrB,8BAA0B","sourcesContent":["export { default as Toast } from './Toast';\nexport { ToastVariant, ButtonIconVariant } from './Toast.types';\nexport type {\n ToastOptions,\n ToastProps,\n ToastRef,\n ToastContextParams,\n ToastLabelOptions,\n ToastDescriptionOptions,\n ToastLinkButtonOptions,\n ToastCloseButtonOptions,\n} from './Toast.types';\nexport { ToastContext, ToastContextWrapper } from './Toast.context';\nexport {\n TOAST_VISIBILITY_DURATION,\n TOAST_ANIMATION_DURATION,\n TOAST_BOTTOM_PADDING,\n} from './Toast.constants';\n"]}
|