@metamask-previews/design-system-react-native 0.24.0-preview.178e60f → 0.26.0-preview.047f96c
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 +30 -1
- package/dist/components/ActionListItem/ActionListItem.cjs +1 -1
- package/dist/components/ActionListItem/ActionListItem.cjs.map +1 -1
- package/dist/components/ActionListItem/ActionListItem.mjs +1 -1
- package/dist/components/ActionListItem/ActionListItem.mjs.map +1 -1
- package/dist/components/ActionListItem/ActionListItem.types.d.cts +1 -1
- package/dist/components/ActionListItem/ActionListItem.types.d.cts.map +1 -1
- package/dist/components/ActionListItem/ActionListItem.types.d.mts +1 -1
- package/dist/components/ActionListItem/ActionListItem.types.d.mts.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.cjs +1 -1
- package/dist/components/AvatarBase/AvatarBase.cjs.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.mjs +1 -1
- package/dist/components/AvatarBase/AvatarBase.mjs.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.types.d.cts +1 -1
- package/dist/components/AvatarBase/AvatarBase.types.d.cts.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.types.d.mts +1 -1
- package/dist/components/AvatarBase/AvatarBase.types.d.mts.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.cjs +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.cjs.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.mjs +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.mjs.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.types.d.cts +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.types.d.cts.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.types.d.mts +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.types.d.mts.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.cjs +1 -1
- package/dist/components/BadgeCount/BadgeCount.cjs.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.mjs +1 -1
- package/dist/components/BadgeCount/BadgeCount.mjs.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.types.d.cts +1 -1
- package/dist/components/BadgeCount/BadgeCount.types.d.cts.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.types.d.mts +1 -1
- package/dist/components/BadgeCount/BadgeCount.types.d.mts.map +1 -1
- package/dist/components/BadgeIcon/BadgeIcon.cjs +1 -1
- package/dist/components/BadgeIcon/BadgeIcon.cjs.map +1 -1
- package/dist/components/BadgeIcon/BadgeIcon.mjs +1 -1
- package/dist/components/BadgeIcon/BadgeIcon.mjs.map +1 -1
- package/dist/components/BadgeIcon/BadgeIcon.types.d.cts +1 -1
- package/dist/components/BadgeIcon/BadgeIcon.types.d.cts.map +1 -1
- package/dist/components/BadgeIcon/BadgeIcon.types.d.mts +1 -1
- package/dist/components/BadgeIcon/BadgeIcon.types.d.mts.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.cjs +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.cjs.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.mjs +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.mjs.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.types.d.cts +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.types.d.cts.map +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.types.d.mts +1 -1
- package/dist/components/BadgeStatus/BadgeStatus.types.d.mts.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.cjs +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.cjs.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.mjs +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.mjs.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.types.d.cts +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.types.d.cts.map +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.types.d.mts +1 -1
- package/dist/components/BadgeWrapper/BadgeWrapper.types.d.mts.map +1 -1
- package/dist/components/BannerBase/BannerBase.types.d.cts +1 -1
- package/dist/components/BannerBase/BannerBase.types.d.cts.map +1 -1
- package/dist/components/BannerBase/BannerBase.types.d.mts +1 -1
- package/dist/components/BannerBase/BannerBase.types.d.mts.map +1 -1
- package/dist/components/BottomSheet/BottomSheet.cjs +6 -6
- package/dist/components/BottomSheet/BottomSheet.cjs.map +1 -1
- package/dist/components/BottomSheet/BottomSheet.d.cts +0 -35
- package/dist/components/BottomSheet/BottomSheet.d.cts.map +1 -1
- package/dist/components/BottomSheet/BottomSheet.d.mts +0 -35
- package/dist/components/BottomSheet/BottomSheet.d.mts.map +1 -1
- package/dist/components/BottomSheet/BottomSheet.mjs +6 -6
- package/dist/components/BottomSheet/BottomSheet.mjs.map +1 -1
- package/dist/components/BottomSheetDialog/BottomSheetDialog.cjs +28 -17
- package/dist/components/BottomSheetDialog/BottomSheetDialog.cjs.map +1 -1
- package/dist/components/BottomSheetDialog/BottomSheetDialog.d.cts +0 -35
- package/dist/components/BottomSheetDialog/BottomSheetDialog.d.cts.map +1 -1
- package/dist/components/BottomSheetDialog/BottomSheetDialog.d.mts +0 -35
- package/dist/components/BottomSheetDialog/BottomSheetDialog.d.mts.map +1 -1
- package/dist/components/BottomSheetDialog/BottomSheetDialog.mjs +30 -19
- package/dist/components/BottomSheetDialog/BottomSheetDialog.mjs.map +1 -1
- package/dist/components/BottomSheetDialog/BottomSheetDialog.types.cjs.map +1 -1
- package/dist/components/BottomSheetDialog/BottomSheetDialog.types.d.cts +1 -9
- package/dist/components/BottomSheetDialog/BottomSheetDialog.types.d.cts.map +1 -1
- package/dist/components/BottomSheetDialog/BottomSheetDialog.types.d.mts +1 -9
- package/dist/components/BottomSheetDialog/BottomSheetDialog.types.d.mts.map +1 -1
- package/dist/components/BottomSheetDialog/BottomSheetDialog.types.mjs.map +1 -1
- package/dist/components/BottomSheetFooter/BottomSheetFooter.cjs +1 -1
- package/dist/components/BottomSheetFooter/BottomSheetFooter.cjs.map +1 -1
- package/dist/components/BottomSheetFooter/BottomSheetFooter.mjs +1 -1
- package/dist/components/BottomSheetFooter/BottomSheetFooter.mjs.map +1 -1
- package/dist/components/BottomSheetFooter/BottomSheetFooter.types.d.cts +1 -1
- package/dist/components/BottomSheetFooter/BottomSheetFooter.types.d.cts.map +1 -1
- package/dist/components/BottomSheetFooter/BottomSheetFooter.types.d.mts +1 -1
- package/dist/components/BottomSheetFooter/BottomSheetFooter.types.d.mts.map +1 -1
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.cjs +1 -1
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.cjs.map +1 -1
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.mjs +1 -1
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.mjs.map +1 -1
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.d.cts +1 -1
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.d.cts.map +1 -1
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.d.mts +1 -1
- package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.d.mts.map +1 -1
- package/dist/components/Box/Box.cjs +1 -1
- package/dist/components/Box/Box.cjs.map +1 -1
- package/dist/components/Box/Box.d.cts +1 -1
- package/dist/components/Box/Box.d.cts.map +1 -1
- package/dist/components/Box/Box.d.mts +1 -1
- package/dist/components/Box/Box.d.mts.map +1 -1
- package/dist/components/Box/Box.mjs +1 -1
- package/dist/components/Box/Box.mjs.map +1 -1
- package/dist/components/Box/Box.types.d.cts +1 -1
- package/dist/components/Box/Box.types.d.cts.map +1 -1
- package/dist/components/Box/Box.types.d.mts +1 -1
- package/dist/components/Box/Box.types.d.mts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.types.d.cts +1 -2
- package/dist/components/ButtonBase/ButtonBase.types.d.cts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.types.d.mts +1 -2
- package/dist/components/ButtonBase/ButtonBase.types.d.mts.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.types.d.cts +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.types.d.cts.map +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.types.d.mts +1 -1
- package/dist/components/ButtonIcon/ButtonIcon.types.d.mts.map +1 -1
- package/dist/components/Card/Card.cjs +2 -2
- package/dist/components/Card/Card.cjs.map +1 -1
- package/dist/components/Card/Card.mjs +2 -2
- package/dist/components/Card/Card.mjs.map +1 -1
- package/dist/components/Card/Card.types.cjs.map +1 -1
- package/dist/components/Card/Card.types.d.cts +2 -2
- package/dist/components/Card/Card.types.d.cts.map +1 -1
- package/dist/components/Card/Card.types.d.mts +2 -2
- package/dist/components/Card/Card.types.d.mts.map +1 -1
- package/dist/components/Card/Card.types.mjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.cjs +1 -1
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.cts +1 -1
- package/dist/components/Checkbox/Checkbox.d.cts.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.mts +1 -1
- package/dist/components/Checkbox/Checkbox.d.mts.map +1 -1
- package/dist/components/Checkbox/Checkbox.mjs +1 -1
- package/dist/components/Checkbox/Checkbox.mjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.types.d.cts +1 -1
- package/dist/components/Checkbox/Checkbox.types.d.cts.map +1 -1
- package/dist/components/Checkbox/Checkbox.types.d.mts +1 -1
- package/dist/components/Checkbox/Checkbox.types.d.mts.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.cjs +1 -1
- package/dist/components/HeaderBase/HeaderBase.cjs.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.mjs +1 -1
- package/dist/components/HeaderBase/HeaderBase.mjs.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.types.d.cts +1 -1
- package/dist/components/HeaderBase/HeaderBase.types.d.cts.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.types.d.mts +1 -1
- package/dist/components/HeaderBase/HeaderBase.types.d.mts.map +1 -1
- package/dist/components/HeaderRoot/HeaderRoot.types.d.cts +1 -1
- package/dist/components/HeaderRoot/HeaderRoot.types.d.cts.map +1 -1
- package/dist/components/HeaderRoot/HeaderRoot.types.d.mts +1 -1
- package/dist/components/HeaderRoot/HeaderRoot.types.d.mts.map +1 -1
- package/dist/components/Icon/assets/telegram.svg +1 -3
- package/dist/components/Input/Input.cjs +1 -1
- package/dist/components/Input/Input.cjs.map +1 -1
- package/dist/components/Input/Input.d.cts +1 -2
- package/dist/components/Input/Input.d.cts.map +1 -1
- package/dist/components/Input/Input.d.mts +1 -2
- package/dist/components/Input/Input.d.mts.map +1 -1
- package/dist/components/Input/Input.mjs +1 -1
- package/dist/components/Input/Input.mjs.map +1 -1
- package/dist/components/Input/Input.types.d.cts +1 -1
- package/dist/components/Input/Input.types.d.cts.map +1 -1
- package/dist/components/Input/Input.types.d.mts +1 -1
- package/dist/components/Input/Input.types.d.mts.map +1 -1
- package/dist/components/KeyValueColumn/KeyValueColumn.types.d.cts +1 -1
- package/dist/components/KeyValueColumn/KeyValueColumn.types.d.cts.map +1 -1
- package/dist/components/KeyValueColumn/KeyValueColumn.types.d.mts +1 -1
- package/dist/components/KeyValueColumn/KeyValueColumn.types.d.mts.map +1 -1
- package/dist/components/KeyValueRow/KeyValueRow.types.d.cts +1 -1
- package/dist/components/KeyValueRow/KeyValueRow.types.d.cts.map +1 -1
- package/dist/components/KeyValueRow/KeyValueRow.types.d.mts +1 -1
- package/dist/components/KeyValueRow/KeyValueRow.types.d.mts.map +1 -1
- package/dist/components/ListItem/ListItem.cjs +1 -1
- package/dist/components/ListItem/ListItem.cjs.map +1 -1
- package/dist/components/ListItem/ListItem.mjs +1 -1
- package/dist/components/ListItem/ListItem.mjs.map +1 -1
- package/dist/components/ListItem/ListItem.types.d.cts +1 -1
- package/dist/components/ListItem/ListItem.types.d.cts.map +1 -1
- package/dist/components/ListItem/ListItem.types.d.mts +1 -1
- package/dist/components/ListItem/ListItem.types.d.mts.map +1 -1
- package/dist/components/MainActionButton/MainActionButton.types.d.cts +1 -1
- package/dist/components/MainActionButton/MainActionButton.types.d.cts.map +1 -1
- package/dist/components/MainActionButton/MainActionButton.types.d.mts +1 -1
- package/dist/components/MainActionButton/MainActionButton.types.d.mts.map +1 -1
- package/dist/components/RadioButton/RadioButton.cjs +1 -1
- package/dist/components/RadioButton/RadioButton.cjs.map +1 -1
- package/dist/components/RadioButton/RadioButton.mjs +1 -1
- package/dist/components/RadioButton/RadioButton.mjs.map +1 -1
- package/dist/components/RadioButton/RadioButton.types.d.cts +1 -2
- package/dist/components/RadioButton/RadioButton.types.d.cts.map +1 -1
- package/dist/components/RadioButton/RadioButton.types.d.mts +1 -2
- package/dist/components/RadioButton/RadioButton.types.d.mts.map +1 -1
- package/dist/components/SectionDivider/SectionDivider.cjs +47 -0
- package/dist/components/SectionDivider/SectionDivider.cjs.map +1 -0
- package/dist/components/SectionDivider/SectionDivider.d.cts +6 -0
- package/dist/components/SectionDivider/SectionDivider.d.cts.map +1 -0
- package/dist/components/SectionDivider/SectionDivider.d.mts +6 -0
- package/dist/components/SectionDivider/SectionDivider.d.mts.map +1 -0
- package/dist/components/SectionDivider/SectionDivider.mjs +28 -0
- package/dist/components/SectionDivider/SectionDivider.mjs.map +1 -0
- package/dist/components/SectionDivider/SectionDivider.types.cjs +3 -0
- package/dist/components/SectionDivider/SectionDivider.types.cjs.map +1 -0
- package/dist/components/SectionDivider/SectionDivider.types.d.cts +3 -0
- package/dist/components/SectionDivider/SectionDivider.types.d.cts.map +1 -0
- package/dist/components/SectionDivider/SectionDivider.types.d.mts +3 -0
- package/dist/components/SectionDivider/SectionDivider.types.d.mts.map +1 -0
- package/dist/components/SectionDivider/SectionDivider.types.mjs +2 -0
- package/dist/components/SectionDivider/SectionDivider.types.mjs.map +1 -0
- package/dist/components/SectionDivider/index.cjs +6 -0
- package/dist/components/SectionDivider/index.cjs.map +1 -0
- package/dist/components/SectionDivider/index.d.cts +3 -0
- package/dist/components/SectionDivider/index.d.cts.map +1 -0
- package/dist/components/SectionDivider/index.d.mts +3 -0
- package/dist/components/SectionDivider/index.d.mts.map +1 -0
- package/dist/components/SectionDivider/index.mjs +2 -0
- package/dist/components/SectionDivider/index.mjs.map +1 -0
- package/dist/components/SectionHeader/SectionHeader.cjs +45 -0
- package/dist/components/SectionHeader/SectionHeader.cjs.map +1 -0
- package/dist/components/SectionHeader/SectionHeader.d.cts +23 -0
- package/dist/components/SectionHeader/SectionHeader.d.cts.map +1 -0
- package/dist/components/SectionHeader/SectionHeader.d.mts +23 -0
- package/dist/components/SectionHeader/SectionHeader.d.mts.map +1 -0
- package/dist/components/SectionHeader/SectionHeader.mjs +45 -0
- package/dist/components/SectionHeader/SectionHeader.mjs.map +1 -0
- package/dist/components/SectionHeader/SectionHeader.types.cjs +3 -0
- package/dist/components/SectionHeader/SectionHeader.types.cjs.map +1 -0
- package/dist/components/SectionHeader/SectionHeader.types.d.cts +32 -0
- package/dist/components/SectionHeader/SectionHeader.types.d.cts.map +1 -0
- package/dist/components/SectionHeader/SectionHeader.types.d.mts +32 -0
- package/dist/components/SectionHeader/SectionHeader.types.d.mts.map +1 -0
- package/dist/components/SectionHeader/SectionHeader.types.mjs +2 -0
- package/dist/components/SectionHeader/SectionHeader.types.mjs.map +1 -0
- package/dist/components/SectionHeader/index.cjs +6 -0
- package/dist/components/SectionHeader/index.cjs.map +1 -0
- package/dist/components/SectionHeader/index.d.cts +3 -0
- package/dist/components/SectionHeader/index.d.cts.map +1 -0
- package/dist/components/SectionHeader/index.d.mts +3 -0
- package/dist/components/SectionHeader/index.d.mts.map +1 -0
- package/dist/components/SectionHeader/index.mjs +2 -0
- package/dist/components/SectionHeader/index.mjs.map +1 -0
- package/dist/components/SegmentButton/SegmentButton.cjs +86 -0
- package/dist/components/SegmentButton/SegmentButton.cjs.map +1 -0
- package/dist/components/SegmentButton/SegmentButton.d.cts +7 -0
- package/dist/components/SegmentButton/SegmentButton.d.cts.map +1 -0
- package/dist/components/SegmentButton/SegmentButton.d.mts +7 -0
- package/dist/components/SegmentButton/SegmentButton.d.mts.map +1 -0
- package/dist/components/SegmentButton/SegmentButton.mjs +66 -0
- package/dist/components/SegmentButton/SegmentButton.mjs.map +1 -0
- package/dist/components/SegmentButton/SegmentButton.types.cjs +3 -0
- package/dist/components/SegmentButton/SegmentButton.types.cjs.map +1 -0
- package/dist/components/SegmentButton/SegmentButton.types.d.cts +9 -0
- package/dist/components/SegmentButton/SegmentButton.types.d.cts.map +1 -0
- package/dist/components/SegmentButton/SegmentButton.types.d.mts +9 -0
- package/dist/components/SegmentButton/SegmentButton.types.d.mts.map +1 -0
- package/dist/components/SegmentButton/SegmentButton.types.mjs +2 -0
- package/dist/components/SegmentButton/SegmentButton.types.mjs.map +1 -0
- package/dist/components/SegmentButton/index.cjs +8 -0
- package/dist/components/SegmentButton/index.cjs.map +1 -0
- package/dist/components/SegmentButton/index.d.cts +4 -0
- package/dist/components/SegmentButton/index.d.cts.map +1 -0
- package/dist/components/SegmentButton/index.d.mts +4 -0
- package/dist/components/SegmentButton/index.d.mts.map +1 -0
- package/dist/components/SegmentButton/index.mjs +3 -0
- package/dist/components/SegmentButton/index.mjs.map +1 -0
- package/dist/components/SegmentGroup/SegmentGroup.cjs +47 -0
- package/dist/components/SegmentGroup/SegmentGroup.cjs.map +1 -0
- package/dist/components/SegmentGroup/SegmentGroup.d.cts +7 -0
- package/dist/components/SegmentGroup/SegmentGroup.d.cts.map +1 -0
- package/dist/components/SegmentGroup/SegmentGroup.d.mts +7 -0
- package/dist/components/SegmentGroup/SegmentGroup.d.mts.map +1 -0
- package/dist/components/SegmentGroup/SegmentGroup.mjs +27 -0
- package/dist/components/SegmentGroup/SegmentGroup.mjs.map +1 -0
- package/dist/components/SegmentGroup/SegmentGroup.types.cjs +3 -0
- package/dist/components/SegmentGroup/SegmentGroup.types.cjs.map +1 -0
- package/dist/components/SegmentGroup/SegmentGroup.types.d.cts +12 -0
- package/dist/components/SegmentGroup/SegmentGroup.types.d.cts.map +1 -0
- package/dist/components/SegmentGroup/SegmentGroup.types.d.mts +12 -0
- package/dist/components/SegmentGroup/SegmentGroup.types.d.mts.map +1 -0
- package/dist/components/SegmentGroup/SegmentGroup.types.mjs +2 -0
- package/dist/components/SegmentGroup/SegmentGroup.types.mjs.map +1 -0
- package/dist/components/SegmentGroup/index.cjs +6 -0
- package/dist/components/SegmentGroup/index.cjs.map +1 -0
- package/dist/components/SegmentGroup/index.d.cts +3 -0
- package/dist/components/SegmentGroup/index.d.cts.map +1 -0
- package/dist/components/SegmentGroup/index.d.mts +3 -0
- package/dist/components/SegmentGroup/index.d.mts.map +1 -0
- package/dist/components/SegmentGroup/index.mjs +2 -0
- package/dist/components/SegmentGroup/index.mjs.map +1 -0
- package/dist/components/SelectButton/SelectButton.cjs +53 -0
- package/dist/components/SelectButton/SelectButton.cjs.map +1 -0
- package/dist/components/SelectButton/SelectButton.constants.cjs +12 -0
- package/dist/components/SelectButton/SelectButton.constants.cjs.map +1 -0
- package/dist/components/SelectButton/SelectButton.constants.d.cts +4 -0
- package/dist/components/SelectButton/SelectButton.constants.d.cts.map +1 -0
- package/dist/components/SelectButton/SelectButton.constants.d.mts +4 -0
- package/dist/components/SelectButton/SelectButton.constants.d.mts.map +1 -0
- package/dist/components/SelectButton/SelectButton.constants.mjs +9 -0
- package/dist/components/SelectButton/SelectButton.constants.mjs.map +1 -0
- package/dist/components/SelectButton/SelectButton.d.cts +7 -0
- package/dist/components/SelectButton/SelectButton.d.cts.map +1 -0
- package/dist/components/SelectButton/SelectButton.d.mts +7 -0
- package/dist/components/SelectButton/SelectButton.d.mts.map +1 -0
- package/dist/components/SelectButton/SelectButton.mjs +53 -0
- package/dist/components/SelectButton/SelectButton.mjs.map +1 -0
- package/dist/components/SelectButton/SelectButton.types.cjs +3 -0
- package/dist/components/SelectButton/SelectButton.types.cjs.map +1 -0
- package/dist/components/SelectButton/SelectButton.types.d.cts +13 -0
- package/dist/components/SelectButton/SelectButton.types.d.cts.map +1 -0
- package/dist/components/SelectButton/SelectButton.types.d.mts +13 -0
- package/dist/components/SelectButton/SelectButton.types.d.mts.map +1 -0
- package/dist/components/SelectButton/SelectButton.types.mjs +2 -0
- package/dist/components/SelectButton/SelectButton.types.mjs.map +1 -0
- package/dist/components/SelectButton/index.cjs +10 -0
- package/dist/components/SelectButton/index.cjs.map +1 -0
- package/dist/components/SelectButton/index.d.cts +4 -0
- package/dist/components/SelectButton/index.d.cts.map +1 -0
- package/dist/components/SelectButton/index.d.mts +4 -0
- package/dist/components/SelectButton/index.d.mts.map +1 -0
- package/dist/components/SelectButton/index.mjs +3 -0
- package/dist/components/SelectButton/index.mjs.map +1 -0
- package/dist/components/SensitiveText/SensitiveText.cjs +4 -4
- package/dist/components/SensitiveText/SensitiveText.cjs.map +1 -1
- package/dist/components/SensitiveText/SensitiveText.d.cts.map +1 -1
- package/dist/components/SensitiveText/SensitiveText.d.mts.map +1 -1
- package/dist/components/SensitiveText/SensitiveText.mjs +1 -1
- package/dist/components/SensitiveText/SensitiveText.mjs.map +1 -1
- package/dist/components/SensitiveText/SensitiveText.types.cjs.map +1 -1
- package/dist/components/SensitiveText/SensitiveText.types.d.cts +6 -34
- package/dist/components/SensitiveText/SensitiveText.types.d.cts.map +1 -1
- package/dist/components/SensitiveText/SensitiveText.types.d.mts +6 -34
- package/dist/components/SensitiveText/SensitiveText.types.d.mts.map +1 -1
- package/dist/components/SensitiveText/SensitiveText.types.mjs.map +1 -1
- package/dist/components/SensitiveText/index.cjs +3 -3
- package/dist/components/SensitiveText/index.cjs.map +1 -1
- package/dist/components/SensitiveText/index.d.cts +1 -1
- package/dist/components/SensitiveText/index.d.cts.map +1 -1
- package/dist/components/SensitiveText/index.d.mts +1 -1
- package/dist/components/SensitiveText/index.d.mts.map +1 -1
- package/dist/components/SensitiveText/index.mjs +1 -1
- package/dist/components/SensitiveText/index.mjs.map +1 -1
- package/dist/components/Skeleton/Skeleton.cjs +1 -1
- package/dist/components/Skeleton/Skeleton.cjs.map +1 -1
- package/dist/components/Skeleton/Skeleton.mjs +1 -1
- package/dist/components/Skeleton/Skeleton.mjs.map +1 -1
- package/dist/components/Skeleton/Skeleton.types.d.cts +1 -1
- package/dist/components/Skeleton/Skeleton.types.d.cts.map +1 -1
- package/dist/components/Skeleton/Skeleton.types.d.mts +1 -1
- package/dist/components/Skeleton/Skeleton.types.d.mts.map +1 -1
- package/dist/components/TabEmptyState/TabEmptyState.types.d.cts +1 -1
- package/dist/components/TabEmptyState/TabEmptyState.types.d.cts.map +1 -1
- package/dist/components/TabEmptyState/TabEmptyState.types.d.mts +1 -1
- package/dist/components/TabEmptyState/TabEmptyState.types.d.mts.map +1 -1
- package/dist/components/Tag/Tag.types.d.cts +1 -1
- package/dist/components/Tag/Tag.types.d.cts.map +1 -1
- package/dist/components/Tag/Tag.types.d.mts +1 -1
- package/dist/components/Tag/Tag.types.d.mts.map +1 -1
- package/dist/components/Text/Text.cjs +1 -1
- package/dist/components/Text/Text.cjs.map +1 -1
- package/dist/components/Text/Text.mjs +1 -1
- package/dist/components/Text/Text.mjs.map +1 -1
- package/dist/components/Text/Text.types.d.cts +1 -1
- package/dist/components/Text/Text.types.d.cts.map +1 -1
- package/dist/components/Text/Text.types.d.mts +1 -1
- package/dist/components/Text/Text.types.d.mts.map +1 -1
- package/dist/components/TextArea/TextArea.cjs +1 -1
- package/dist/components/TextArea/TextArea.cjs.map +1 -1
- package/dist/components/TextArea/TextArea.d.cts +20 -16
- package/dist/components/TextArea/TextArea.d.cts.map +1 -1
- package/dist/components/TextArea/TextArea.d.mts +20 -16
- package/dist/components/TextArea/TextArea.d.mts.map +1 -1
- package/dist/components/TextArea/TextArea.mjs +1 -1
- package/dist/components/TextArea/TextArea.mjs.map +1 -1
- package/dist/components/TextArea/TextArea.types.d.cts +1 -1
- package/dist/components/TextArea/TextArea.types.d.cts.map +1 -1
- package/dist/components/TextArea/TextArea.types.d.mts +1 -1
- package/dist/components/TextArea/TextArea.types.d.mts.map +1 -1
- package/dist/components/TextButton/TextButton.types.d.cts +0 -1
- package/dist/components/TextButton/TextButton.types.d.cts.map +1 -1
- package/dist/components/TextButton/TextButton.types.d.mts +0 -1
- package/dist/components/TextButton/TextButton.types.d.mts.map +1 -1
- package/dist/components/TextField/TextField.cjs +1 -1
- package/dist/components/TextField/TextField.cjs.map +1 -1
- package/dist/components/TextField/TextField.d.cts +20 -16
- package/dist/components/TextField/TextField.d.cts.map +1 -1
- package/dist/components/TextField/TextField.d.mts +20 -16
- package/dist/components/TextField/TextField.d.mts.map +1 -1
- package/dist/components/TextField/TextField.mjs +1 -1
- package/dist/components/TextField/TextField.mjs.map +1 -1
- package/dist/components/TextField/TextField.types.d.cts +1 -1
- package/dist/components/TextField/TextField.types.d.cts.map +1 -1
- package/dist/components/TextField/TextField.types.d.mts +1 -1
- package/dist/components/TextField/TextField.types.d.mts.map +1 -1
- package/dist/components/TextFieldSearch/TextFieldSearch.d.cts +20 -15
- package/dist/components/TextFieldSearch/TextFieldSearch.d.cts.map +1 -1
- package/dist/components/TextFieldSearch/TextFieldSearch.d.mts +20 -15
- package/dist/components/TextFieldSearch/TextFieldSearch.d.mts.map +1 -1
- package/dist/components/TitleAlert/TitleAlert.cjs +54 -0
- package/dist/components/TitleAlert/TitleAlert.cjs.map +1 -0
- package/dist/components/TitleAlert/TitleAlert.d.cts +21 -0
- package/dist/components/TitleAlert/TitleAlert.d.cts.map +1 -0
- package/dist/components/TitleAlert/TitleAlert.d.mts +21 -0
- package/dist/components/TitleAlert/TitleAlert.d.mts.map +1 -0
- package/dist/components/TitleAlert/TitleAlert.mjs +54 -0
- package/dist/components/TitleAlert/TitleAlert.mjs.map +1 -0
- package/dist/components/TitleAlert/TitleAlert.types.cjs +3 -0
- package/dist/components/TitleAlert/TitleAlert.types.cjs.map +1 -0
- package/dist/components/TitleAlert/TitleAlert.types.d.cts +31 -0
- package/dist/components/TitleAlert/TitleAlert.types.d.cts.map +1 -0
- package/dist/components/TitleAlert/TitleAlert.types.d.mts +31 -0
- package/dist/components/TitleAlert/TitleAlert.types.d.mts.map +1 -0
- package/dist/components/TitleAlert/TitleAlert.types.mjs +2 -0
- package/dist/components/TitleAlert/TitleAlert.types.mjs.map +1 -0
- package/dist/components/TitleAlert/index.cjs +6 -0
- package/dist/components/TitleAlert/index.cjs.map +1 -0
- package/dist/components/TitleAlert/index.d.cts +3 -0
- package/dist/components/TitleAlert/index.d.cts.map +1 -0
- package/dist/components/TitleAlert/index.d.mts +3 -0
- package/dist/components/TitleAlert/index.d.mts.map +1 -0
- package/dist/components/TitleAlert/index.mjs +2 -0
- package/dist/components/TitleAlert/index.mjs.map +1 -0
- package/dist/components/TitleHub/TitleHub.types.d.cts +1 -1
- package/dist/components/TitleHub/TitleHub.types.d.cts.map +1 -1
- package/dist/components/TitleHub/TitleHub.types.d.mts +1 -1
- package/dist/components/TitleHub/TitleHub.types.d.mts.map +1 -1
- package/dist/components/TitleStandard/TitleStandard.types.d.cts +1 -1
- package/dist/components/TitleStandard/TitleStandard.types.d.cts.map +1 -1
- package/dist/components/TitleStandard/TitleStandard.types.d.mts +1 -1
- package/dist/components/TitleStandard/TitleStandard.types.d.mts.map +1 -1
- package/dist/components/TitleSubpage/TitleSubpage.types.d.cts +1 -1
- package/dist/components/TitleSubpage/TitleSubpage.types.d.cts.map +1 -1
- package/dist/components/TitleSubpage/TitleSubpage.types.d.mts +1 -1
- package/dist/components/TitleSubpage/TitleSubpage.types.d.mts.map +1 -1
- package/dist/components/Toast/Toast.types.d.cts +1 -1
- package/dist/components/Toast/Toast.types.d.cts.map +1 -1
- package/dist/components/Toast/Toast.types.d.mts +1 -1
- package/dist/components/Toast/Toast.types.d.mts.map +1 -1
- package/dist/components/Toast/Toaster.cjs +1 -1
- package/dist/components/Toast/Toaster.cjs.map +1 -1
- package/dist/components/Toast/Toaster.mjs +1 -1
- package/dist/components/Toast/Toaster.mjs.map +1 -1
- package/dist/components/index.cjs +18 -2
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +12 -0
- package/dist/components/index.d.cts.map +1 -1
- package/dist/components/index.d.mts +12 -0
- package/dist/components/index.d.mts.map +1 -1
- package/dist/components/index.mjs +6 -0
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/temp-components/Blockies/Blockies.cjs +1 -1
- package/dist/components/temp-components/Blockies/Blockies.cjs.map +1 -1
- package/dist/components/temp-components/Blockies/Blockies.mjs +1 -1
- package/dist/components/temp-components/Blockies/Blockies.mjs.map +1 -1
- package/dist/components/temp-components/Blockies/Blockies.types.d.cts +1 -1
- package/dist/components/temp-components/Blockies/Blockies.types.d.cts.map +1 -1
- package/dist/components/temp-components/Blockies/Blockies.types.d.mts +1 -1
- package/dist/components/temp-components/Blockies/Blockies.types.d.mts.map +1 -1
- package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.cjs +1 -1
- package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.cjs.map +1 -1
- package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.mjs +1 -1
- package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.mjs.map +1 -1
- package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.types.d.cts +1 -1
- package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.types.d.cts.map +1 -1
- package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.types.d.mts +1 -1
- package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.types.d.mts.map +1 -1
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.cjs +1 -1
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.cjs.map +1 -1
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.mjs +1 -1
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.mjs.map +1 -1
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.d.cts +1 -2
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.d.cts.map +1 -1
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.d.mts +1 -2
- package/dist/components/temp-components/ImageOrSvg/ImageOrSvg.types.d.mts.map +1 -1
- package/dist/components/temp-components/Jazzicon/Jazzicon.cjs +1 -1
- package/dist/components/temp-components/Jazzicon/Jazzicon.cjs.map +1 -1
- package/dist/components/temp-components/Jazzicon/Jazzicon.mjs +1 -1
- package/dist/components/temp-components/Jazzicon/Jazzicon.mjs.map +1 -1
- package/dist/components/temp-components/Maskicon/Maskicon.cjs +1 -1
- package/dist/components/temp-components/Maskicon/Maskicon.cjs.map +1 -1
- package/dist/components/temp-components/Maskicon/Maskicon.mjs +1 -1
- package/dist/components/temp-components/Maskicon/Maskicon.mjs.map +1 -1
- package/dist/components/temp-components/Spinner/Spinner.cjs +1 -1
- package/dist/components/temp-components/Spinner/Spinner.cjs.map +1 -1
- package/dist/components/temp-components/Spinner/Spinner.mjs +1 -1
- package/dist/components/temp-components/Spinner/Spinner.mjs.map +1 -1
- package/dist/components/temp-components/Spinner/Spinner.types.d.cts +1 -1
- package/dist/components/temp-components/Spinner/Spinner.types.d.cts.map +1 -1
- package/dist/components/temp-components/Spinner/Spinner.types.d.mts +1 -1
- package/dist/components/temp-components/Spinner/Spinner.types.d.mts.map +1 -1
- package/dist/test-utils/createRenderer.cjs +41 -0
- package/dist/test-utils/createRenderer.cjs.map +1 -0
- package/dist/test-utils/createRenderer.d.cts +4 -0
- package/dist/test-utils/createRenderer.d.cts.map +1 -0
- package/dist/test-utils/createRenderer.d.mts +4 -0
- package/dist/test-utils/createRenderer.d.mts.map +1 -0
- package/dist/test-utils/createRenderer.mjs +18 -0
- package/dist/test-utils/createRenderer.mjs.map +1 -0
- package/package.json +19 -20
- package/dist/components/SensitiveText/SensitiveText.constants.cjs +0 -14
- package/dist/components/SensitiveText/SensitiveText.constants.cjs.map +0 -1
- package/dist/components/SensitiveText/SensitiveText.constants.d.cts +0 -11
- package/dist/components/SensitiveText/SensitiveText.constants.d.cts.map +0 -1
- package/dist/components/SensitiveText/SensitiveText.constants.d.mts +0 -11
- package/dist/components/SensitiveText/SensitiveText.constants.d.mts.map +0 -1
- package/dist/components/SensitiveText/SensitiveText.constants.mjs +0 -11
- package/dist/components/SensitiveText/SensitiveText.constants.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetDialog.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAIuD;AACvD,oEAAyE;AACzE,mCAAkC;AAClC,+CAOe;AACf,wDAKsB;AACtB,+EAGsC;AACtC,mFAMiC;AACjC,mFAGwC;AAExC,yBAAyB;AACzB,mFAIuC;AAM1B,QAAA,iBAAiB,GAAG,IAAA,kBAAU,EAIzC,CACE,EACE,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,cAAc,GAAG,IAAI,EACrB,2BAA2B,GAAG,IAAI,EAClC,OAAO,EACP,MAAM,EACN,sBAAsB,EACtB,KAAK,EACL,WAAW,EACX,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IACzB,MAAM,YAAY,GAAG,IAAA,qCAAQ,GAAE,CAAC;IAChC,MAAM,QAAQ,GACZ,YAAY,KAAK,kCAAK,CAAC,KAAK;QAC1B,CAAC,CAAC,0BAAU,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC5B,CAAC,CAAC,yBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;IAEhC,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,mBAAmB,EAAE,GAC1D,IAAA,kDAAiB,GAAE,CAAC;IACtB,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,IAAA,iDAAgB,GAAE,CAAC;IAE/D,MAAM,cAAc,GA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AAC,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAC/C,QAAQ,CAAC,CAAC,uBAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CACxD,sBAAsB,CAAC,CACrB,uBAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,CACtD,CACD,OAAO,CAAC,CAAC,2BAA2B,CAAC,CACrC,IAAI,KAAK,CAAC,CAEV;QAAA,CAAC,gDAAiB,CAChB,IAAI,sBAAsB,CAAC,CAC3B,OAAO,CAAC,CAAC,cAAc,CAAC,CACxB,cAAc,CAAC,CAAC,cAAc,CAAC,CAE/B;UAAA,CAAC,iCAAQ,CAAC,IAAI,CACZ,QAAQ,CAAC,CAAC,iBAAiB,CAAC,CAC5B,KAAK,CAAC,CAAC,kBAAkB,CAAC,CAE1B;YAAA,CAAC,cAAc,IAAI,CACjB,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CACrD;gBAAA,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC,EAC/D;cAAA,EAAE,mBAAI,CAAC,CACR,CACD;YAAA,CAAC,QAAQ,CACX;UAAA,EAAE,iCAAQ,CAAC,IAAI,CACjB;QAAA,EAAE,gDAAiB,CACrB;MAAA,EAAE,mCAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import {\n Theme,\n useTailwind,\n useTheme,\n} from '@metamask-previews/design-system-twrnc-preset';\nimport { lightTheme, darkTheme } from '@metamask-previews/design-tokens';\nimport { debounce } from 'lodash';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useImperativeHandle,\n} from 'react';\nimport {\n LayoutChangeEvent,\n View,\n Platform,\n KeyboardAvoidingView,\n} from 'react-native';\nimport {\n PanGestureHandler,\n PanGestureHandlerGestureEvent,\n} from 'react-native-gesture-handler';\nimport Animated, {\n runOnJS,\n useAnimatedGestureHandler,\n useAnimatedStyle,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\n// Internal dependencies.\nimport {\n DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD,\n DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION,\n} from './BottomSheetDialog.constants';\nimport type {\n BottomSheetDialogRef,\n BottomSheetDialogProps,\n} from './BottomSheetDialog.types';\n\nexport const BottomSheetDialog = forwardRef<\n BottomSheetDialogRef,\n BottomSheetDialogProps\n>(\n (\n {\n children,\n isFullscreen = false,\n isInteractable = true,\n keyboardAvoidingViewEnabled = true,\n onClose,\n onOpen,\n panGestureHandlerProps,\n style,\n twClassName,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const currentTheme = useTheme();\n const shadowLg =\n currentTheme === Theme.Light\n ? lightTheme.shadows.size.lg\n : darkTheme.shadows.size.lg;\n\n const { top: screenTopPadding, bottom: screenBottomPadding } =\n useSafeAreaInsets();\n const { y: frameY, height: screenHeight } = useSafeAreaFrame();\n\n const maxSheetHeight = screenHeight - screenTopPadding;\n // X and Y values start on top left of the DIALOG\n // currentYOffset will be used to animate the Y position of the Dialog\n const currentYOffset = useSharedValue(screenHeight);\n const topOfDialogYValue = useSharedValue(0);\n const bottomOfDialogYValue = useSharedValue(screenHeight);\n const isMounted = useRef(false);\n\n const onOpenCB = useCallback(() => {\n onOpen?.();\n }, [onOpen]);\n const onCloseCB = useCallback(() => {\n onClose?.();\n }, [onClose]);\n\n const onCloseDialog = useCallback(\n (callback?: () => void) => {\n currentYOffset.value = withTiming(\n bottomOfDialogYValue.value,\n { duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION },\n () => {\n runOnJS(onCloseCB)();\n if (callback) {\n runOnJS(callback)();\n }\n },\n );\n // Ref values do not affect deps.\n },\n [onCloseCB],\n );\n\n const gestureHandler = useAnimatedGestureHandler<\n PanGestureHandlerGestureEvent,\n { startY: number }\n >({\n onStart: (_, ctx) => {\n // Starts tracking vertical position of gesture\n ctx.startY = currentYOffset.value;\n },\n onActive: (event, ctx) => {\n const { translationY } = event;\n currentYOffset.value = ctx.startY + translationY;\n // If gesture Y value goes above the bottom of Dialog Y value(bottom of dialog),\n // which means the gesture is currently below the bottom of the dialog,\n // sets it to bottom of Dialog Y value\n if (currentYOffset.value >= bottomOfDialogYValue.value) {\n currentYOffset.value = bottomOfDialogYValue.value;\n }\n // If gesture Y value goes below the top of Dialog Y value(top of dialog),\n // which means the gesture is currently above the top of the dialog,\n // sets it to top of Dialog Y value\n if (currentYOffset.value <= topOfDialogYValue.value) {\n currentYOffset.value = topOfDialogYValue.value;\n }\n },\n onEnd: (event, ctx) => {\n const { translationY, velocityY } = event;\n // finalYOffset is used to animate the Y position of the Dialog after the gesture event\n let finalYOffset: number;\n // Measuring dismissing swipe action\n const latestOffset = ctx.startY + translationY;\n // Check if the swipe distance reach the dismiss offset threshold,\n // which is currently 60% of sheet height\n const hasReachedDismissOffset =\n latestOffset >\n bottomOfDialogYValue.value *\n DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD;\n // Check if the gesture's vertical speed has reached the threshold to determine a swipe action\n const hasReachedSwipeThreshold =\n Math.abs(velocityY) >\n DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION;\n const isQuickDismissing = velocityY > 0;\n\n // If user is swiping\n if (hasReachedSwipeThreshold) {\n // Quick swipe takes priority\n if (isQuickDismissing) {\n finalYOffset = bottomOfDialogYValue.value;\n } else {\n finalYOffset = topOfDialogYValue.value;\n }\n } else if (hasReachedDismissOffset) {\n finalYOffset = bottomOfDialogYValue.value;\n } else {\n finalYOffset = topOfDialogYValue.value;\n }\n\n const isDismissed = finalYOffset === bottomOfDialogYValue.value;\n\n if (isDismissed) {\n runOnJS(onCloseDialog)();\n } else {\n // Only animate dialog to a certain Y position instead\n currentYOffset.value = withTiming(finalYOffset, {\n duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n });\n }\n },\n });\n\n // Animate in sheet on initial render.\n const onOpenDialog = (callback?: () => void) => {\n // Starts setting the Y position of the dialog to the bottom of the dialog\n currentYOffset.value = bottomOfDialogYValue.value;\n // Animate the Y position to the top of the dialog, then call onOpenCB\n currentYOffset.value = withTiming(\n topOfDialogYValue.value,\n {\n duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n },\n () => {\n runOnJS(onOpenCB)();\n if (callback) {\n runOnJS(callback)();\n }\n },\n );\n };\n\n const onDebouncedCloseDialog = useMemo(\n // Prevent hide from being called multiple times. Potentially caused by taps in quick succession.\n () => debounce(onCloseDialog, 2000, { leading: true }),\n [onCloseDialog],\n );\n\n useEffect(\n () =>\n // Automatically handles animation when content changes\n // Disable for now since network switches causes the screen to hang with this on.\n // LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);\n onDebouncedCloseDialog.cancel(),\n [children, onDebouncedCloseDialog],\n );\n\n const updateSheetHeight = (e: LayoutChangeEvent) => {\n const { height } = e.nativeEvent.layout;\n bottomOfDialogYValue.value = height;\n\n if (!isMounted.current) {\n isMounted.current = true;\n onOpenDialog();\n }\n };\n\n const animatedSheetStyle = useAnimatedStyle(() => ({\n transform: [\n {\n translateY: currentYOffset.value,\n },\n ],\n }));\n\n const sheetStyle = useMemo(\n () => [\n tw.style(\n 'bg-alternative rounded-t-3xl overflow-hidden border border-muted',\n twClassName,\n ),\n {\n maxHeight: maxSheetHeight,\n paddingBottom: Platform.select({\n ios: screenBottomPadding,\n macos: screenBottomPadding,\n default: screenBottomPadding + 16,\n }),\n ...(isFullscreen && { height: maxSheetHeight }),\n ...shadowLg,\n },\n style,\n ],\n\n [\n tw,\n maxSheetHeight,\n screenBottomPadding,\n isFullscreen,\n shadowLg,\n style,\n twClassName,\n ],\n );\n\n const combinedSheetStyle = useMemo(\n () => [...sheetStyle, animatedSheetStyle],\n\n [sheetStyle],\n );\n\n useImperativeHandle(ref, () => ({\n onOpenDialog,\n onCloseDialog,\n }));\n\n return (\n <KeyboardAvoidingView\n style={tw.style('absolute bottom-0 inset-x-0')}\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={\n Platform.OS === 'ios' ? -screenBottomPadding : frameY\n }\n enabled={keyboardAvoidingViewEnabled}\n {...props}\n >\n <PanGestureHandler\n {...panGestureHandlerProps}\n enabled={isInteractable}\n onGestureEvent={gestureHandler}\n >\n <Animated.View\n onLayout={updateSheetHeight}\n style={combinedSheetStyle}\n >\n {isInteractable && (\n <View style={tw.style('self-stretch items-center p-1')}>\n <View style={tw.style('h-1 w-10 rounded-sm bg-border-muted')} />\n </View>\n )}\n {children}\n </Animated.View>\n </PanGestureHandler>\n </KeyboardAvoidingView>\n );\n },\n);\n"]}
|
|
1
|
+
{"version":3,"file":"BottomSheetDialog.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAIuD;AACvD,oEAAyE;AACzE,mCAAkC;AAClC,+CAOe;AACf,+CAKsB;AACtB,+EAAwE;AACxE,mFAKiC;AACjC,mFAGwC;AAExC,yBAAyB;AACzB,mFAIuC;AAM1B,QAAA,iBAAiB,GAAG,IAAA,kBAAU,EAIzC,CACE,EACE,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,cAAc,GAAG,IAAI,EACrB,2BAA2B,GAAG,IAAI,EAClC,OAAO,EACP,MAAM,EACN,KAAK,EACL,WAAW,EACX,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,GAAG,IAAA,wCAAW,GAA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B,CAAC,CAE1B;YAAA,CAAC,cAAc,IAAI,CACjB,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CACrD;gBAAA,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC,EAC/D;cAAA,EAAE,mBAAI,CAAC,CACR,CACD;YAAA,CAAC,QAAQ,CACX;UAAA,EAAE,iCAAQ,CAAC,IAAI,CACjB;QAAA,EAAE,8CAAe,CACnB;MAAA,EAAE,mCAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import {\n Theme,\n useTailwind,\n useTheme,\n} from '@metamask-previews/design-system-twrnc-preset';\nimport { lightTheme, darkTheme } from '@metamask-previews/design-tokens';\nimport { debounce } from 'lodash';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useImperativeHandle,\n} from 'react';\nimport {\n LayoutChangeEvent,\n View,\n Platform,\n KeyboardAvoidingView,\n} from 'react-native';\nimport { Gesture, GestureDetector } from 'react-native-gesture-handler';\nimport Animated, {\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\n// Internal dependencies.\nimport {\n DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD,\n DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION,\n} from './BottomSheetDialog.constants';\nimport type {\n BottomSheetDialogRef,\n BottomSheetDialogProps,\n} from './BottomSheetDialog.types';\n\nexport const BottomSheetDialog = forwardRef<\n BottomSheetDialogRef,\n BottomSheetDialogProps\n>(\n (\n {\n children,\n isFullscreen = false,\n isInteractable = true,\n keyboardAvoidingViewEnabled = true,\n onClose,\n onOpen,\n style,\n twClassName,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const currentTheme = useTheme();\n const shadowLg =\n currentTheme === Theme.Light\n ? lightTheme.shadows.size.lg\n : darkTheme.shadows.size.lg;\n\n const { top: screenTopPadding, bottom: screenBottomPadding } =\n useSafeAreaInsets();\n const { y: frameY, height: screenHeight } = useSafeAreaFrame();\n\n const maxSheetHeight = screenHeight - screenTopPadding;\n // X and Y values start on top left of the DIALOG\n // currentYOffset will be used to animate the Y position of the Dialog\n const currentYOffset = useSharedValue(screenHeight);\n const topOfDialogYValue = useSharedValue(0);\n const bottomOfDialogYValue = useSharedValue(screenHeight);\n const gestureStartYOffset = useSharedValue(0);\n const isMounted = useRef(false);\n\n const onOpenCB = useCallback(() => {\n onOpen?.();\n }, [onOpen]);\n const onCloseCB = useCallback(() => {\n onClose?.();\n }, [onClose]);\n\n const onCloseDialog = useCallback(\n (callback?: () => void) => {\n currentYOffset.value = withTiming(\n bottomOfDialogYValue.value,\n { duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION },\n () => {\n runOnJS(onCloseCB)();\n if (callback) {\n runOnJS(callback)();\n }\n },\n );\n // Ref values do not affect deps.\n },\n [onCloseCB],\n );\n\n const gestureHandler = useMemo(() => {\n const gesture = Gesture.Pan()\n .enabled(isInteractable)\n .onStart(() => {\n // Starts tracking vertical position of gesture.\n gestureStartYOffset.value = currentYOffset.value;\n })\n .onUpdate((event) => {\n const { translationY } = event;\n currentYOffset.value = gestureStartYOffset.value + translationY;\n // If gesture Y value goes above the bottom of Dialog Y value(bottom of dialog),\n // which means the gesture is currently below the bottom of the dialog,\n // sets it to bottom of Dialog Y value\n if (currentYOffset.value >= bottomOfDialogYValue.value) {\n currentYOffset.value = bottomOfDialogYValue.value;\n }\n // If gesture Y value goes below the top of Dialog Y value(top of dialog),\n // which means the gesture is currently above the top of the dialog,\n // sets it to top of Dialog Y value\n if (currentYOffset.value <= topOfDialogYValue.value) {\n currentYOffset.value = topOfDialogYValue.value;\n }\n })\n .onEnd((event) => {\n const { translationY, velocityY } = event;\n // finalYOffset is used to animate the Y position of the Dialog after the gesture event\n let finalYOffset: number;\n // Measuring dismissing swipe action\n const latestOffset = gestureStartYOffset.value + translationY;\n // Check if the swipe distance reach the dismiss offset threshold,\n // which is currently 60% of sheet height\n const hasReachedDismissOffset =\n latestOffset >\n bottomOfDialogYValue.value *\n DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD;\n // Check if the gesture's vertical speed has reached the threshold to determine a swipe action\n const hasReachedSwipeThreshold =\n Math.abs(velocityY) >\n DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION;\n const isQuickDismissing = velocityY > 0;\n\n // If user is swiping\n if (hasReachedSwipeThreshold) {\n // Quick swipe takes priority\n if (isQuickDismissing) {\n finalYOffset = bottomOfDialogYValue.value;\n } else {\n finalYOffset = topOfDialogYValue.value;\n }\n } else if (hasReachedDismissOffset) {\n finalYOffset = bottomOfDialogYValue.value;\n } else {\n finalYOffset = topOfDialogYValue.value;\n }\n\n const isDismissed = finalYOffset === bottomOfDialogYValue.value;\n\n if (isDismissed) {\n runOnJS(onCloseDialog)();\n } else {\n // Only animate dialog to a certain Y position instead\n currentYOffset.value = withTiming(finalYOffset, {\n duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n });\n }\n });\n\n return gesture;\n }, [\n isInteractable,\n currentYOffset,\n gestureStartYOffset,\n bottomOfDialogYValue,\n topOfDialogYValue,\n onCloseDialog,\n ]);\n\n // Animate in sheet on initial render.\n const onOpenDialog = (callback?: () => void) => {\n // Starts setting the Y position of the dialog to the bottom of the dialog\n currentYOffset.value = bottomOfDialogYValue.value;\n // Animate the Y position to the top of the dialog, then call onOpenCB\n currentYOffset.value = withTiming(\n topOfDialogYValue.value,\n {\n duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n },\n () => {\n runOnJS(onOpenCB)();\n if (callback) {\n runOnJS(callback)();\n }\n },\n );\n };\n\n const onDebouncedCloseDialog = useMemo(\n // Prevent hide from being called multiple times. Potentially caused by taps in quick succession.\n () => debounce(onCloseDialog, 2000, { leading: true }),\n [onCloseDialog],\n );\n\n useEffect(\n () =>\n // Automatically handles animation when content changes\n // Disable for now since network switches causes the screen to hang with this on.\n // LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);\n onDebouncedCloseDialog.cancel(),\n [children, onDebouncedCloseDialog],\n );\n\n const updateSheetHeight = (e: LayoutChangeEvent) => {\n const { height } = e.nativeEvent.layout;\n bottomOfDialogYValue.value = height;\n\n if (!isMounted.current) {\n isMounted.current = true;\n onOpenDialog();\n }\n };\n\n const animatedSheetStyle = useAnimatedStyle(() => ({\n transform: [\n {\n translateY: currentYOffset.value,\n },\n ],\n }));\n\n const sheetStyle = useMemo(\n () => [\n tw.style(\n 'bg-default rounded-t-3xl overflow-hidden border border-muted',\n twClassName,\n ),\n {\n maxHeight: maxSheetHeight,\n paddingBottom: Platform.select({\n ios: screenBottomPadding,\n macos: screenBottomPadding,\n default: screenBottomPadding + 16,\n }),\n ...(isFullscreen && { height: maxSheetHeight }),\n ...shadowLg,\n },\n style,\n ],\n\n [\n tw,\n maxSheetHeight,\n screenBottomPadding,\n isFullscreen,\n shadowLg,\n style,\n twClassName,\n ],\n );\n\n const combinedSheetStyle = useMemo(\n () => [...sheetStyle, animatedSheetStyle],\n\n [sheetStyle],\n );\n\n useImperativeHandle(ref, () => ({\n onOpenDialog,\n onCloseDialog,\n }));\n\n return (\n <KeyboardAvoidingView\n style={tw.style('absolute bottom-0 inset-x-0')}\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={\n Platform.OS === 'ios' ? -screenBottomPadding : frameY\n }\n enabled={keyboardAvoidingViewEnabled}\n {...props}\n >\n <GestureDetector gesture={gestureHandler}>\n <Animated.View\n onLayout={updateSheetHeight}\n style={combinedSheetStyle}\n >\n {isInteractable && (\n <View style={tw.style('self-stretch items-center p-1')}>\n <View style={tw.style('h-1 w-10 rounded-sm bg-border-muted')} />\n </View>\n )}\n {children}\n </Animated.View>\n </GestureDetector>\n </KeyboardAvoidingView>\n );\n },\n);\n"]}
|
|
@@ -7,41 +7,6 @@ export declare const BottomSheetDialog: React.ForwardRefExoticComponent<{
|
|
|
7
7
|
keyboardAvoidingViewEnabled?: boolean | undefined;
|
|
8
8
|
onClose?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
|
|
9
9
|
onOpen?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
|
|
10
|
-
panGestureHandlerProps?: {
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
hitSlop?: import("react-native-gesture-handler/lib/typescript/handlers/gestureHandlerCommon").HitSlop;
|
|
13
|
-
id?: string | undefined;
|
|
14
|
-
testID?: string | undefined;
|
|
15
|
-
activeOffsetY?: number | [activeOffsetYStart: number, activeOffsetYEnd: number] | undefined;
|
|
16
|
-
activeOffsetX?: number | [activeOffsetXStart: number, activeOffsetXEnd: number] | undefined;
|
|
17
|
-
failOffsetY?: number | [failOffsetYStart: number, failOffsetYEnd: number] | undefined;
|
|
18
|
-
failOffsetX?: number | [failOffsetXStart: number, failOffsetXEnd: number] | undefined;
|
|
19
|
-
shouldCancelWhenOutside?: boolean | undefined;
|
|
20
|
-
userSelect?: import("react-native-gesture-handler/lib/typescript/handlers/gestureHandlerCommon").UserSelect | undefined;
|
|
21
|
-
activeCursor?: import("react-native-gesture-handler/lib/typescript/handlers/gestureHandlerCommon").ActiveCursor | undefined;
|
|
22
|
-
mouseButton?: import("react-native-gesture-handler").MouseButton | undefined;
|
|
23
|
-
enableContextMenu?: boolean | undefined;
|
|
24
|
-
touchAction?: import("react-native-gesture-handler/lib/typescript/handlers/gestureHandlerCommon").TouchAction | undefined;
|
|
25
|
-
waitFor?: React.Ref<unknown> | React.Ref<unknown>[] | undefined;
|
|
26
|
-
simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[] | undefined;
|
|
27
|
-
blocksHandlers?: React.Ref<unknown> | React.Ref<unknown>[] | undefined;
|
|
28
|
-
cancelsTouchesInView?: boolean | undefined;
|
|
29
|
-
onBegan?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
|
|
30
|
-
onFailed?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
|
|
31
|
-
onCancelled?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
|
|
32
|
-
onActivated?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
|
|
33
|
-
onEnded?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
|
|
34
|
-
onHandlerStateChange?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<import("react-native-gesture-handler").PanGestureHandlerEventPayload>) => void) | undefined;
|
|
35
|
-
minDist?: number | undefined;
|
|
36
|
-
avgTouches?: boolean | undefined;
|
|
37
|
-
enableTrackpadTwoFingerGesture?: boolean | undefined;
|
|
38
|
-
minPointers?: number | undefined;
|
|
39
|
-
maxPointers?: number | undefined;
|
|
40
|
-
minVelocity?: number | undefined;
|
|
41
|
-
minVelocityX?: number | undefined;
|
|
42
|
-
minVelocityY?: number | undefined;
|
|
43
|
-
activateAfterLongPress?: number | undefined;
|
|
44
|
-
} | undefined;
|
|
45
10
|
twClassName?: string | undefined;
|
|
46
11
|
} & import("react-native").ViewProps & React.RefAttributes<BottomSheetDialogRef>>;
|
|
47
12
|
//# sourceMappingURL=BottomSheetDialog.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetDialog.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":"AAOA,OAAO,KAON,cAAc;
|
|
1
|
+
{"version":3,"file":"BottomSheetDialog.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":"AAOA,OAAO,KAON,cAAc;AAyBf,OAAO,KAAK,EACV,oBAAoB,EAErB,sCAAkC;AAEnC,eAAO,MAAM,iBAAiB;;;;;;;;iFAkQ7B,CAAC"}
|
|
@@ -7,41 +7,6 @@ export declare const BottomSheetDialog: React.ForwardRefExoticComponent<{
|
|
|
7
7
|
keyboardAvoidingViewEnabled?: boolean | undefined;
|
|
8
8
|
onClose?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
|
|
9
9
|
onOpen?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
|
|
10
|
-
panGestureHandlerProps?: {
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
hitSlop?: import("react-native-gesture-handler/lib/typescript/handlers/gestureHandlerCommon").HitSlop;
|
|
13
|
-
id?: string | undefined;
|
|
14
|
-
testID?: string | undefined;
|
|
15
|
-
activeOffsetY?: number | [activeOffsetYStart: number, activeOffsetYEnd: number] | undefined;
|
|
16
|
-
activeOffsetX?: number | [activeOffsetXStart: number, activeOffsetXEnd: number] | undefined;
|
|
17
|
-
failOffsetY?: number | [failOffsetYStart: number, failOffsetYEnd: number] | undefined;
|
|
18
|
-
failOffsetX?: number | [failOffsetXStart: number, failOffsetXEnd: number] | undefined;
|
|
19
|
-
shouldCancelWhenOutside?: boolean | undefined;
|
|
20
|
-
userSelect?: import("react-native-gesture-handler/lib/typescript/handlers/gestureHandlerCommon").UserSelect | undefined;
|
|
21
|
-
activeCursor?: import("react-native-gesture-handler/lib/typescript/handlers/gestureHandlerCommon").ActiveCursor | undefined;
|
|
22
|
-
mouseButton?: import("react-native-gesture-handler").MouseButton | undefined;
|
|
23
|
-
enableContextMenu?: boolean | undefined;
|
|
24
|
-
touchAction?: import("react-native-gesture-handler/lib/typescript/handlers/gestureHandlerCommon").TouchAction | undefined;
|
|
25
|
-
waitFor?: React.Ref<unknown> | React.Ref<unknown>[] | undefined;
|
|
26
|
-
simultaneousHandlers?: React.Ref<unknown> | React.Ref<unknown>[] | undefined;
|
|
27
|
-
blocksHandlers?: React.Ref<unknown> | React.Ref<unknown>[] | undefined;
|
|
28
|
-
cancelsTouchesInView?: boolean | undefined;
|
|
29
|
-
onBegan?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
|
|
30
|
-
onFailed?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
|
|
31
|
-
onCancelled?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
|
|
32
|
-
onActivated?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
|
|
33
|
-
onEnded?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<Record<string, unknown>>) => void) | undefined;
|
|
34
|
-
onHandlerStateChange?: ((event: import("react-native-gesture-handler").HandlerStateChangeEvent<import("react-native-gesture-handler").PanGestureHandlerEventPayload>) => void) | undefined;
|
|
35
|
-
minDist?: number | undefined;
|
|
36
|
-
avgTouches?: boolean | undefined;
|
|
37
|
-
enableTrackpadTwoFingerGesture?: boolean | undefined;
|
|
38
|
-
minPointers?: number | undefined;
|
|
39
|
-
maxPointers?: number | undefined;
|
|
40
|
-
minVelocity?: number | undefined;
|
|
41
|
-
minVelocityX?: number | undefined;
|
|
42
|
-
minVelocityY?: number | undefined;
|
|
43
|
-
activateAfterLongPress?: number | undefined;
|
|
44
|
-
} | undefined;
|
|
45
10
|
twClassName?: string | undefined;
|
|
46
11
|
} & import("react-native").ViewProps & React.RefAttributes<BottomSheetDialogRef>>;
|
|
47
12
|
//# sourceMappingURL=BottomSheetDialog.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetDialog.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":"AAOA,OAAO,KAON,cAAc;
|
|
1
|
+
{"version":3,"file":"BottomSheetDialog.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":"AAOA,OAAO,KAON,cAAc;AAyBf,OAAO,KAAK,EACV,oBAAoB,EAErB,sCAAkC;AAEnC,eAAO,MAAM,iBAAiB;;;;;;;;iFAkQ7B,CAAC"}
|
|
@@ -10,13 +10,13 @@ import $lodash from "lodash";
|
|
|
10
10
|
const { debounce } = $lodash;
|
|
11
11
|
import $React, { forwardRef, useCallback, useEffect, useMemo, useRef, useImperativeHandle } from "react";
|
|
12
12
|
const React = $importDefault($React);
|
|
13
|
-
import { View, Platform, KeyboardAvoidingView } from "react-native
|
|
14
|
-
import {
|
|
15
|
-
import Animated, { runOnJS,
|
|
13
|
+
import { View, Platform, KeyboardAvoidingView } from "react-native";
|
|
14
|
+
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
15
|
+
import Animated, { runOnJS, useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
|
|
16
16
|
import { useSafeAreaFrame, useSafeAreaInsets } from "react-native-safe-area-context";
|
|
17
17
|
// Internal dependencies.
|
|
18
18
|
import { DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION, DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD, DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION } from "./BottomSheetDialog.constants.mjs";
|
|
19
|
-
export const BottomSheetDialog = forwardRef(({ children, isFullscreen = false, isInteractable = true, keyboardAvoidingViewEnabled = true, onClose, onOpen,
|
|
19
|
+
export const BottomSheetDialog = forwardRef(({ children, isFullscreen = false, isInteractable = true, keyboardAvoidingViewEnabled = true, onClose, onOpen, style, twClassName, ...props }, ref) => {
|
|
20
20
|
const tw = useTailwind();
|
|
21
21
|
const currentTheme = useTheme();
|
|
22
22
|
const shadowLg = currentTheme === Theme.Light
|
|
@@ -30,6 +30,7 @@ export const BottomSheetDialog = forwardRef(({ children, isFullscreen = false, i
|
|
|
30
30
|
const currentYOffset = useSharedValue(screenHeight);
|
|
31
31
|
const topOfDialogYValue = useSharedValue(0);
|
|
32
32
|
const bottomOfDialogYValue = useSharedValue(screenHeight);
|
|
33
|
+
const gestureStartYOffset = useSharedValue(0);
|
|
33
34
|
const isMounted = useRef(false);
|
|
34
35
|
const onOpenCB = useCallback(() => {
|
|
35
36
|
onOpen?.();
|
|
@@ -46,14 +47,16 @@ export const BottomSheetDialog = forwardRef(({ children, isFullscreen = false, i
|
|
|
46
47
|
});
|
|
47
48
|
// Ref values do not affect deps.
|
|
48
49
|
}, [onCloseCB]);
|
|
49
|
-
const gestureHandler =
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
const gestureHandler = useMemo(() => {
|
|
51
|
+
const gesture = Gesture.Pan()
|
|
52
|
+
.enabled(isInteractable)
|
|
53
|
+
.onStart(() => {
|
|
54
|
+
// Starts tracking vertical position of gesture.
|
|
55
|
+
gestureStartYOffset.value = currentYOffset.value;
|
|
56
|
+
})
|
|
57
|
+
.onUpdate((event) => {
|
|
55
58
|
const { translationY } = event;
|
|
56
|
-
currentYOffset.value =
|
|
59
|
+
currentYOffset.value = gestureStartYOffset.value + translationY;
|
|
57
60
|
// If gesture Y value goes above the bottom of Dialog Y value(bottom of dialog),
|
|
58
61
|
// which means the gesture is currently below the bottom of the dialog,
|
|
59
62
|
// sets it to bottom of Dialog Y value
|
|
@@ -66,13 +69,13 @@ export const BottomSheetDialog = forwardRef(({ children, isFullscreen = false, i
|
|
|
66
69
|
if (currentYOffset.value <= topOfDialogYValue.value) {
|
|
67
70
|
currentYOffset.value = topOfDialogYValue.value;
|
|
68
71
|
}
|
|
69
|
-
}
|
|
70
|
-
|
|
72
|
+
})
|
|
73
|
+
.onEnd((event) => {
|
|
71
74
|
const { translationY, velocityY } = event;
|
|
72
75
|
// finalYOffset is used to animate the Y position of the Dialog after the gesture event
|
|
73
76
|
let finalYOffset;
|
|
74
77
|
// Measuring dismissing swipe action
|
|
75
|
-
const latestOffset =
|
|
78
|
+
const latestOffset = gestureStartYOffset.value + translationY;
|
|
76
79
|
// Check if the swipe distance reach the dismiss offset threshold,
|
|
77
80
|
// which is currently 60% of sheet height
|
|
78
81
|
const hasReachedDismissOffset = latestOffset >
|
|
@@ -108,8 +111,16 @@ export const BottomSheetDialog = forwardRef(({ children, isFullscreen = false, i
|
|
|
108
111
|
duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,
|
|
109
112
|
});
|
|
110
113
|
}
|
|
111
|
-
}
|
|
112
|
-
|
|
114
|
+
});
|
|
115
|
+
return gesture;
|
|
116
|
+
}, [
|
|
117
|
+
isInteractable,
|
|
118
|
+
currentYOffset,
|
|
119
|
+
gestureStartYOffset,
|
|
120
|
+
bottomOfDialogYValue,
|
|
121
|
+
topOfDialogYValue,
|
|
122
|
+
onCloseDialog,
|
|
123
|
+
]);
|
|
113
124
|
// Animate in sheet on initial render.
|
|
114
125
|
const onOpenDialog = (callback) => {
|
|
115
126
|
// Starts setting the Y position of the dialog to the bottom of the dialog
|
|
@@ -148,7 +159,7 @@ export const BottomSheetDialog = forwardRef(({ children, isFullscreen = false, i
|
|
|
148
159
|
],
|
|
149
160
|
}));
|
|
150
161
|
const sheetStyle = useMemo(() => [
|
|
151
|
-
tw.style('bg-
|
|
162
|
+
tw.style('bg-default rounded-t-3xl overflow-hidden border border-muted', twClassName),
|
|
152
163
|
{
|
|
153
164
|
maxHeight: maxSheetHeight,
|
|
154
165
|
paddingBottom: Platform.select({
|
|
@@ -175,14 +186,14 @@ export const BottomSheetDialog = forwardRef(({ children, isFullscreen = false, i
|
|
|
175
186
|
onCloseDialog,
|
|
176
187
|
}));
|
|
177
188
|
return (<KeyboardAvoidingView style={tw.style('absolute bottom-0 inset-x-0')} behavior={Platform.OS === 'ios' ? 'padding' : undefined} keyboardVerticalOffset={Platform.OS === 'ios' ? -screenBottomPadding : frameY} enabled={keyboardAvoidingViewEnabled} {...props}>
|
|
178
|
-
<
|
|
189
|
+
<GestureDetector gesture={gestureHandler}>
|
|
179
190
|
<Animated.View onLayout={updateSheetHeight} style={combinedSheetStyle}>
|
|
180
191
|
{isInteractable && (<View style={tw.style('self-stretch items-center p-1')}>
|
|
181
192
|
<View style={tw.style('h-1 w-10 rounded-sm bg-border-muted')}/>
|
|
182
193
|
</View>)}
|
|
183
194
|
{children}
|
|
184
195
|
</Animated.View>
|
|
185
|
-
</
|
|
196
|
+
</GestureDetector>
|
|
186
197
|
</KeyboardAvoidingView>);
|
|
187
198
|
});
|
|
188
199
|
//# sourceMappingURL=BottomSheetDialog.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetDialog.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,KAAK,EACL,WAAW,EACX,QAAQ,EACT,sDAAsD;AACvD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,yCAAyC;;;AAEzE,OAAO,QAAO,EACZ,UAAU,EACV,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,mBAAmB,EACpB,cAAc;;AACf,OAAO,EAEL,IAAI,EACJ,QAAQ,EACR,oBAAoB,EACrB,8BAAqB;AACtB,OAAO,EACL,iBAAiB,EAElB,qCAAqC;AACtC,OAAO,QAAQ,EAAE,EACf,OAAO,EACP,yBAAyB,EACzB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACX,gCAAgC;AACjC,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EAClB,uCAAuC;AAExC,yBAAyB;AACzB,OAAO,EACL,0CAA0C,EAC1C,0CAA0C,EAC1C,iDAAiD,EAClD,0CAAsC;AAMvC,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAIzC,CACE,EACE,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,cA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C,qCAAqC,CAAC,CAAC,EAC/D;cAAA,EAAE,IAAI,CAAC,CACR,CACD;YAAA,CAAC,QAAQ,CACX;UAAA,EAAE,QAAQ,CAAC,IAAI,CACjB;QAAA,EAAE,iBAAiB,CACrB;MAAA,EAAE,oBAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import {\n Theme,\n useTailwind,\n useTheme,\n} from '@metamask-previews/design-system-twrnc-preset';\nimport { lightTheme, darkTheme } from '@metamask-previews/design-tokens';\nimport { debounce } from 'lodash';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useImperativeHandle,\n} from 'react';\nimport {\n LayoutChangeEvent,\n View,\n Platform,\n KeyboardAvoidingView,\n} from 'react-native';\nimport {\n PanGestureHandler,\n PanGestureHandlerGestureEvent,\n} from 'react-native-gesture-handler';\nimport Animated, {\n runOnJS,\n useAnimatedGestureHandler,\n useAnimatedStyle,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\n// Internal dependencies.\nimport {\n DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD,\n DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION,\n} from './BottomSheetDialog.constants';\nimport type {\n BottomSheetDialogRef,\n BottomSheetDialogProps,\n} from './BottomSheetDialog.types';\n\nexport const BottomSheetDialog = forwardRef<\n BottomSheetDialogRef,\n BottomSheetDialogProps\n>(\n (\n {\n children,\n isFullscreen = false,\n isInteractable = true,\n keyboardAvoidingViewEnabled = true,\n onClose,\n onOpen,\n panGestureHandlerProps,\n style,\n twClassName,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const currentTheme = useTheme();\n const shadowLg =\n currentTheme === Theme.Light\n ? lightTheme.shadows.size.lg\n : darkTheme.shadows.size.lg;\n\n const { top: screenTopPadding, bottom: screenBottomPadding } =\n useSafeAreaInsets();\n const { y: frameY, height: screenHeight } = useSafeAreaFrame();\n\n const maxSheetHeight = screenHeight - screenTopPadding;\n // X and Y values start on top left of the DIALOG\n // currentYOffset will be used to animate the Y position of the Dialog\n const currentYOffset = useSharedValue(screenHeight);\n const topOfDialogYValue = useSharedValue(0);\n const bottomOfDialogYValue = useSharedValue(screenHeight);\n const isMounted = useRef(false);\n\n const onOpenCB = useCallback(() => {\n onOpen?.();\n }, [onOpen]);\n const onCloseCB = useCallback(() => {\n onClose?.();\n }, [onClose]);\n\n const onCloseDialog = useCallback(\n (callback?: () => void) => {\n currentYOffset.value = withTiming(\n bottomOfDialogYValue.value,\n { duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION },\n () => {\n runOnJS(onCloseCB)();\n if (callback) {\n runOnJS(callback)();\n }\n },\n );\n // Ref values do not affect deps.\n },\n [onCloseCB],\n );\n\n const gestureHandler = useAnimatedGestureHandler<\n PanGestureHandlerGestureEvent,\n { startY: number }\n >({\n onStart: (_, ctx) => {\n // Starts tracking vertical position of gesture\n ctx.startY = currentYOffset.value;\n },\n onActive: (event, ctx) => {\n const { translationY } = event;\n currentYOffset.value = ctx.startY + translationY;\n // If gesture Y value goes above the bottom of Dialog Y value(bottom of dialog),\n // which means the gesture is currently below the bottom of the dialog,\n // sets it to bottom of Dialog Y value\n if (currentYOffset.value >= bottomOfDialogYValue.value) {\n currentYOffset.value = bottomOfDialogYValue.value;\n }\n // If gesture Y value goes below the top of Dialog Y value(top of dialog),\n // which means the gesture is currently above the top of the dialog,\n // sets it to top of Dialog Y value\n if (currentYOffset.value <= topOfDialogYValue.value) {\n currentYOffset.value = topOfDialogYValue.value;\n }\n },\n onEnd: (event, ctx) => {\n const { translationY, velocityY } = event;\n // finalYOffset is used to animate the Y position of the Dialog after the gesture event\n let finalYOffset: number;\n // Measuring dismissing swipe action\n const latestOffset = ctx.startY + translationY;\n // Check if the swipe distance reach the dismiss offset threshold,\n // which is currently 60% of sheet height\n const hasReachedDismissOffset =\n latestOffset >\n bottomOfDialogYValue.value *\n DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD;\n // Check if the gesture's vertical speed has reached the threshold to determine a swipe action\n const hasReachedSwipeThreshold =\n Math.abs(velocityY) >\n DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION;\n const isQuickDismissing = velocityY > 0;\n\n // If user is swiping\n if (hasReachedSwipeThreshold) {\n // Quick swipe takes priority\n if (isQuickDismissing) {\n finalYOffset = bottomOfDialogYValue.value;\n } else {\n finalYOffset = topOfDialogYValue.value;\n }\n } else if (hasReachedDismissOffset) {\n finalYOffset = bottomOfDialogYValue.value;\n } else {\n finalYOffset = topOfDialogYValue.value;\n }\n\n const isDismissed = finalYOffset === bottomOfDialogYValue.value;\n\n if (isDismissed) {\n runOnJS(onCloseDialog)();\n } else {\n // Only animate dialog to a certain Y position instead\n currentYOffset.value = withTiming(finalYOffset, {\n duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n });\n }\n },\n });\n\n // Animate in sheet on initial render.\n const onOpenDialog = (callback?: () => void) => {\n // Starts setting the Y position of the dialog to the bottom of the dialog\n currentYOffset.value = bottomOfDialogYValue.value;\n // Animate the Y position to the top of the dialog, then call onOpenCB\n currentYOffset.value = withTiming(\n topOfDialogYValue.value,\n {\n duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n },\n () => {\n runOnJS(onOpenCB)();\n if (callback) {\n runOnJS(callback)();\n }\n },\n );\n };\n\n const onDebouncedCloseDialog = useMemo(\n // Prevent hide from being called multiple times. Potentially caused by taps in quick succession.\n () => debounce(onCloseDialog, 2000, { leading: true }),\n [onCloseDialog],\n );\n\n useEffect(\n () =>\n // Automatically handles animation when content changes\n // Disable for now since network switches causes the screen to hang with this on.\n // LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);\n onDebouncedCloseDialog.cancel(),\n [children, onDebouncedCloseDialog],\n );\n\n const updateSheetHeight = (e: LayoutChangeEvent) => {\n const { height } = e.nativeEvent.layout;\n bottomOfDialogYValue.value = height;\n\n if (!isMounted.current) {\n isMounted.current = true;\n onOpenDialog();\n }\n };\n\n const animatedSheetStyle = useAnimatedStyle(() => ({\n transform: [\n {\n translateY: currentYOffset.value,\n },\n ],\n }));\n\n const sheetStyle = useMemo(\n () => [\n tw.style(\n 'bg-alternative rounded-t-3xl overflow-hidden border border-muted',\n twClassName,\n ),\n {\n maxHeight: maxSheetHeight,\n paddingBottom: Platform.select({\n ios: screenBottomPadding,\n macos: screenBottomPadding,\n default: screenBottomPadding + 16,\n }),\n ...(isFullscreen && { height: maxSheetHeight }),\n ...shadowLg,\n },\n style,\n ],\n\n [\n tw,\n maxSheetHeight,\n screenBottomPadding,\n isFullscreen,\n shadowLg,\n style,\n twClassName,\n ],\n );\n\n const combinedSheetStyle = useMemo(\n () => [...sheetStyle, animatedSheetStyle],\n\n [sheetStyle],\n );\n\n useImperativeHandle(ref, () => ({\n onOpenDialog,\n onCloseDialog,\n }));\n\n return (\n <KeyboardAvoidingView\n style={tw.style('absolute bottom-0 inset-x-0')}\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={\n Platform.OS === 'ios' ? -screenBottomPadding : frameY\n }\n enabled={keyboardAvoidingViewEnabled}\n {...props}\n >\n <PanGestureHandler\n {...panGestureHandlerProps}\n enabled={isInteractable}\n onGestureEvent={gestureHandler}\n >\n <Animated.View\n onLayout={updateSheetHeight}\n style={combinedSheetStyle}\n >\n {isInteractable && (\n <View style={tw.style('self-stretch items-center p-1')}>\n <View style={tw.style('h-1 w-10 rounded-sm bg-border-muted')} />\n </View>\n )}\n {children}\n </Animated.View>\n </PanGestureHandler>\n </KeyboardAvoidingView>\n );\n },\n);\n"]}
|
|
1
|
+
{"version":3,"file":"BottomSheetDialog.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDial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,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,YAAY;QACZ,aAAa;KACd,CAAC,CAAC,CAAC;IAEJ,OAAO,CACL,CAAC,oBAAoB,CACnB,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAC/C,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CACxD,sBAAsB,CAAC,CACrB,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,CACtD,CACD,OAAO,CAAC,CAAC,2BAA2B,CAAC,CACrC,IAAI,KAAK,CAAC,CAEV;QAAA,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,CACvC;UAAA,CAAC,QAAQ,CAAC,IAAI,CACZ,QAAQ,CAAC,CAAC,iBAAiB,CAAC,CAC5B,KAAK,CAAC,CAAC,kBAAkB,CAAC,CAE1B;YAAA,CAAC,cAAc,IAAI,CACjB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CACrD;gBAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC,EAC/D;cAAA,EAAE,IAAI,CAAC,CACR,CACD;YAAA,CAAC,QAAQ,CACX;UAAA,EAAE,QAAQ,CAAC,IAAI,CACjB;QAAA,EAAE,eAAe,CACnB;MAAA,EAAE,oBAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import {\n Theme,\n useTailwind,\n useTheme,\n} from '@metamask-previews/design-system-twrnc-preset';\nimport { lightTheme, darkTheme } from '@metamask-previews/design-tokens';\nimport { debounce } from 'lodash';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useImperativeHandle,\n} from 'react';\nimport {\n LayoutChangeEvent,\n View,\n Platform,\n KeyboardAvoidingView,\n} from 'react-native';\nimport { Gesture, GestureDetector } from 'react-native-gesture-handler';\nimport Animated, {\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\n// Internal dependencies.\nimport {\n DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD,\n DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION,\n} from './BottomSheetDialog.constants';\nimport type {\n BottomSheetDialogRef,\n BottomSheetDialogProps,\n} from './BottomSheetDialog.types';\n\nexport const BottomSheetDialog = forwardRef<\n BottomSheetDialogRef,\n BottomSheetDialogProps\n>(\n (\n {\n children,\n isFullscreen = false,\n isInteractable = true,\n keyboardAvoidingViewEnabled = true,\n onClose,\n onOpen,\n style,\n twClassName,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const currentTheme = useTheme();\n const shadowLg =\n currentTheme === Theme.Light\n ? lightTheme.shadows.size.lg\n : darkTheme.shadows.size.lg;\n\n const { top: screenTopPadding, bottom: screenBottomPadding } =\n useSafeAreaInsets();\n const { y: frameY, height: screenHeight } = useSafeAreaFrame();\n\n const maxSheetHeight = screenHeight - screenTopPadding;\n // X and Y values start on top left of the DIALOG\n // currentYOffset will be used to animate the Y position of the Dialog\n const currentYOffset = useSharedValue(screenHeight);\n const topOfDialogYValue = useSharedValue(0);\n const bottomOfDialogYValue = useSharedValue(screenHeight);\n const gestureStartYOffset = useSharedValue(0);\n const isMounted = useRef(false);\n\n const onOpenCB = useCallback(() => {\n onOpen?.();\n }, [onOpen]);\n const onCloseCB = useCallback(() => {\n onClose?.();\n }, [onClose]);\n\n const onCloseDialog = useCallback(\n (callback?: () => void) => {\n currentYOffset.value = withTiming(\n bottomOfDialogYValue.value,\n { duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION },\n () => {\n runOnJS(onCloseCB)();\n if (callback) {\n runOnJS(callback)();\n }\n },\n );\n // Ref values do not affect deps.\n },\n [onCloseCB],\n );\n\n const gestureHandler = useMemo(() => {\n const gesture = Gesture.Pan()\n .enabled(isInteractable)\n .onStart(() => {\n // Starts tracking vertical position of gesture.\n gestureStartYOffset.value = currentYOffset.value;\n })\n .onUpdate((event) => {\n const { translationY } = event;\n currentYOffset.value = gestureStartYOffset.value + translationY;\n // If gesture Y value goes above the bottom of Dialog Y value(bottom of dialog),\n // which means the gesture is currently below the bottom of the dialog,\n // sets it to bottom of Dialog Y value\n if (currentYOffset.value >= bottomOfDialogYValue.value) {\n currentYOffset.value = bottomOfDialogYValue.value;\n }\n // If gesture Y value goes below the top of Dialog Y value(top of dialog),\n // which means the gesture is currently above the top of the dialog,\n // sets it to top of Dialog Y value\n if (currentYOffset.value <= topOfDialogYValue.value) {\n currentYOffset.value = topOfDialogYValue.value;\n }\n })\n .onEnd((event) => {\n const { translationY, velocityY } = event;\n // finalYOffset is used to animate the Y position of the Dialog after the gesture event\n let finalYOffset: number;\n // Measuring dismissing swipe action\n const latestOffset = gestureStartYOffset.value + translationY;\n // Check if the swipe distance reach the dismiss offset threshold,\n // which is currently 60% of sheet height\n const hasReachedDismissOffset =\n latestOffset >\n bottomOfDialogYValue.value *\n DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD;\n // Check if the gesture's vertical speed has reached the threshold to determine a swipe action\n const hasReachedSwipeThreshold =\n Math.abs(velocityY) >\n DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION;\n const isQuickDismissing = velocityY > 0;\n\n // If user is swiping\n if (hasReachedSwipeThreshold) {\n // Quick swipe takes priority\n if (isQuickDismissing) {\n finalYOffset = bottomOfDialogYValue.value;\n } else {\n finalYOffset = topOfDialogYValue.value;\n }\n } else if (hasReachedDismissOffset) {\n finalYOffset = bottomOfDialogYValue.value;\n } else {\n finalYOffset = topOfDialogYValue.value;\n }\n\n const isDismissed = finalYOffset === bottomOfDialogYValue.value;\n\n if (isDismissed) {\n runOnJS(onCloseDialog)();\n } else {\n // Only animate dialog to a certain Y position instead\n currentYOffset.value = withTiming(finalYOffset, {\n duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n });\n }\n });\n\n return gesture;\n }, [\n isInteractable,\n currentYOffset,\n gestureStartYOffset,\n bottomOfDialogYValue,\n topOfDialogYValue,\n onCloseDialog,\n ]);\n\n // Animate in sheet on initial render.\n const onOpenDialog = (callback?: () => void) => {\n // Starts setting the Y position of the dialog to the bottom of the dialog\n currentYOffset.value = bottomOfDialogYValue.value;\n // Animate the Y position to the top of the dialog, then call onOpenCB\n currentYOffset.value = withTiming(\n topOfDialogYValue.value,\n {\n duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n },\n () => {\n runOnJS(onOpenCB)();\n if (callback) {\n runOnJS(callback)();\n }\n },\n );\n };\n\n const onDebouncedCloseDialog = useMemo(\n // Prevent hide from being called multiple times. Potentially caused by taps in quick succession.\n () => debounce(onCloseDialog, 2000, { leading: true }),\n [onCloseDialog],\n );\n\n useEffect(\n () =>\n // Automatically handles animation when content changes\n // Disable for now since network switches causes the screen to hang with this on.\n // LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);\n onDebouncedCloseDialog.cancel(),\n [children, onDebouncedCloseDialog],\n );\n\n const updateSheetHeight = (e: LayoutChangeEvent) => {\n const { height } = e.nativeEvent.layout;\n bottomOfDialogYValue.value = height;\n\n if (!isMounted.current) {\n isMounted.current = true;\n onOpenDialog();\n }\n };\n\n const animatedSheetStyle = useAnimatedStyle(() => ({\n transform: [\n {\n translateY: currentYOffset.value,\n },\n ],\n }));\n\n const sheetStyle = useMemo(\n () => [\n tw.style(\n 'bg-default rounded-t-3xl overflow-hidden border border-muted',\n twClassName,\n ),\n {\n maxHeight: maxSheetHeight,\n paddingBottom: Platform.select({\n ios: screenBottomPadding,\n macos: screenBottomPadding,\n default: screenBottomPadding + 16,\n }),\n ...(isFullscreen && { height: maxSheetHeight }),\n ...shadowLg,\n },\n style,\n ],\n\n [\n tw,\n maxSheetHeight,\n screenBottomPadding,\n isFullscreen,\n shadowLg,\n style,\n twClassName,\n ],\n );\n\n const combinedSheetStyle = useMemo(\n () => [...sheetStyle, animatedSheetStyle],\n\n [sheetStyle],\n );\n\n useImperativeHandle(ref, () => ({\n onOpenDialog,\n onCloseDialog,\n }));\n\n return (\n <KeyboardAvoidingView\n style={tw.style('absolute bottom-0 inset-x-0')}\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={\n Platform.OS === 'ios' ? -screenBottomPadding : frameY\n }\n enabled={keyboardAvoidingViewEnabled}\n {...props}\n >\n <GestureDetector gesture={gestureHandler}>\n <Animated.View\n onLayout={updateSheetHeight}\n style={combinedSheetStyle}\n >\n {isInteractable && (\n <View style={tw.style('self-stretch items-center p-1')}>\n <View style={tw.style('h-1 w-10 rounded-sm bg-border-muted')} />\n </View>\n )}\n {children}\n </Animated.View>\n </GestureDetector>\n </KeyboardAvoidingView>\n );\n },\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetDialog.types.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.types.ts"],"names":[],"mappings":"","sourcesContent":["// Third party dependencies.\nimport type { ViewProps } from 'react-native';\
|
|
1
|
+
{"version":3,"file":"BottomSheetDialog.types.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.types.ts"],"names":[],"mappings":"","sourcesContent":["// Third party dependencies.\nimport type { ViewProps } from 'react-native';\n\n/**\n * BottomSheetDialog component props.\n */\nexport type BottomSheetDialogProps = {\n /**\n * Optional content to display inside the dialog.\n */\n children?: React.ReactNode;\n /**\n * Optional prop to toggle full screen state of BottomSheetDialog.\n *\n * @default false\n */\n isFullscreen?: boolean;\n /**\n * Optional boolean that indicates if the sheet is swippable.\n * This affects whether or not tapping on the overlay will dismiss\n * the sheet as well, and whether the drag handle indicator is shown.\n *\n * @default true\n */\n isInteractable?: boolean;\n /**\n * Optional boolean that indicates if the KeyboardAvoidingView is enabled.\n *\n * @default true\n */\n keyboardAvoidingViewEnabled?: boolean;\n /**\n * Optional callback that gets triggered when the sheet is closed.\n */\n onClose?: (hasPendingAction?: boolean) => void;\n /**\n * Optional callback that gets triggered when the sheet is opened.\n */\n onOpen?: (hasPendingAction?: boolean) => void;\n /**\n * Tailwind CSS classes for the dialog container.\n */\n twClassName?: string;\n} & ViewProps;\n\n/**\n * Ref handle for imperative control of the BottomSheetDialog.\n */\nexport type BottomSheetDialogRef = {\n /**\n * Imperatively close the dialog with an optional callback after animation completes.\n */\n onCloseDialog: (callback?: () => void) => void;\n /**\n * Imperatively open the dialog with an optional callback after animation completes.\n */\n onOpenDialog: (callback?: () => void) => void;\n};\n"]}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ViewProps } from "react-native/index.js";
|
|
3
|
-
import type { PanGestureHandlerProps } from "react-native-gesture-handler";
|
|
4
|
-
type BottomSheetDialogPanGestureHandlerProps = Omit<PanGestureHandlerProps, 'enabled' | 'onGestureEvent'>;
|
|
1
|
+
import type { ViewProps } from "react-native";
|
|
5
2
|
/**
|
|
6
3
|
* BottomSheetDialog component props.
|
|
7
4
|
*/
|
|
@@ -38,10 +35,6 @@ export type BottomSheetDialogProps = {
|
|
|
38
35
|
* Optional callback that gets triggered when the sheet is opened.
|
|
39
36
|
*/
|
|
40
37
|
onOpen?: (hasPendingAction?: boolean) => void;
|
|
41
|
-
/**
|
|
42
|
-
* Optional props object passed directly to the child PanGestureHandler.
|
|
43
|
-
*/
|
|
44
|
-
panGestureHandlerProps?: BottomSheetDialogPanGestureHandlerProps;
|
|
45
38
|
/**
|
|
46
39
|
* Tailwind CSS classes for the dialog container.
|
|
47
40
|
*/
|
|
@@ -60,5 +53,4 @@ export type BottomSheetDialogRef = {
|
|
|
60
53
|
*/
|
|
61
54
|
onOpenDialog: (callback?: () => void) => void;
|
|
62
55
|
};
|
|
63
|
-
export {};
|
|
64
56
|
//# sourceMappingURL=BottomSheetDialog.types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetDialog.types.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BottomSheetDialog.types.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB;AAE9C;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,gBAAgB,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,gBAAgB,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9C;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,aAAa,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAC/C;;OAEG;IACH,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CAC/C,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ViewProps } from "react-native/index.js";
|
|
3
|
-
import type { PanGestureHandlerProps } from "react-native-gesture-handler";
|
|
4
|
-
type BottomSheetDialogPanGestureHandlerProps = Omit<PanGestureHandlerProps, 'enabled' | 'onGestureEvent'>;
|
|
1
|
+
import type { ViewProps } from "react-native";
|
|
5
2
|
/**
|
|
6
3
|
* BottomSheetDialog component props.
|
|
7
4
|
*/
|
|
@@ -38,10 +35,6 @@ export type BottomSheetDialogProps = {
|
|
|
38
35
|
* Optional callback that gets triggered when the sheet is opened.
|
|
39
36
|
*/
|
|
40
37
|
onOpen?: (hasPendingAction?: boolean) => void;
|
|
41
|
-
/**
|
|
42
|
-
* Optional props object passed directly to the child PanGestureHandler.
|
|
43
|
-
*/
|
|
44
|
-
panGestureHandlerProps?: BottomSheetDialogPanGestureHandlerProps;
|
|
45
38
|
/**
|
|
46
39
|
* Tailwind CSS classes for the dialog container.
|
|
47
40
|
*/
|
|
@@ -60,5 +53,4 @@ export type BottomSheetDialogRef = {
|
|
|
60
53
|
*/
|
|
61
54
|
onOpenDialog: (callback?: () => void) => void;
|
|
62
55
|
};
|
|
63
|
-
export {};
|
|
64
56
|
//# sourceMappingURL=BottomSheetDialog.types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetDialog.types.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BottomSheetDialog.types.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB;AAE9C;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,gBAAgB,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,gBAAgB,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9C;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,aAAa,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAC/C;;OAEG;IACH,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CAC/C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetDialog.types.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.types.ts"],"names":[],"mappings":"","sourcesContent":["// Third party dependencies.\nimport type { ViewProps } from 'react-native';\
|
|
1
|
+
{"version":3,"file":"BottomSheetDialog.types.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.types.ts"],"names":[],"mappings":"","sourcesContent":["// Third party dependencies.\nimport type { ViewProps } from 'react-native';\n\n/**\n * BottomSheetDialog component props.\n */\nexport type BottomSheetDialogProps = {\n /**\n * Optional content to display inside the dialog.\n */\n children?: React.ReactNode;\n /**\n * Optional prop to toggle full screen state of BottomSheetDialog.\n *\n * @default false\n */\n isFullscreen?: boolean;\n /**\n * Optional boolean that indicates if the sheet is swippable.\n * This affects whether or not tapping on the overlay will dismiss\n * the sheet as well, and whether the drag handle indicator is shown.\n *\n * @default true\n */\n isInteractable?: boolean;\n /**\n * Optional boolean that indicates if the KeyboardAvoidingView is enabled.\n *\n * @default true\n */\n keyboardAvoidingViewEnabled?: boolean;\n /**\n * Optional callback that gets triggered when the sheet is closed.\n */\n onClose?: (hasPendingAction?: boolean) => void;\n /**\n * Optional callback that gets triggered when the sheet is opened.\n */\n onOpen?: (hasPendingAction?: boolean) => void;\n /**\n * Tailwind CSS classes for the dialog container.\n */\n twClassName?: string;\n} & ViewProps;\n\n/**\n * Ref handle for imperative control of the BottomSheetDialog.\n */\nexport type BottomSheetDialogRef = {\n /**\n * Imperatively close the dialog with an optional callback after animation completes.\n */\n onCloseDialog: (callback?: () => void) => void;\n /**\n * Imperatively open the dialog with an optional callback after animation completes.\n */\n onOpenDialog: (callback?: () => void) => void;\n};\n"]}
|
|
@@ -7,7 +7,7 @@ exports.BottomSheetFooter = void 0;
|
|
|
7
7
|
// Third party dependencies.
|
|
8
8
|
const design_system_twrnc_preset_1 = require("@metamask-previews/design-system-twrnc-preset");
|
|
9
9
|
const react_1 = __importDefault(require("react"));
|
|
10
|
-
const react_native_1 = require("react-native
|
|
10
|
+
const react_native_1 = require("react-native");
|
|
11
11
|
// External dependencies.
|
|
12
12
|
const Button_1 = require("../Button/index.cjs");
|
|
13
13
|
const BottomSheetFooter_types_1 = require("./BottomSheetFooter.types.cjs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetFooter.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetFooter/BottomSheetFooter.tsx"],"names":[],"mappings":";;;;;;AAAA,4BAA4B;AAC5B,8FAA4E;AAC5E,kDAA0B;AAC1B
|
|
1
|
+
{"version":3,"file":"BottomSheetFooter.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetFooter/BottomSheetFooter.tsx"],"names":[],"mappings":";;;;;;AAAA,4BAA4B;AAC5B,8FAA4E;AAC5E,kDAA0B;AAC1B,+CAAoC;AAEpC,yBAAyB;AACzB,gDAAkD;AAIlD,2EAA6D;A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,KAAK,CAAC,eAAe,EAAE,cAAc,IAAI,QAAQ,CAAC;gBACrD,kBAAkB,CAAC,KAAK;aACzB,CAAC,EACF,CACH,CACH;IAAA,EAAE,mBAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AAlDW,QAAA,iBAAiB,qBAkD5B","sourcesContent":["// Third party dependencies.\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\nimport { View } from 'react-native';\n\n// External dependencies.\nimport { Button, ButtonVariant } from '../Button';\n\n// Internal dependencies.\nimport type { BottomSheetFooterProps } from './BottomSheetFooter.types';\nimport { ButtonsAlignment } from './BottomSheetFooter.types';\n\nexport const BottomSheetFooter: React.FC<BottomSheetFooterProps> = ({\n style,\n twClassName,\n buttonsAlignment = ButtonsAlignment.Horizontal,\n primaryButtonProps,\n secondaryButtonProps,\n ...props\n}) => {\n const tw = useTailwind();\n const isHorizontal = buttonsAlignment === ButtonsAlignment.Horizontal;\n const buttonBaseClass = isHorizontal ? 'flex-1' : 'self-stretch';\n const gapClass = isHorizontal ? 'ml-4' : 'mt-4';\n const hasBothButtons =\n Boolean(primaryButtonProps) && Boolean(secondaryButtonProps);\n\n if (!primaryButtonProps && !secondaryButtonProps) {\n return null;\n }\n\n return (\n <View\n style={[\n tw.style(\n isHorizontal ? 'flex-row' : 'flex-col',\n 'px-2 py-1',\n twClassName,\n ),\n style,\n ]}\n {...props}\n >\n {secondaryButtonProps && (\n <Button\n {...secondaryButtonProps}\n variant={ButtonVariant.Secondary}\n style={[tw.style(buttonBaseClass), secondaryButtonProps.style]}\n />\n )}\n {primaryButtonProps && (\n <Button\n {...primaryButtonProps}\n variant={ButtonVariant.Primary}\n style={[\n tw.style(buttonBaseClass, hasBothButtons && gapClass),\n primaryButtonProps.style,\n ]}\n />\n )}\n </View>\n );\n};\n"]}
|
|
@@ -8,7 +8,7 @@ function $importDefault(module) {
|
|
|
8
8
|
import { useTailwind } from "@metamask-previews/design-system-twrnc-preset";
|
|
9
9
|
import $React from "react";
|
|
10
10
|
const React = $importDefault($React);
|
|
11
|
-
import { View } from "react-native
|
|
11
|
+
import { View } from "react-native";
|
|
12
12
|
// External dependencies.
|
|
13
13
|
import { Button, ButtonVariant } from "../Button/index.mjs";
|
|
14
14
|
import { ButtonsAlignment } from "./BottomSheetFooter.types.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetFooter.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheetFooter/BottomSheetFooter.tsx"],"names":[],"mappings":";;;;;;AAAA,4BAA4B;AAC5B,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,MAAK,cAAc;;AAC1B,OAAO,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"BottomSheetFooter.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheetFooter/BottomSheetFooter.tsx"],"names":[],"mappings":";;;;;;AAAA,4BAA4B;AAC5B,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,MAAK,cAAc;;AAC1B,OAAO,EAAE,IAAI,EAAE,qBAAqB;AAEpC,yBAAyB;AACzB,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,4BAAkB;AAIlD,OAAO,EAAE,gBAAgB,EAAE,sCAAkC;AAE7D,MAAM,CAAC,MAAM,iBAAiB,GAAqC,CAAC,EAClE,KAAK,EACL,WAAW,EACX,gBAAgB,GAAG,gBAAgB,CAAC,UAAU,EAC9C,kBAAkB,EAClB,oBAAoB,EACpB,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IACzB,MAAM,YAAY,GAAG,gBAAgB,KAAK,gBAAgB,CAAC,UAAU,CAAC;IACtE,MAAM,eAAe,GAAG,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC;IACjE,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IAChD,MAAM,cAAc,GAClB,OAAO,CAAC,kBAAkB,CAAC,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAE/D,IAAI,CAAC,kBAAkB,IAAI,CAAC,oBAAoB,EAAE;QAChD,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,CAAC,IAAI,CACH,KAAK,CAAC,CAAC;YACL,EAAE,CAAC,KAAK,CACN,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,EACtC,WAAW,EACX,WAAW,CACZ;YACD,KAAK;SACN,CAAC,CACF,IAAI,KAAK,CAAC,CAEV;MAAA,CAAC,oBAAoB,IAAI,CACvB,CAAC,MAAM,CACL,IAAI,oBAAoB,CAAC,CACzB,OAAO,CAAC,CAAC,aAAa,CAAC,SAAS,CAAC,CACjC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAC,EAC/D,CACH,CACD;MAAA,CAAC,kBAAkB,IAAI,CACrB,CAAC,MAAM,CACL,IAAI,kBAAkB,CAAC,CACvB,OAAO,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAC/B,KAAK,CAAC,CAAC;gBACL,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE,cAAc,IAAI,QAAQ,CAAC;gBACrD,kBAAkB,CAAC,KAAK;aACzB,CAAC,EACF,CACH,CACH;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Third party dependencies.\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\nimport { View } from 'react-native';\n\n// External dependencies.\nimport { Button, ButtonVariant } from '../Button';\n\n// Internal dependencies.\nimport type { BottomSheetFooterProps } from './BottomSheetFooter.types';\nimport { ButtonsAlignment } from './BottomSheetFooter.types';\n\nexport const BottomSheetFooter: React.FC<BottomSheetFooterProps> = ({\n style,\n twClassName,\n buttonsAlignment = ButtonsAlignment.Horizontal,\n primaryButtonProps,\n secondaryButtonProps,\n ...props\n}) => {\n const tw = useTailwind();\n const isHorizontal = buttonsAlignment === ButtonsAlignment.Horizontal;\n const buttonBaseClass = isHorizontal ? 'flex-1' : 'self-stretch';\n const gapClass = isHorizontal ? 'ml-4' : 'mt-4';\n const hasBothButtons =\n Boolean(primaryButtonProps) && Boolean(secondaryButtonProps);\n\n if (!primaryButtonProps && !secondaryButtonProps) {\n return null;\n }\n\n return (\n <View\n style={[\n tw.style(\n isHorizontal ? 'flex-row' : 'flex-col',\n 'px-2 py-1',\n twClassName,\n ),\n style,\n ]}\n {...props}\n >\n {secondaryButtonProps && (\n <Button\n {...secondaryButtonProps}\n variant={ButtonVariant.Secondary}\n style={[tw.style(buttonBaseClass), secondaryButtonProps.style]}\n />\n )}\n {primaryButtonProps && (\n <Button\n {...primaryButtonProps}\n variant={ButtonVariant.Primary}\n style={[\n tw.style(buttonBaseClass, hasBothButtons && gapClass),\n primaryButtonProps.style,\n ]}\n />\n )}\n </View>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetFooter.types.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheetFooter/BottomSheetFooter.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"BottomSheetFooter.types.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheetFooter/BottomSheetFooter.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB;AAG9C,OAAO,KAAK,EAAE,WAAW,EAAE,mCAA+B;AAE1D;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,UAAU,eAAe;IACzB,QAAQ,aAAa;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,4BAA4B,CAAC;IAClD;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,4BAA4B,CAAC;IACpD;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetFooter.types.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheetFooter/BottomSheetFooter.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"BottomSheetFooter.types.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheetFooter/BottomSheetFooter.types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB;AAG9C,OAAO,KAAK,EAAE,WAAW,EAAE,mCAA+B;AAE1D;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,UAAU,eAAe;IACzB,QAAQ,aAAa;CACtB;AAED;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,4BAA4B,CAAC;IAClD;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,4BAA4B,CAAC;IACpD;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,SAAS,CAAC"}
|
|
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.BottomSheetOverlay = void 0;
|
|
27
27
|
const design_system_twrnc_preset_1 = require("@metamask-previews/design-system-twrnc-preset");
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
|
-
const react_native_1 = require("react-native
|
|
29
|
+
const react_native_1 = require("react-native");
|
|
30
30
|
const BottomSheetOverlay_constants_1 = require("./BottomSheetOverlay.constants.cjs");
|
|
31
31
|
const BottomSheetOverlay = ({ style, twClassName, onPress, touchableOpacityProps, ...props }) => {
|
|
32
32
|
const tw = (0, design_system_twrnc_preset_1.useTailwind)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetOverlay.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetOverlay/BottomSheetOverlay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAA4E;AAC5E,+CAAyC;AACzC
|
|
1
|
+
{"version":3,"file":"BottomSheetOverlay.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetOverlay/BottomSheetOverlay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAA4E;AAC5E,+CAAyC;AACzC,+CAKsB;AAEtB,qFAAoF;AAG7E,MAAM,kBAAkB,GAAsC,CAAC,EACpE,KAAK,EACL,WAAW,EACX,OAAO,EACP,qBAAqB,EACrB,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IACzB,MAAM,UAAU,GAAG,IAAA,+BAAgB,EAAC,CAAC,CAAC,CAAC;IAEvC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,uBAAQ,CAAC,MAAM,CAAC,UAAU,EAAE;YAC1B,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,iEAAkC;YAC5C,MAAM,EAAE,qBAAM,CAAC,MAAM;YACrB,eAAe,EAAE,IAAI;SACtB,CAAC,CAAC,KAAK,EAAE,CAAC;IACb,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,OAAO,CACL,CAAC,uBAAQ,CAAC,IAAI,CACZ,KAAK,CAAC,CAAC;YACL,EAAE,CAAC,KAAK,CAAC,qCAAqC,EAAE,WAAW,CAAC;YAC5D,KAAK;YACL,EAAE,OAAO,EAAE,UAAU,EAAE;SACxB,CAAC,CACF,IAAI,KAAK,CAAC,CAEV;MAAA,CAAC,OAAO,IAAI,CACV,CAAC,+BAAgB,CACf,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,IAAI,qBAAqB,CAAC,CAC1B,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EAC1B,CACH,CACH;IAAA,EAAE,uBAAQ,CAAC,IAAI,CAAC,CACjB,CAAC;AACJ,CAAC,CAAC;AArCW,QAAA,kBAAkB,sBAqC7B","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, { useEffect } from 'react';\nimport {\n Animated,\n Easing,\n TouchableOpacity,\n useAnimatedValue,\n} from 'react-native';\n\nimport { DEFAULT_OVERLAY_ANIMATION_DURATION } from './BottomSheetOverlay.constants';\nimport { BottomSheetOverlayProps } from './BottomSheetOverlay.types';\n\nexport const BottomSheetOverlay: React.FC<BottomSheetOverlayProps> = ({\n style,\n twClassName,\n onPress,\n touchableOpacityProps,\n ...props\n}) => {\n const tw = useTailwind();\n const opacityVal = useAnimatedValue(0);\n\n useEffect(() => {\n Animated.timing(opacityVal, {\n toValue: 1,\n duration: DEFAULT_OVERLAY_ANIMATION_DURATION,\n easing: Easing.linear,\n useNativeDriver: true,\n }).start();\n }, [opacityVal]);\n\n return (\n <Animated.View\n style={[\n tw.style('absolute inset-0 bg-overlay-default', twClassName),\n style,\n { opacity: opacityVal },\n ]}\n {...props}\n >\n {onPress && (\n <TouchableOpacity\n onPress={onPress}\n {...touchableOpacityProps}\n style={tw.style('flex-1')}\n />\n )}\n </Animated.View>\n );\n};\n"]}
|
|
@@ -7,7 +7,7 @@ function $importDefault(module) {
|
|
|
7
7
|
import { useTailwind } from "@metamask-previews/design-system-twrnc-preset";
|
|
8
8
|
import $React, { useEffect } from "react";
|
|
9
9
|
const React = $importDefault($React);
|
|
10
|
-
import { Animated, Easing, TouchableOpacity, useAnimatedValue } from "react-native
|
|
10
|
+
import { Animated, Easing, TouchableOpacity, useAnimatedValue } from "react-native";
|
|
11
11
|
import { DEFAULT_OVERLAY_ANIMATION_DURATION } from "./BottomSheetOverlay.constants.mjs";
|
|
12
12
|
export const BottomSheetOverlay = ({ style, twClassName, onPress, touchableOpacityProps, ...props }) => {
|
|
13
13
|
const tw = useTailwind();
|