@metamask-previews/design-system-react-native 0.22.0-preview.f515a62 → 0.24.0-preview.178e60f
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 +36 -1
- package/dist/components/AvatarGroup/AvatarGroup.cjs +11 -12
- package/dist/components/AvatarGroup/AvatarGroup.cjs.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.constants.cjs +11 -12
- package/dist/components/AvatarGroup/AvatarGroup.constants.cjs.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.constants.d.cts +1 -2
- package/dist/components/AvatarGroup/AvatarGroup.constants.d.cts.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.constants.d.mts +1 -2
- package/dist/components/AvatarGroup/AvatarGroup.constants.d.mts.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.constants.mjs +1 -2
- package/dist/components/AvatarGroup/AvatarGroup.constants.mjs.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.d.cts.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.d.mts.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.mjs +2 -3
- package/dist/components/AvatarGroup/AvatarGroup.mjs.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.types.cjs.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.types.d.cts +7 -24
- package/dist/components/AvatarGroup/AvatarGroup.types.d.cts.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.types.d.mts +7 -24
- package/dist/components/AvatarGroup/AvatarGroup.types.d.mts.map +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.types.mjs.map +1 -1
- package/dist/components/AvatarGroup/index.cjs +3 -3
- package/dist/components/AvatarGroup/index.cjs.map +1 -1
- package/dist/components/AvatarGroup/index.d.cts +1 -1
- package/dist/components/AvatarGroup/index.d.cts.map +1 -1
- package/dist/components/AvatarGroup/index.d.mts +1 -1
- package/dist/components/AvatarGroup/index.d.mts.map +1 -1
- package/dist/components/AvatarGroup/index.mjs +1 -1
- package/dist/components/AvatarGroup/index.mjs.map +1 -1
- package/dist/components/AvatarIcon/AvatarIcon.cjs +1 -2
- package/dist/components/AvatarIcon/AvatarIcon.cjs.map +1 -1
- package/dist/components/AvatarIcon/AvatarIcon.constants.cjs +10 -11
- package/dist/components/AvatarIcon/AvatarIcon.constants.cjs.map +1 -1
- package/dist/components/AvatarIcon/AvatarIcon.constants.d.cts +1 -2
- package/dist/components/AvatarIcon/AvatarIcon.constants.d.cts.map +1 -1
- package/dist/components/AvatarIcon/AvatarIcon.constants.d.mts +1 -2
- package/dist/components/AvatarIcon/AvatarIcon.constants.d.mts.map +1 -1
- package/dist/components/AvatarIcon/AvatarIcon.constants.mjs +1 -2
- package/dist/components/AvatarIcon/AvatarIcon.constants.mjs.map +1 -1
- package/dist/components/AvatarIcon/AvatarIcon.d.cts.map +1 -1
- package/dist/components/AvatarIcon/AvatarIcon.d.mts.map +1 -1
- package/dist/components/AvatarIcon/AvatarIcon.mjs +1 -2
- package/dist/components/AvatarIcon/AvatarIcon.mjs.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.cjs +1 -2
- package/dist/components/BannerAlert/BannerAlert.cjs.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.constants.cjs +8 -9
- package/dist/components/BannerAlert/BannerAlert.constants.cjs.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.constants.d.cts +1 -2
- package/dist/components/BannerAlert/BannerAlert.constants.d.cts.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.constants.d.mts +1 -2
- package/dist/components/BannerAlert/BannerAlert.constants.d.mts.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.constants.mjs +1 -2
- package/dist/components/BannerAlert/BannerAlert.constants.mjs.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.d.cts.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.d.mts.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.mjs +1 -2
- package/dist/components/BannerAlert/BannerAlert.mjs.map +1 -1
- package/dist/components/BannerBase/BannerBase.cjs +3 -12
- package/dist/components/BannerBase/BannerBase.cjs.map +1 -1
- package/dist/components/BannerBase/BannerBase.d.cts.map +1 -1
- package/dist/components/BannerBase/BannerBase.d.mts.map +1 -1
- package/dist/components/BannerBase/BannerBase.mjs +3 -12
- package/dist/components/BannerBase/BannerBase.mjs.map +1 -1
- package/dist/components/BannerBase/BannerBase.types.cjs.map +1 -1
- package/dist/components/BannerBase/BannerBase.types.d.cts +2 -7
- package/dist/components/BannerBase/BannerBase.types.d.cts.map +1 -1
- package/dist/components/BannerBase/BannerBase.types.d.mts +2 -7
- package/dist/components/BannerBase/BannerBase.types.d.mts.map +1 -1
- package/dist/components/BannerBase/BannerBase.types.mjs.map +1 -1
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.cjs +1 -17
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.cjs.map +1 -1
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.d.cts.map +1 -1
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.d.mts.map +1 -1
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.mjs +1 -17
- package/dist/components/Button/variants/ButtonPrimary/ButtonPrimary.mjs.map +1 -1
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.cjs +1 -17
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.cjs.map +1 -1
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.d.cts.map +1 -1
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.d.mts.map +1 -1
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.mjs +1 -17
- package/dist/components/Button/variants/ButtonSecondary/ButtonSecondary.mjs.map +1 -1
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.cjs +1 -17
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.cjs.map +1 -1
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.d.cts.map +1 -1
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.d.mts.map +1 -1
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.mjs +1 -17
- package/dist/components/Button/variants/ButtonTertiary/ButtonTertiary.mjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.cjs +42 -28
- package/dist/components/ButtonBase/ButtonBase.cjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.constants.cjs +31 -1
- package/dist/components/ButtonBase/ButtonBase.constants.cjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.constants.d.cts +6 -1
- package/dist/components/ButtonBase/ButtonBase.constants.d.cts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.constants.d.mts +6 -1
- package/dist/components/ButtonBase/ButtonBase.constants.d.mts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.constants.mjs +29 -1
- package/dist/components/ButtonBase/ButtonBase.constants.mjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.d.cts +1 -1
- package/dist/components/ButtonBase/ButtonBase.d.cts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.d.mts +1 -1
- package/dist/components/ButtonBase/ButtonBase.d.mts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.mjs +45 -31
- package/dist/components/ButtonBase/ButtonBase.mjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.types.cjs.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.types.d.cts +12 -0
- package/dist/components/ButtonBase/ButtonBase.types.d.cts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.types.d.mts +12 -0
- package/dist/components/ButtonBase/ButtonBase.types.d.mts.map +1 -1
- package/dist/components/ButtonBase/ButtonBase.types.mjs.map +1 -1
- package/dist/components/ButtonSemantic/ButtonSemantic.cjs +1 -17
- package/dist/components/ButtonSemantic/ButtonSemantic.cjs.map +1 -1
- package/dist/components/ButtonSemantic/ButtonSemantic.d.cts.map +1 -1
- package/dist/components/ButtonSemantic/ButtonSemantic.d.mts.map +1 -1
- package/dist/components/ButtonSemantic/ButtonSemantic.mjs +1 -17
- package/dist/components/ButtonSemantic/ButtonSemantic.mjs.map +1 -1
- package/dist/components/HeaderStandard/HeaderStandard.cjs +2 -26
- package/dist/components/HeaderStandard/HeaderStandard.cjs.map +1 -1
- package/dist/components/HeaderStandard/HeaderStandard.d.cts.map +1 -1
- package/dist/components/HeaderStandard/HeaderStandard.d.mts.map +1 -1
- package/dist/components/HeaderStandard/HeaderStandard.mjs +2 -26
- package/dist/components/HeaderStandard/HeaderStandard.mjs.map +1 -1
- package/dist/components/HeaderStandard/HeaderStandard.types.cjs +0 -5
- package/dist/components/HeaderStandard/HeaderStandard.types.cjs.map +1 -1
- package/dist/components/HeaderStandard/HeaderStandard.types.d.cts +2 -28
- package/dist/components/HeaderStandard/HeaderStandard.types.d.cts.map +1 -1
- package/dist/components/HeaderStandard/HeaderStandard.types.d.mts +2 -28
- package/dist/components/HeaderStandard/HeaderStandard.types.d.mts.map +1 -1
- package/dist/components/HeaderStandard/HeaderStandard.types.mjs +1 -9
- package/dist/components/HeaderStandard/HeaderStandard.types.mjs.map +1 -1
- package/dist/components/HeaderStandardAnimated/HeaderStandardAnimated.cjs +63 -0
- package/dist/components/HeaderStandardAnimated/HeaderStandardAnimated.cjs.map +1 -0
- package/dist/components/HeaderStandardAnimated/HeaderStandardAnimated.d.cts +4 -0
- package/dist/components/HeaderStandardAnimated/HeaderStandardAnimated.d.cts.map +1 -0
- package/dist/components/HeaderStandardAnimated/HeaderStandardAnimated.d.mts +4 -0
- package/dist/components/HeaderStandardAnimated/HeaderStandardAnimated.d.mts.map +1 -0
- package/dist/components/HeaderStandardAnimated/HeaderStandardAnimated.mjs +40 -0
- package/dist/components/HeaderStandardAnimated/HeaderStandardAnimated.mjs.map +1 -0
- package/dist/components/HeaderStandardAnimated/HeaderStandardAnimated.types.cjs +3 -0
- package/dist/components/HeaderStandardAnimated/HeaderStandardAnimated.types.cjs.map +1 -0
- package/dist/components/HeaderStandardAnimated/HeaderStandardAnimated.types.d.cts +31 -0
- package/dist/components/HeaderStandardAnimated/HeaderStandardAnimated.types.d.cts.map +1 -0
- package/dist/components/HeaderStandardAnimated/HeaderStandardAnimated.types.d.mts +31 -0
- package/dist/components/HeaderStandardAnimated/HeaderStandardAnimated.types.d.mts.map +1 -0
- package/dist/components/HeaderStandardAnimated/HeaderStandardAnimated.types.mjs +2 -0
- package/dist/components/HeaderStandardAnimated/HeaderStandardAnimated.types.mjs.map +1 -0
- package/dist/components/HeaderStandardAnimated/index.cjs +8 -0
- package/dist/components/HeaderStandardAnimated/index.cjs.map +1 -0
- package/dist/components/HeaderStandardAnimated/index.d.cts +4 -0
- package/dist/components/HeaderStandardAnimated/index.d.cts.map +1 -0
- package/dist/components/HeaderStandardAnimated/index.d.mts +4 -0
- package/dist/components/HeaderStandardAnimated/index.d.mts.map +1 -0
- package/dist/components/HeaderStandardAnimated/index.mjs +3 -0
- package/dist/components/HeaderStandardAnimated/index.mjs.map +1 -0
- package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.cjs +62 -0
- package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.cjs.map +1 -0
- package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.d.cts +39 -0
- package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.d.cts.map +1 -0
- package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.d.mts +39 -0
- package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.d.mts.map +1 -0
- package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.mjs +57 -0
- package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.mjs.map +1 -0
- package/dist/components/Icon/Icon.assets.cjs +14 -0
- package/dist/components/Icon/Icon.assets.cjs.map +1 -1
- package/dist/components/Icon/Icon.assets.d.cts.map +1 -1
- package/dist/components/Icon/Icon.assets.d.mts.map +1 -1
- package/dist/components/Icon/Icon.assets.mjs +14 -0
- package/dist/components/Icon/Icon.assets.mjs.map +1 -1
- package/dist/components/Icon/Icon.cjs +2 -2
- package/dist/components/Icon/Icon.cjs.map +1 -1
- package/dist/components/Icon/Icon.d.cts.map +1 -1
- package/dist/components/Icon/Icon.d.mts.map +1 -1
- package/dist/components/Icon/Icon.mjs +1 -1
- package/dist/components/Icon/Icon.mjs.map +1 -1
- package/dist/components/Icon/assets/candlestick.svg +1 -1
- package/dist/components/Icon/assets/group.svg +1 -0
- package/dist/components/Icon/assets/list-arrow.svg +1 -0
- package/dist/components/Icon/assets/merge.svg +1 -0
- package/dist/components/Icon/assets/musd-filled.svg +1 -0
- package/dist/components/Icon/assets/musd.svg +1 -0
- package/dist/components/Icon/assets/pie-chart.svg +1 -0
- package/dist/components/Icon/assets/predictions.svg +1 -0
- package/dist/components/Icon/index.cjs +4 -4
- package/dist/components/Icon/index.cjs.map +1 -1
- package/dist/components/Icon/index.d.cts +1 -1
- package/dist/components/Icon/index.d.cts.map +1 -1
- package/dist/components/Icon/index.d.mts +1 -1
- package/dist/components/Icon/index.d.mts.map +1 -1
- package/dist/components/Icon/index.mjs +1 -1
- package/dist/components/Icon/index.mjs.map +1 -1
- package/dist/components/IconAlert/IconAlert.constants.cjs +8 -9
- package/dist/components/IconAlert/IconAlert.constants.cjs.map +1 -1
- package/dist/components/IconAlert/IconAlert.constants.d.cts +1 -2
- package/dist/components/IconAlert/IconAlert.constants.d.cts.map +1 -1
- package/dist/components/IconAlert/IconAlert.constants.d.mts +1 -2
- package/dist/components/IconAlert/IconAlert.constants.d.mts.map +1 -1
- package/dist/components/IconAlert/IconAlert.constants.mjs +1 -2
- package/dist/components/IconAlert/IconAlert.constants.mjs.map +1 -1
- package/dist/components/Input/Input.cjs +35 -25
- package/dist/components/Input/Input.cjs.map +1 -1
- package/dist/components/Input/Input.d.cts +1 -7
- package/dist/components/Input/Input.d.cts.map +1 -1
- package/dist/components/Input/Input.d.mts +1 -7
- package/dist/components/Input/Input.d.mts.map +1 -1
- package/dist/components/Input/Input.mjs +36 -26
- package/dist/components/Input/Input.mjs.map +1 -1
- package/dist/components/Input/Input.types.cjs.map +1 -1
- package/dist/components/Input/Input.types.d.cts +2 -30
- package/dist/components/Input/Input.types.d.cts.map +1 -1
- package/dist/components/Input/Input.types.d.mts +2 -30
- package/dist/components/Input/Input.types.d.mts.map +1 -1
- package/dist/components/Input/Input.types.mjs.map +1 -1
- package/dist/components/Tag/Tag.constants.cjs +5 -6
- package/dist/components/Tag/Tag.constants.cjs.map +1 -1
- package/dist/components/Tag/Tag.constants.d.cts +1 -2
- package/dist/components/Tag/Tag.constants.d.cts.map +1 -1
- package/dist/components/Tag/Tag.constants.d.mts +1 -2
- package/dist/components/Tag/Tag.constants.d.mts.map +1 -1
- package/dist/components/Tag/Tag.constants.mjs +1 -2
- package/dist/components/Tag/Tag.constants.mjs.map +1 -1
- package/dist/components/TextArea/TextArea.cjs +38 -0
- package/dist/components/TextArea/TextArea.cjs.map +1 -0
- package/dist/components/TextArea/TextArea.d.cts +166 -0
- package/dist/components/TextArea/TextArea.d.cts.map +1 -0
- package/dist/components/TextArea/TextArea.d.mts +166 -0
- package/dist/components/TextArea/TextArea.d.mts.map +1 -0
- package/dist/components/TextArea/TextArea.mjs +35 -0
- package/dist/components/TextArea/TextArea.mjs.map +1 -0
- package/dist/components/TextArea/TextArea.types.cjs +3 -0
- package/dist/components/TextArea/TextArea.types.cjs.map +1 -0
- package/dist/components/TextArea/TextArea.types.d.cts +63 -0
- package/dist/components/TextArea/TextArea.types.d.cts.map +1 -0
- package/dist/components/TextArea/TextArea.types.d.mts +63 -0
- package/dist/components/TextArea/TextArea.types.d.mts.map +1 -0
- package/dist/components/TextArea/TextArea.types.mjs +2 -0
- package/dist/components/TextArea/TextArea.types.mjs.map +1 -0
- package/dist/components/TextArea/index.cjs +6 -0
- package/dist/components/TextArea/index.cjs.map +1 -0
- package/dist/components/TextArea/index.d.cts +3 -0
- package/dist/components/TextArea/index.d.cts.map +1 -0
- package/dist/components/TextArea/index.d.mts +3 -0
- package/dist/components/TextArea/index.d.mts.map +1 -0
- package/dist/components/TextArea/index.mjs +2 -0
- package/dist/components/TextArea/index.mjs.map +1 -0
- package/dist/components/TextField/TextField.cjs +1 -2
- package/dist/components/TextField/TextField.cjs.map +1 -1
- package/dist/components/TextField/TextField.d.cts +8 -2
- package/dist/components/TextField/TextField.d.cts.map +1 -1
- package/dist/components/TextField/TextField.d.mts +8 -2
- package/dist/components/TextField/TextField.d.mts.map +1 -1
- package/dist/components/TextField/TextField.mjs +1 -2
- package/dist/components/TextField/TextField.mjs.map +1 -1
- package/dist/components/TextField/TextField.types.cjs.map +1 -1
- package/dist/components/TextField/TextField.types.d.cts +5 -1
- package/dist/components/TextField/TextField.types.d.cts.map +1 -1
- package/dist/components/TextField/TextField.types.d.mts +5 -1
- package/dist/components/TextField/TextField.types.d.mts.map +1 -1
- package/dist/components/TextField/TextField.types.mjs.map +1 -1
- package/dist/components/TextFieldSearch/TextFieldSearch.d.cts +8 -2
- package/dist/components/TextFieldSearch/TextFieldSearch.d.cts.map +1 -1
- package/dist/components/TextFieldSearch/TextFieldSearch.d.mts +8 -2
- package/dist/components/TextFieldSearch/TextFieldSearch.d.mts.map +1 -1
- package/dist/components/Toast/Toast.cjs +43 -52
- package/dist/components/Toast/Toast.cjs.map +1 -1
- package/dist/components/Toast/Toast.constants.cjs +8 -1
- package/dist/components/Toast/Toast.constants.cjs.map +1 -1
- package/dist/components/Toast/Toast.constants.d.cts +5 -0
- package/dist/components/Toast/Toast.constants.d.cts.map +1 -1
- package/dist/components/Toast/Toast.constants.d.mts +5 -0
- package/dist/components/Toast/Toast.constants.d.mts.map +1 -1
- package/dist/components/Toast/Toast.constants.mjs +7 -0
- package/dist/components/Toast/Toast.constants.mjs.map +1 -1
- package/dist/components/Toast/Toast.d.cts +2 -17
- package/dist/components/Toast/Toast.d.cts.map +1 -1
- package/dist/components/Toast/Toast.d.mts +2 -17
- package/dist/components/Toast/Toast.d.mts.map +1 -1
- package/dist/components/Toast/Toast.mjs +40 -30
- package/dist/components/Toast/Toast.mjs.map +1 -1
- package/dist/components/Toast/Toast.types.cjs +9 -14
- package/dist/components/Toast/Toast.types.cjs.map +1 -1
- package/dist/components/Toast/Toast.types.d.cts +29 -91
- package/dist/components/Toast/Toast.types.d.cts.map +1 -1
- package/dist/components/Toast/Toast.types.d.mts +29 -91
- package/dist/components/Toast/Toast.types.d.mts.map +1 -1
- package/dist/components/Toast/Toast.types.mjs +8 -13
- package/dist/components/Toast/Toast.types.mjs.map +1 -1
- package/dist/components/Toast/Toaster.cjs +142 -0
- package/dist/components/Toast/Toaster.cjs.map +1 -0
- package/dist/components/Toast/Toaster.d.cts +11 -0
- package/dist/components/Toast/Toaster.d.cts.map +1 -0
- package/dist/components/Toast/Toaster.d.mts +11 -0
- package/dist/components/Toast/Toaster.d.mts.map +1 -0
- package/dist/components/Toast/Toaster.mjs +123 -0
- package/dist/components/Toast/Toaster.mjs.map +1 -0
- package/dist/components/Toast/index.cjs +5 -3
- package/dist/components/Toast/index.cjs.map +1 -1
- package/dist/components/Toast/index.d.cts +3 -2
- package/dist/components/Toast/index.d.cts.map +1 -1
- package/dist/components/Toast/index.d.mts +3 -2
- package/dist/components/Toast/index.d.mts.map +1 -1
- package/dist/components/Toast/index.mjs +2 -1
- package/dist/components/Toast/index.mjs.map +1 -1
- package/dist/components/index.cjs +12 -4
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +8 -2
- package/dist/components/index.d.cts.map +1 -1
- package/dist/components/index.d.mts +8 -2
- package/dist/components/index.d.mts.map +1 -1
- package/dist/components/index.mjs +4 -1
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.cjs +36 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.cjs.map +1 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.d.cts +4 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.d.cts.map +1 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.d.mts +4 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.d.mts.map +1 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.mjs +36 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.mjs.map +1 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.types.cjs +8 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.types.cjs.map +1 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.types.d.cts +39 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.types.d.cts.map +1 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.types.d.mts +39 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.types.d.mts.map +1 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.types.mjs +10 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/HeaderStandardCenterColumn.types.mjs.map +1 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/index.cjs +6 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/index.cjs.map +1 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/index.d.cts +3 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/index.d.cts.map +1 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/index.d.mts +3 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/index.d.mts.map +1 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/index.mjs +2 -0
- package/dist/components/temp-components/HeaderStandardCenterColumn/index.mjs.map +1 -0
- package/dist/types/index.cjs +3 -15
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +0 -10
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.mts +0 -10
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs +0 -11
- package/dist/types/index.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/components/Toast/ToastView.cjs +0 -174
- package/dist/components/Toast/ToastView.cjs.map +0 -1
- package/dist/components/Toast/ToastView.d.cts +0 -7
- package/dist/components/Toast/ToastView.d.cts.map +0 -1
- package/dist/components/Toast/ToastView.d.mts +0 -7
- package/dist/components/Toast/ToastView.d.mts.map +0 -1
- package/dist/components/Toast/ToastView.mjs +0 -155
- package/dist/components/Toast/ToastView.mjs.map +0 -1
|
@@ -1,10 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION = void 0;
|
|
3
|
+
exports.getButtonBaseHorizontalPaddingTwClasses = exports.getButtonBaseBorderRadiusTwClass = exports.MAP_BUTTONBASE_SIZE_TEXT_VARIANT = exports.MAP_BUTTONBASE_SIZE_ICONSIZE = exports.TWCLASSMAP_BUTTONBASE_BORDER_RADIUS = exports.TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION = void 0;
|
|
4
4
|
const design_system_shared_1 = require("@metamask-previews/design-system-shared");
|
|
5
5
|
exports.TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION = {
|
|
6
6
|
[design_system_shared_1.ButtonBaseSize.Sm]: 'h-8',
|
|
7
7
|
[design_system_shared_1.ButtonBaseSize.Md]: 'h-10',
|
|
8
8
|
[design_system_shared_1.ButtonBaseSize.Lg]: 'h-12', // size (48px).
|
|
9
9
|
};
|
|
10
|
+
exports.TWCLASSMAP_BUTTONBASE_BORDER_RADIUS = {
|
|
11
|
+
[design_system_shared_1.ButtonBaseSize.Sm]: 'rounded-lg',
|
|
12
|
+
[design_system_shared_1.ButtonBaseSize.Md]: 'rounded-xl',
|
|
13
|
+
[design_system_shared_1.ButtonBaseSize.Lg]: 'rounded-xl', // 12px.
|
|
14
|
+
};
|
|
15
|
+
exports.MAP_BUTTONBASE_SIZE_ICONSIZE = {
|
|
16
|
+
[design_system_shared_1.ButtonBaseSize.Sm]: design_system_shared_1.IconSize.Sm,
|
|
17
|
+
[design_system_shared_1.ButtonBaseSize.Md]: design_system_shared_1.IconSize.Sm,
|
|
18
|
+
[design_system_shared_1.ButtonBaseSize.Lg]: design_system_shared_1.IconSize.Md,
|
|
19
|
+
};
|
|
20
|
+
exports.MAP_BUTTONBASE_SIZE_TEXT_VARIANT = {
|
|
21
|
+
[design_system_shared_1.ButtonBaseSize.Sm]: design_system_shared_1.TextVariant.BodySm,
|
|
22
|
+
[design_system_shared_1.ButtonBaseSize.Md]: design_system_shared_1.TextVariant.BodyMd,
|
|
23
|
+
[design_system_shared_1.ButtonBaseSize.Lg]: design_system_shared_1.TextVariant.BodyMd,
|
|
24
|
+
};
|
|
25
|
+
const getButtonBaseBorderRadiusTwClass = (size) => exports.TWCLASSMAP_BUTTONBASE_BORDER_RADIUS[size];
|
|
26
|
+
exports.getButtonBaseBorderRadiusTwClass = getButtonBaseBorderRadiusTwClass;
|
|
27
|
+
const getButtonBaseHorizontalPaddingTwClasses = (buttonSize, hasStart, hasEnd) => {
|
|
28
|
+
if (buttonSize !== design_system_shared_1.ButtonBaseSize.Lg || (hasStart && hasEnd)) {
|
|
29
|
+
return 'px-3';
|
|
30
|
+
}
|
|
31
|
+
if (!hasStart && !hasEnd) {
|
|
32
|
+
return 'px-4';
|
|
33
|
+
}
|
|
34
|
+
if (hasStart) {
|
|
35
|
+
return 'pl-3 pr-4';
|
|
36
|
+
}
|
|
37
|
+
return 'pl-4 pr-3';
|
|
38
|
+
};
|
|
39
|
+
exports.getButtonBaseHorizontalPaddingTwClasses = getButtonBaseHorizontalPaddingTwClasses;
|
|
10
40
|
//# sourceMappingURL=ButtonBase.constants.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.constants.cjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.constants.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"ButtonBase.constants.cjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.constants.ts"],"names":[],"mappings":";;;AAAA,kFAIiD;AAEpC,QAAA,oCAAoC,GAG7C;IACF,CAAC,qCAAc,CAAC,EAAE,CAAC,EAAE,KAAK;IAC1B,CAAC,qCAAc,CAAC,EAAE,CAAC,EAAE,MAAM;IAC3B,CAAC,qCAAc,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,eAAe;CAC7C,CAAC;AAEW,QAAA,mCAAmC,GAG5C;IACF,CAAC,qCAAc,CAAC,EAAE,CAAC,EAAE,YAAY;IACjC,CAAC,qCAAc,CAAC,EAAE,CAAC,EAAE,YAAY;IACjC,CAAC,qCAAc,CAAC,EAAE,CAAC,EAAE,YAAY,EAAE,QAAQ;CAC5C,CAAC;AAEW,QAAA,4BAA4B,GAAqC;IAC5E,CAAC,qCAAc,CAAC,EAAE,CAAC,EAAE,+BAAQ,CAAC,EAAE;IAChC,CAAC,qCAAc,CAAC,EAAE,CAAC,EAAE,+BAAQ,CAAC,EAAE;IAChC,CAAC,qCAAc,CAAC,EAAE,CAAC,EAAE,+BAAQ,CAAC,EAAE;CACjC,CAAC;AAEW,QAAA,gCAAgC,GAGzC;IACF,CAAC,qCAAc,CAAC,EAAE,CAAC,EAAE,kCAAW,CAAC,MAAM;IACvC,CAAC,qCAAc,CAAC,EAAE,CAAC,EAAE,kCAAW,CAAC,MAAM;IACvC,CAAC,qCAAc,CAAC,EAAE,CAAC,EAAE,kCAAW,CAAC,MAAM;CACxC,CAAC;AAEK,MAAM,gCAAgC,GAAG,CAC9C,IAAoB,EACZ,EAAE,CAAC,2CAAmC,CAAC,IAAI,CAAC,CAAC;AAF1C,QAAA,gCAAgC,oCAEU;AAEhD,MAAM,uCAAuC,GAAG,CACrD,UAA0B,EAC1B,QAAiB,EACjB,MAAe,EACP,EAAE;IACV,IAAI,UAAU,KAAK,qCAAc,CAAC,EAAE,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,EAAE;QAC5D,OAAO,MAAM,CAAC;KACf;IACD,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM,EAAE;QACxB,OAAO,MAAM,CAAC;KACf;IACD,IAAI,QAAQ,EAAE;QACZ,OAAO,WAAW,CAAC;KACpB;IACD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAfW,QAAA,uCAAuC,2CAelD","sourcesContent":["import {\n ButtonBaseSize,\n IconSize,\n TextVariant,\n} from '@metamask-previews/design-system-shared';\n\nexport const TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION: Record<\n ButtonBaseSize,\n string\n> = {\n [ButtonBaseSize.Sm]: 'h-8', // size (32px).\n [ButtonBaseSize.Md]: 'h-10', // size (40px).\n [ButtonBaseSize.Lg]: 'h-12', // size (48px).\n};\n\nexport const TWCLASSMAP_BUTTONBASE_BORDER_RADIUS: Record<\n ButtonBaseSize,\n string\n> = {\n [ButtonBaseSize.Sm]: 'rounded-lg', // 8px.\n [ButtonBaseSize.Md]: 'rounded-xl', // 12px.\n [ButtonBaseSize.Lg]: 'rounded-xl', // 12px.\n};\n\nexport const MAP_BUTTONBASE_SIZE_ICONSIZE: Record<ButtonBaseSize, IconSize> = {\n [ButtonBaseSize.Sm]: IconSize.Sm,\n [ButtonBaseSize.Md]: IconSize.Sm,\n [ButtonBaseSize.Lg]: IconSize.Md,\n};\n\nexport const MAP_BUTTONBASE_SIZE_TEXT_VARIANT: Record<\n ButtonBaseSize,\n TextVariant\n> = {\n [ButtonBaseSize.Sm]: TextVariant.BodySm,\n [ButtonBaseSize.Md]: TextVariant.BodyMd,\n [ButtonBaseSize.Lg]: TextVariant.BodyMd,\n};\n\nexport const getButtonBaseBorderRadiusTwClass = (\n size: ButtonBaseSize,\n): string => TWCLASSMAP_BUTTONBASE_BORDER_RADIUS[size];\n\nexport const getButtonBaseHorizontalPaddingTwClasses = (\n buttonSize: ButtonBaseSize,\n hasStart: boolean,\n hasEnd: boolean,\n): string => {\n if (buttonSize !== ButtonBaseSize.Lg || (hasStart && hasEnd)) {\n return 'px-3';\n }\n if (!hasStart && !hasEnd) {\n return 'px-4';\n }\n if (hasStart) {\n return 'pl-3 pr-4';\n }\n return 'pl-4 pr-3';\n};\n"]}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import { ButtonBaseSize } from "@metamask-previews/design-system-shared";
|
|
1
|
+
import { ButtonBaseSize, IconSize, TextVariant } from "@metamask-previews/design-system-shared";
|
|
2
2
|
export declare const TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION: Record<ButtonBaseSize, string>;
|
|
3
|
+
export declare const TWCLASSMAP_BUTTONBASE_BORDER_RADIUS: Record<ButtonBaseSize, string>;
|
|
4
|
+
export declare const MAP_BUTTONBASE_SIZE_ICONSIZE: Record<ButtonBaseSize, IconSize>;
|
|
5
|
+
export declare const MAP_BUTTONBASE_SIZE_TEXT_VARIANT: Record<ButtonBaseSize, TextVariant>;
|
|
6
|
+
export declare const getButtonBaseBorderRadiusTwClass: (size: ButtonBaseSize) => string;
|
|
7
|
+
export declare const getButtonBaseHorizontalPaddingTwClasses: (buttonSize: ButtonBaseSize, hasStart: boolean, hasEnd: boolean) => string;
|
|
3
8
|
//# sourceMappingURL=ButtonBase.constants.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.constants.d.cts","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.constants.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ButtonBase.constants.d.cts","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,QAAQ,EACR,WAAW,EACZ,gDAAgD;AAEjD,eAAO,MAAM,oCAAoC,EAAE,MAAM,CACvD,cAAc,EACd,MAAM,CAKP,CAAC;AAEF,eAAO,MAAM,mCAAmC,EAAE,MAAM,CACtD,cAAc,EACd,MAAM,CAKP,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,cAAc,EAAE,QAAQ,CAIzE,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,MAAM,CACnD,cAAc,EACd,WAAW,CAKZ,CAAC;AAEF,eAAO,MAAM,gCAAgC,SACrC,cAAc,KACnB,MAAmD,CAAC;AAEvD,eAAO,MAAM,uCAAuC,eACtC,cAAc,YAChB,OAAO,UACT,OAAO,KACd,MAWF,CAAC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import { ButtonBaseSize } from "@metamask-previews/design-system-shared";
|
|
1
|
+
import { ButtonBaseSize, IconSize, TextVariant } from "@metamask-previews/design-system-shared";
|
|
2
2
|
export declare const TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION: Record<ButtonBaseSize, string>;
|
|
3
|
+
export declare const TWCLASSMAP_BUTTONBASE_BORDER_RADIUS: Record<ButtonBaseSize, string>;
|
|
4
|
+
export declare const MAP_BUTTONBASE_SIZE_ICONSIZE: Record<ButtonBaseSize, IconSize>;
|
|
5
|
+
export declare const MAP_BUTTONBASE_SIZE_TEXT_VARIANT: Record<ButtonBaseSize, TextVariant>;
|
|
6
|
+
export declare const getButtonBaseBorderRadiusTwClass: (size: ButtonBaseSize) => string;
|
|
7
|
+
export declare const getButtonBaseHorizontalPaddingTwClasses: (buttonSize: ButtonBaseSize, hasStart: boolean, hasEnd: boolean) => string;
|
|
3
8
|
//# sourceMappingURL=ButtonBase.constants.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.constants.d.mts","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.constants.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ButtonBase.constants.d.mts","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,QAAQ,EACR,WAAW,EACZ,gDAAgD;AAEjD,eAAO,MAAM,oCAAoC,EAAE,MAAM,CACvD,cAAc,EACd,MAAM,CAKP,CAAC;AAEF,eAAO,MAAM,mCAAmC,EAAE,MAAM,CACtD,cAAc,EACd,MAAM,CAKP,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,cAAc,EAAE,QAAQ,CAIzE,CAAC;AAEF,eAAO,MAAM,gCAAgC,EAAE,MAAM,CACnD,cAAc,EACd,WAAW,CAKZ,CAAC;AAEF,eAAO,MAAM,gCAAgC,SACrC,cAAc,KACnB,MAAmD,CAAC;AAEvD,eAAO,MAAM,uCAAuC,eACtC,cAAc,YAChB,OAAO,UACT,OAAO,KACd,MAWF,CAAC"}
|
|
@@ -1,7 +1,35 @@
|
|
|
1
|
-
import { ButtonBaseSize } from "@metamask-previews/design-system-shared";
|
|
1
|
+
import { ButtonBaseSize, IconSize, TextVariant } from "@metamask-previews/design-system-shared";
|
|
2
2
|
export const TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION = {
|
|
3
3
|
[ButtonBaseSize.Sm]: 'h-8',
|
|
4
4
|
[ButtonBaseSize.Md]: 'h-10',
|
|
5
5
|
[ButtonBaseSize.Lg]: 'h-12', // size (48px).
|
|
6
6
|
};
|
|
7
|
+
export const TWCLASSMAP_BUTTONBASE_BORDER_RADIUS = {
|
|
8
|
+
[ButtonBaseSize.Sm]: 'rounded-lg',
|
|
9
|
+
[ButtonBaseSize.Md]: 'rounded-xl',
|
|
10
|
+
[ButtonBaseSize.Lg]: 'rounded-xl', // 12px.
|
|
11
|
+
};
|
|
12
|
+
export const MAP_BUTTONBASE_SIZE_ICONSIZE = {
|
|
13
|
+
[ButtonBaseSize.Sm]: IconSize.Sm,
|
|
14
|
+
[ButtonBaseSize.Md]: IconSize.Sm,
|
|
15
|
+
[ButtonBaseSize.Lg]: IconSize.Md,
|
|
16
|
+
};
|
|
17
|
+
export const MAP_BUTTONBASE_SIZE_TEXT_VARIANT = {
|
|
18
|
+
[ButtonBaseSize.Sm]: TextVariant.BodySm,
|
|
19
|
+
[ButtonBaseSize.Md]: TextVariant.BodyMd,
|
|
20
|
+
[ButtonBaseSize.Lg]: TextVariant.BodyMd,
|
|
21
|
+
};
|
|
22
|
+
export const getButtonBaseBorderRadiusTwClass = (size) => TWCLASSMAP_BUTTONBASE_BORDER_RADIUS[size];
|
|
23
|
+
export const getButtonBaseHorizontalPaddingTwClasses = (buttonSize, hasStart, hasEnd) => {
|
|
24
|
+
if (buttonSize !== ButtonBaseSize.Lg || (hasStart && hasEnd)) {
|
|
25
|
+
return 'px-3';
|
|
26
|
+
}
|
|
27
|
+
if (!hasStart && !hasEnd) {
|
|
28
|
+
return 'px-4';
|
|
29
|
+
}
|
|
30
|
+
if (hasStart) {
|
|
31
|
+
return 'pl-3 pr-4';
|
|
32
|
+
}
|
|
33
|
+
return 'pl-4 pr-3';
|
|
34
|
+
};
|
|
7
35
|
//# sourceMappingURL=ButtonBase.constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.constants.mjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.constants.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ButtonBase.constants.mjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,QAAQ,EACR,WAAW,EACZ,gDAAgD;AAEjD,MAAM,CAAC,MAAM,oCAAoC,GAG7C;IACF,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,KAAK;IAC1B,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,MAAM;IAC3B,CAAC,cAAc,CAAC,EAAE,CAAC,EA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Variant,\n} from '@metamask-previews/design-system-shared';\n\nexport const TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION: Record<\n ButtonBaseSize,\n string\n> = {\n [ButtonBaseSize.Sm]: 'h-8', // size (32px).\n [ButtonBaseSize.Md]: 'h-10', // size (40px).\n [ButtonBaseSize.Lg]: 'h-12', // size (48px).\n};\n\nexport const TWCLASSMAP_BUTTONBASE_BORDER_RADIUS: Record<\n ButtonBaseSize,\n string\n> = {\n [ButtonBaseSize.Sm]: 'rounded-lg', // 8px.\n [ButtonBaseSize.Md]: 'rounded-xl', // 12px.\n [ButtonBaseSize.Lg]: 'rounded-xl', // 12px.\n};\n\nexport const MAP_BUTTONBASE_SIZE_ICONSIZE: Record<ButtonBaseSize, IconSize> = {\n [ButtonBaseSize.Sm]: IconSize.Sm,\n [ButtonBaseSize.Md]: IconSize.Sm,\n [ButtonBaseSize.Lg]: IconSize.Md,\n};\n\nexport const MAP_BUTTONBASE_SIZE_TEXT_VARIANT: Record<\n ButtonBaseSize,\n TextVariant\n> = {\n [ButtonBaseSize.Sm]: TextVariant.BodySm,\n [ButtonBaseSize.Md]: TextVariant.BodyMd,\n [ButtonBaseSize.Lg]: TextVariant.BodyMd,\n};\n\nexport const getButtonBaseBorderRadiusTwClass = (\n size: ButtonBaseSize,\n): string => TWCLASSMAP_BUTTONBASE_BORDER_RADIUS[size];\n\nexport const getButtonBaseHorizontalPaddingTwClasses = (\n buttonSize: ButtonBaseSize,\n hasStart: boolean,\n hasEnd: boolean,\n): string => {\n if (buttonSize !== ButtonBaseSize.Lg || (hasStart && hasEnd)) {\n return 'px-3';\n }\n if (!hasStart && !hasEnd) {\n return 'px-4';\n }\n if (hasStart) {\n return 'pl-3 pr-4';\n }\n return 'pl-4 pr-3';\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ButtonBaseProps } from "./ButtonBase.types.cjs";
|
|
3
|
-
export declare const ButtonBase: ({ children, textProps, size, isLoading, loadingText, spinnerProps, startIconName, startIconProps, startAccessory, endIconName, endIconProps, endAccessory, isDisabled, isFullWidth, twClassName, textClassName, iconClassName, style, accessibilityLabel, accessibilityHint, accessibilityRole, accessibilityActions, onAccessibilityAction, ...props }: ButtonBaseProps) => React.JSX.Element;
|
|
3
|
+
export declare const ButtonBase: ({ children, textProps, size, isLoading, loadingText, spinnerProps, loadingWrapperProps, contentWrapperProps, startIconName, startIconProps, startAccessory, endIconName, endIconProps, endAccessory, isDisabled, isFullWidth, twClassName, textClassName, iconClassName, style, accessibilityLabel, accessibilityHint, accessibilityRole, accessibilityActions, onAccessibilityAction, ...props }: ButtonBaseProps) => React.JSX.Element;
|
|
4
4
|
//# sourceMappingURL=ButtonBase.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.d.cts","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ButtonBase.d.cts","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAkB,cAAc;AAgBvC,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAE1D,eAAO,MAAM,UAAU,sYA2BpB,eAAe,sBA+LjB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ButtonBaseProps } from "./ButtonBase.types.mjs";
|
|
3
|
-
export declare const ButtonBase: ({ children, textProps, size, isLoading, loadingText, spinnerProps, startIconName, startIconProps, startAccessory, endIconName, endIconProps, endAccessory, isDisabled, isFullWidth, twClassName, textClassName, iconClassName, style, accessibilityLabel, accessibilityHint, accessibilityRole, accessibilityActions, onAccessibilityAction, ...props }: ButtonBaseProps) => React.JSX.Element;
|
|
3
|
+
export declare const ButtonBase: ({ children, textProps, size, isLoading, loadingText, spinnerProps, loadingWrapperProps, contentWrapperProps, startIconName, startIconProps, startAccessory, endIconName, endIconProps, endAccessory, isDisabled, isFullWidth, twClassName, textClassName, iconClassName, style, accessibilityLabel, accessibilityHint, accessibilityRole, accessibilityActions, onAccessibilityAction, ...props }: ButtonBaseProps) => React.JSX.Element;
|
|
4
4
|
//# sourceMappingURL=ButtonBase.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.d.mts","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ButtonBase.d.mts","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAkB,cAAc;AAgBvC,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAE1D,eAAO,MAAM,UAAU,sYA2BpB,eAAe,sBA+LjB,CAAC"}
|
|
@@ -4,20 +4,25 @@ function $importDefault(module) {
|
|
|
4
4
|
}
|
|
5
5
|
return module;
|
|
6
6
|
}
|
|
7
|
-
import { ButtonBaseSize } from "@metamask-previews/design-system-shared";
|
|
7
|
+
import { ButtonBaseSize, FontWeight, TextColor } from "@metamask-previews/design-system-shared";
|
|
8
8
|
import { useTailwind } from "@metamask-previews/design-system-twrnc-preset";
|
|
9
9
|
import $React, { useMemo } from "react";
|
|
10
10
|
const React = $importDefault($React);
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { Box } from "../Box/index.mjs";
|
|
12
|
+
import { BoxRow } from "../BoxRow/index.mjs";
|
|
13
|
+
import { Icon, IconColor } from "../Icon/index.mjs";
|
|
13
14
|
import { ButtonAnimated } from "../temp-components/ButtonAnimated/index.mjs";
|
|
14
15
|
import { Spinner } from "../temp-components/Spinner/index.mjs";
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
export const ButtonBase = ({ children, textProps, size = ButtonBaseSize.Lg, isLoading, loadingText, spinnerProps, startIconName, startIconProps, startAccessory, endIconName, endIconProps, endAccessory, isDisabled, isFullWidth, twClassName, textClassName, iconClassName, style, accessibilityLabel, accessibilityHint, accessibilityRole = 'button', accessibilityActions, onAccessibilityAction, ...props }) => {
|
|
16
|
+
import { MAP_BUTTONBASE_SIZE_ICONSIZE, MAP_BUTTONBASE_SIZE_TEXT_VARIANT, getButtonBaseBorderRadiusTwClass, getButtonBaseHorizontalPaddingTwClasses, TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION } from "./ButtonBase.constants.mjs";
|
|
17
|
+
export const ButtonBase = ({ children, textProps, size = ButtonBaseSize.Lg, isLoading, loadingText, spinnerProps, loadingWrapperProps, contentWrapperProps, startIconName, startIconProps, startAccessory, endIconName, endIconProps, endAccessory, isDisabled, isFullWidth, twClassName, textClassName, iconClassName, style, accessibilityLabel, accessibilityHint, accessibilityRole = 'button', accessibilityActions, onAccessibilityAction, ...props }) => {
|
|
18
18
|
const tw = useTailwind();
|
|
19
19
|
const finalStartIconName = startIconName ?? startIconProps?.name;
|
|
20
20
|
const finalEndIconName = endIconName ?? endIconProps?.name;
|
|
21
|
+
const hasStart = Boolean(finalStartIconName || startAccessory);
|
|
22
|
+
const hasEnd = Boolean(finalEndIconName || endAccessory);
|
|
23
|
+
const hasAccessories = hasStart || hasEnd;
|
|
24
|
+
const iconSize = MAP_BUTTONBASE_SIZE_ICONSIZE[size];
|
|
25
|
+
const labelTextVariant = MAP_BUTTONBASE_SIZE_TEXT_VARIANT[size];
|
|
21
26
|
// Generate accessibility label if not provided
|
|
22
27
|
const finalAccessibilityLabel = useMemo(() => {
|
|
23
28
|
if (accessibilityLabel) {
|
|
@@ -62,9 +67,11 @@ export const ButtonBase = ({ children, textProps, size = ButtonBaseSize.Lg, isLo
|
|
|
62
67
|
// Build button container styles
|
|
63
68
|
const buttonStyles = tw.style(
|
|
64
69
|
// Base layout - flex container for button content
|
|
65
|
-
'flex-row items-center justify-center
|
|
70
|
+
'flex-row items-center justify-center',
|
|
66
71
|
// Visual styling
|
|
67
|
-
'
|
|
72
|
+
'bg-muted overflow-hidden',
|
|
73
|
+
// Conditional Border Radius and Horizontal Spacing based on requirements
|
|
74
|
+
getButtonBaseBorderRadiusTwClass(size), getButtonBaseHorizontalPaddingTwClasses(size, hasStart, hasEnd),
|
|
68
75
|
// Size
|
|
69
76
|
TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION[size],
|
|
70
77
|
// State-based opacity
|
|
@@ -81,31 +88,38 @@ export const ButtonBase = ({ children, textProps, size = ButtonBaseSize.Lg, isLo
|
|
|
81
88
|
}
|
|
82
89
|
return computedStyle;
|
|
83
90
|
}} {...props}>
|
|
84
|
-
{({ pressed }) =>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
91
|
+
{({ pressed }) => {
|
|
92
|
+
const { twClassName: loadingWrapperTw, ...restLoadingWrapper } = loadingWrapperProps ?? {};
|
|
93
|
+
const { twClassName: contentWrapperTw, ...restContentWrapper } = contentWrapperProps ?? {};
|
|
94
|
+
return (<>
|
|
95
|
+
{/* Loading spinner overlay */}
|
|
96
|
+
{isLoading && (<Box {...restLoadingWrapper} twClassName={`absolute inset-0 flex items-center justify-center ${loadingWrapperTw ?? ''}`}>
|
|
97
|
+
<Spinner color={textClassName
|
|
98
|
+
? textClassName(pressed)
|
|
99
|
+
: IconColor.IconDefault} loadingText={loadingText} {...spinnerProps} spinnerIconProps={{
|
|
100
|
+
size: iconSize,
|
|
101
|
+
...spinnerProps?.spinnerIconProps,
|
|
102
|
+
}} loadingTextProps={{
|
|
103
|
+
numberOfLines: 1,
|
|
104
|
+
variant: labelTextVariant,
|
|
105
|
+
twClassName: textClassName ? textClassName(pressed) : '',
|
|
106
|
+
...spinnerProps?.loadingTextProps,
|
|
107
|
+
}}/>
|
|
108
|
+
</Box>)}
|
|
100
109
|
|
|
101
|
-
|
|
110
|
+
<BoxRow {...restContentWrapper} twClassName={`${contentWrapperTw ?? ''} ${isLoading ? 'opacity-0' : ''}`} gap={hasAccessories ? 1 : 0} startAccessory={finalStartIconName ? (<Icon name={finalStartIconName} size={iconSize} twClassName={`shrink-0 ${iconClassName ? iconClassName(pressed) : ''}`} {...startIconProps}/>) : (startAccessory)} endAccessory={finalEndIconName ? (<Icon name={finalEndIconName} size={iconSize} twClassName={`shrink-0 ${iconClassName ? iconClassName(pressed) : ''}`} {...endIconProps}/>) : (endAccessory)} textProps={{
|
|
111
|
+
variant: labelTextVariant,
|
|
112
|
+
fontWeight: FontWeight.Medium,
|
|
113
|
+
color: TextColor.TextDefault,
|
|
114
|
+
numberOfLines: 1,
|
|
115
|
+
ellipsizeMode: 'clip',
|
|
116
|
+
...textProps,
|
|
117
|
+
twClassName: `shrink grow-0 flex-wrap text-center ${textClassName ? textClassName(pressed) : ''} ${textProps?.twClassName ?? ''}`,
|
|
118
|
+
}}>
|
|
102
119
|
{children}
|
|
103
|
-
</
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
{endAccessory}
|
|
107
|
-
</View>))}
|
|
108
|
-
</>)}
|
|
120
|
+
</BoxRow>
|
|
121
|
+
</>);
|
|
122
|
+
}}
|
|
109
123
|
</ButtonAnimated>);
|
|
110
124
|
};
|
|
111
125
|
//# sourceMappingURL=ButtonBase.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.mjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,gDAAgD;AACzE,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,QAAO,EAAE,OAAO,EAAE,cAAc;;AACvC,OAAO,EAAE,IAAI,EAAE,8BAAqB;AAGpC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,0BAAgB;AACpD,OAAO,EA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,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAClB,CAAC,IAAI,CACH,IAAI,CAAC,CAAC,gBAAgB,CAAC,CACvB,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAClB,WAAW,CAAC,CAAC,YAAY,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACvG,IAAI,YAAY,CAAC,EACjB,CACH,CAAC,CAAC,CAAC,CACF,YAAY,IAAI,CACd,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,IAAI,WAAW,CAAC,CAAC,CAC9C;gBAAA,CAAC,YAAY,CACf;cAAA,EAAE,IAAI,CAAC,CACR,CACF,CACH;QAAA,GAAG,CACJ,CACH;IAAA,EAAE,cAAc,CAAC,CAClB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { ButtonBaseSize } from '@metamask-previews/design-system-shared';\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, { useMemo } from 'react';\nimport { View } from 'react-native';\nimport type { StyleProp, ViewStyle } from 'react-native';\n\nimport { Icon, IconColor, IconSize } from '../Icon';\nimport { ButtonAnimated } from '../temp-components/ButtonAnimated';\nimport { Spinner } from '../temp-components/Spinner';\nimport { Text, TextVariant, FontWeight, TextColor } from '../Text';\n\nimport { TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION } from './ButtonBase.constants';\nimport type { ButtonBaseProps } from './ButtonBase.types';\n\nexport const ButtonBase = ({\n children,\n textProps,\n size = ButtonBaseSize.Lg,\n isLoading,\n loadingText,\n spinnerProps,\n startIconName,\n startIconProps,\n startAccessory,\n endIconName,\n endIconProps,\n endAccessory,\n isDisabled,\n isFullWidth,\n twClassName,\n textClassName,\n iconClassName,\n style,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n accessibilityActions,\n onAccessibilityAction,\n ...props\n}: ButtonBaseProps) => {\n const tw = useTailwind();\n\n const finalStartIconName = startIconName ?? startIconProps?.name;\n const finalEndIconName = endIconName ?? endIconProps?.name;\n\n // Generate accessibility label if not provided\n const finalAccessibilityLabel = useMemo(() => {\n if (accessibilityLabel) {\n return accessibilityLabel;\n }\n\n // For loading state with loadingText, prioritize loadingText\n if (isLoading && loadingText) {\n return loadingText;\n }\n\n // If children is a string, use it as the label\n if (typeof children === 'string') {\n return children;\n }\n\n return undefined;\n }, [accessibilityLabel, children, isLoading, loadingText]);\n\n // Generate accessibility hint for loading state if not provided\n const finalAccessibilityHint = useMemo(() => {\n if (accessibilityHint) {\n return accessibilityHint;\n }\n\n if (isLoading) {\n return 'Button is currently loading, please wait';\n }\n\n return undefined;\n }, [accessibilityHint, isLoading]);\n\n // Create accessibilityState object with only truthy values\n const accessibilityState = useMemo(() => {\n const state: { disabled?: boolean; busy?: boolean } = {};\n\n if (isDisabled || isLoading) {\n state.disabled = true;\n }\n\n if (isLoading) {\n state.busy = true;\n }\n\n return state;\n }, [isDisabled, isLoading]);\n\n return (\n <ButtonAnimated\n disabled={isDisabled || isLoading}\n accessibilityRole={accessibilityRole}\n accessibilityLabel={finalAccessibilityLabel}\n accessibilityHint={finalAccessibilityHint}\n accessibilityActions={accessibilityActions}\n onAccessibilityAction={onAccessibilityAction}\n accessibilityState={accessibilityState}\n accessible\n style={({ pressed }) => {\n // Evaluate custom className if it's a function\n const customClassName =\n typeof twClassName === 'function'\n ? twClassName(pressed)\n : twClassName;\n\n // Build button container styles\n const buttonStyles = tw.style(\n // Base layout - flex container for button content\n 'flex-row items-center justify-center gap-x-2',\n // Visual styling\n 'rounded-xl bg-muted px-4 min-w-[80px] overflow-hidden',\n // Size\n TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION[size],\n // State-based opacity\n isDisabled ? 'opacity-50' : 'opacity-100',\n // Width - use self-start to prevent stretching when not full width\n isFullWidth ? 'w-full' : 'self-start',\n // Custom classes\n customClassName,\n );\n\n // Merge with additional styles if provided\n const computedStyle: StyleProp<ViewStyle>[] = [buttonStyles];\n\n const additionalStyle =\n typeof style === 'function' ? style({ pressed }) : style;\n\n if (additionalStyle) {\n computedStyle.push(additionalStyle);\n }\n\n return computedStyle;\n }}\n {...props}\n >\n {({ pressed }) => (\n <>\n {/* Loading spinner overlay */}\n {isLoading && (\n <View\n style={tw.style(\n 'absolute inset-0 flex items-center justify-center',\n )}\n testID=\"spinner-container\"\n >\n <Spinner\n color={\n textClassName\n ? (textClassName(pressed) as IconColor)\n : IconColor.IconDefault\n }\n loadingText={loadingText}\n loadingTextProps={{\n numberOfLines: 1,\n twClassName: textClassName ? textClassName(pressed) : '',\n ...spinnerProps?.loadingTextProps,\n }}\n {...spinnerProps}\n />\n </View>\n )}\n\n {/* Button content - opacity controlled individually on each child */}\n {finalStartIconName ? (\n <Icon\n name={finalStartIconName}\n size={IconSize.Sm}\n twClassName={`shrink-0 ${isLoading ? 'opacity-0' : ''} ${iconClassName ? iconClassName(pressed) : ''}`}\n {...startIconProps}\n />\n ) : (\n startAccessory && (\n <View style={tw.style(isLoading && 'opacity-0')}>\n {startAccessory}\n </View>\n )\n )}\n\n {typeof children === 'string' ? (\n <Text\n variant={TextVariant.BodyMd}\n fontWeight={FontWeight.Medium}\n color={TextColor.TextDefault}\n {...textProps}\n twClassName={`shrink grow-0 flex-wrap text-center ${isLoading ? 'opacity-0' : ''} ${textClassName ? textClassName(pressed) : ''} ${textProps?.twClassName ?? ''}`}\n >\n {children}\n </Text>\n ) : (\n <View style={tw.style(isLoading && 'opacity-0')}>{children}</View>\n )}\n\n {finalEndIconName ? (\n <Icon\n name={finalEndIconName}\n size={IconSize.Sm}\n twClassName={`shrink-0 ${isLoading ? 'opacity-0' : ''} ${iconClassName ? iconClassName(pressed) : ''}`}\n {...endIconProps}\n />\n ) : (\n endAccessory && (\n <View style={tw.style(isLoading && 'opacity-0')}>\n {endAccessory}\n </View>\n )\n )}\n </>\n )}\n </ButtonAnimated>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ButtonBase.mjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,cAAc,EACd,UAAU,EACV,SAAS,EACV,gDAAgD;AACjD,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,QAAO,EAAE,OAAO,EAAE,cAAc;;AAGvC,OAAO,EAAE,GAAG,EAAE,yBAAe;AAC7B,OAAO,EAAE,MAAM,EAAE,4BAAkB;AACnC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,0BAAgB;AAC1C,OAAO,EAAE,cAAc,EAAE,oDAA0C;AACnE,OAAO,EAAE,OAAO,EAAE,6CAAmC;AAErD,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,EAChC,uCAAuC,EACvC,oCAAoC,EACrC,mCAA+B;AAGhC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,QAAQ,EACR,SAAS,EACT,IAAI,GAAG,cAAc,CAAC,EAAE,EACxB,SAAS,EACT,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACb,aAAa,EACb,KAAK,EACL,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,GAAG,QAAQ,EAC5B,oBAAoB,EACpB,qBAAqB,EACrB,GAAG,KAAK,EACQ,EAAE,EAAE;IACpB,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IAEzB,MAAM,kBAAkB,GAAG,aAAa,IAAI,cAAc,EAAE,IAAI,CAAC;IACjE,MAAM,gBAAgB,GAAG,WAAW,IAAI,YAAY,EAAE,IAAI,CAAC;IAE3D,MAAM,QAAQ,GAAG,OAAO,CAAC,kBAAkB,I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,GAAG,CACJ,CAAC;QACJ,CAAC,CACH;IAAA,EAAE,cAAc,CAAC,CAClB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n ButtonBaseSize,\n FontWeight,\n TextColor,\n} from '@metamask-previews/design-system-shared';\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, { useMemo } from 'react';\nimport type { StyleProp, ViewStyle } from 'react-native';\n\nimport { Box } from '../Box';\nimport { BoxRow } from '../BoxRow';\nimport { Icon, IconColor } from '../Icon';\nimport { ButtonAnimated } from '../temp-components/ButtonAnimated';\nimport { Spinner } from '../temp-components/Spinner';\n\nimport {\n MAP_BUTTONBASE_SIZE_ICONSIZE,\n MAP_BUTTONBASE_SIZE_TEXT_VARIANT,\n getButtonBaseBorderRadiusTwClass,\n getButtonBaseHorizontalPaddingTwClasses,\n TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION,\n} from './ButtonBase.constants';\nimport type { ButtonBaseProps } from './ButtonBase.types';\n\nexport const ButtonBase = ({\n children,\n textProps,\n size = ButtonBaseSize.Lg,\n isLoading,\n loadingText,\n spinnerProps,\n loadingWrapperProps,\n contentWrapperProps,\n startIconName,\n startIconProps,\n startAccessory,\n endIconName,\n endIconProps,\n endAccessory,\n isDisabled,\n isFullWidth,\n twClassName,\n textClassName,\n iconClassName,\n style,\n accessibilityLabel,\n accessibilityHint,\n accessibilityRole = 'button',\n accessibilityActions,\n onAccessibilityAction,\n ...props\n}: ButtonBaseProps) => {\n const tw = useTailwind();\n\n const finalStartIconName = startIconName ?? startIconProps?.name;\n const finalEndIconName = endIconName ?? endIconProps?.name;\n\n const hasStart = Boolean(finalStartIconName || startAccessory);\n const hasEnd = Boolean(finalEndIconName || endAccessory);\n const hasAccessories = hasStart || hasEnd;\n\n const iconSize = MAP_BUTTONBASE_SIZE_ICONSIZE[size];\n const labelTextVariant = MAP_BUTTONBASE_SIZE_TEXT_VARIANT[size];\n\n // Generate accessibility label if not provided\n const finalAccessibilityLabel = useMemo(() => {\n if (accessibilityLabel) {\n return accessibilityLabel;\n }\n\n // For loading state with loadingText, prioritize loadingText\n if (isLoading && loadingText) {\n return loadingText;\n }\n\n // If children is a string, use it as the label\n if (typeof children === 'string') {\n return children;\n }\n\n return undefined;\n }, [accessibilityLabel, children, isLoading, loadingText]);\n\n // Generate accessibility hint for loading state if not provided\n const finalAccessibilityHint = useMemo(() => {\n if (accessibilityHint) {\n return accessibilityHint;\n }\n\n if (isLoading) {\n return 'Button is currently loading, please wait';\n }\n\n return undefined;\n }, [accessibilityHint, isLoading]);\n\n // Create accessibilityState object with only truthy values\n const accessibilityState = useMemo(() => {\n const state: { disabled?: boolean; busy?: boolean } = {};\n\n if (isDisabled || isLoading) {\n state.disabled = true;\n }\n\n if (isLoading) {\n state.busy = true;\n }\n\n return state;\n }, [isDisabled, isLoading]);\n\n return (\n <ButtonAnimated\n disabled={isDisabled || isLoading}\n accessibilityRole={accessibilityRole}\n accessibilityLabel={finalAccessibilityLabel}\n accessibilityHint={finalAccessibilityHint}\n accessibilityActions={accessibilityActions}\n onAccessibilityAction={onAccessibilityAction}\n accessibilityState={accessibilityState}\n accessible\n style={({ pressed }) => {\n // Evaluate custom className if it's a function\n const customClassName =\n typeof twClassName === 'function'\n ? twClassName(pressed)\n : twClassName;\n\n // Build button container styles\n const buttonStyles = tw.style(\n // Base layout - flex container for button content\n 'flex-row items-center justify-center',\n // Visual styling\n 'bg-muted overflow-hidden',\n // Conditional Border Radius and Horizontal Spacing based on requirements\n getButtonBaseBorderRadiusTwClass(size),\n getButtonBaseHorizontalPaddingTwClasses(size, hasStart, hasEnd),\n // Size\n TWCLASSMAP_BUTTONBASE_SIZE_DIMENSION[size],\n // State-based opacity\n isDisabled ? 'opacity-50' : 'opacity-100',\n // Width - use self-start to prevent stretching when not full width\n isFullWidth ? 'w-full' : 'self-start',\n // Custom classes\n customClassName,\n );\n\n // Merge with additional styles if provided\n const computedStyle: StyleProp<ViewStyle>[] = [buttonStyles];\n\n const additionalStyle =\n typeof style === 'function' ? style({ pressed }) : style;\n\n if (additionalStyle) {\n computedStyle.push(additionalStyle);\n }\n\n return computedStyle;\n }}\n {...props}\n >\n {({ pressed }) => {\n const { twClassName: loadingWrapperTw, ...restLoadingWrapper } =\n loadingWrapperProps ?? {};\n const { twClassName: contentWrapperTw, ...restContentWrapper } =\n contentWrapperProps ?? {};\n\n return (\n <>\n {/* Loading spinner overlay */}\n {isLoading && (\n <Box\n {...restLoadingWrapper}\n twClassName={`absolute inset-0 flex items-center justify-center ${loadingWrapperTw ?? ''}`}\n >\n <Spinner\n color={\n textClassName\n ? (textClassName(pressed) as IconColor)\n : IconColor.IconDefault\n }\n loadingText={loadingText}\n {...spinnerProps}\n spinnerIconProps={{\n size: iconSize,\n ...spinnerProps?.spinnerIconProps,\n }}\n loadingTextProps={{\n numberOfLines: 1,\n variant: labelTextVariant,\n twClassName: textClassName ? textClassName(pressed) : '',\n ...spinnerProps?.loadingTextProps,\n }}\n />\n </Box>\n )}\n\n <BoxRow\n {...restContentWrapper}\n twClassName={`${contentWrapperTw ?? ''} ${isLoading ? 'opacity-0' : ''}`}\n gap={hasAccessories ? 1 : 0}\n startAccessory={\n finalStartIconName ? (\n <Icon\n name={finalStartIconName}\n size={iconSize}\n twClassName={`shrink-0 ${iconClassName ? iconClassName(pressed) : ''}`}\n {...startIconProps}\n />\n ) : (\n startAccessory\n )\n }\n endAccessory={\n finalEndIconName ? (\n <Icon\n name={finalEndIconName}\n size={iconSize}\n twClassName={`shrink-0 ${iconClassName ? iconClassName(pressed) : ''}`}\n {...endIconProps}\n />\n ) : (\n endAccessory\n )\n }\n textProps={{\n variant: labelTextVariant,\n fontWeight: FontWeight.Medium,\n color: TextColor.TextDefault,\n numberOfLines: 1,\n ellipsizeMode: 'clip',\n ...textProps,\n twClassName: `shrink grow-0 flex-wrap text-center ${textClassName ? textClassName(pressed) : ''} ${textProps?.twClassName ?? ''}`,\n }}\n >\n {children}\n </BoxRow>\n </>\n );\n }}\n </ButtonAnimated>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.types.cjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ButtonBasePropsShared,\n IconName,\n} from '@metamask-previews/design-system-shared';\nimport type { PressableProps, StyleProp, ViewStyle } from 'react-native';\n\nimport type { IconProps } from '../Icon';\nimport type { SpinnerProps } from '../temp-components/Spinner';\nimport type { TextProps } from '../Text';\n\n/**\n * ButtonBase component props.\n */\nexport type ButtonBaseProps = ButtonBasePropsShared & {\n /**\n * Required prop for the content to be rendered within the ButtonBase\n */\n children: React.ReactNode | string;\n /**\n * Optional props to be passed to the Text component when children is a string\n */\n textProps?: Omit<Partial<TextProps>, 'children'>;\n /**\n * Optional prop to pass additional properties to the end icon\n */\n spinnerProps?: Partial<SpinnerProps>;\n /**\n * Optional prop to specify an icon to show at the start of the button\n */\n startIconName?: IconName;\n /**\n * Optional prop to pass additional properties to the start icon\n */\n startIconProps?: Partial<IconProps>;\n /**\n * Optional prop for a custom element to show at the start of the button\n */\n startAccessory?: React.ReactNode;\n /**\n * Optional prop to specify an icon to show at the end of the button\n */\n endIconName?: IconName;\n /**\n * Optional prop to pass additional properties to the end icon\n */\n endIconProps?: Partial<IconProps>;\n /**\n * Optional prop for a custom element to show at the end of the button\n */\n endAccessory?: React.ReactNode;\n /**\n * Optional prop to add twrnc overriding classNames.\n * Can be a string or a function that receives pressed state and returns a string.\n */\n twClassName?: string | ((pressed: boolean) => string);\n /**\n * Optional prop to control text className based on pressed state.\n */\n textClassName?: (pressed: boolean) => string;\n /**\n * Optional prop to control icon className based on pressed state.\n */\n iconClassName?: (pressed: boolean) => string;\n /**\n * Optional prop to control the style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * Optional accessibility label to describe the button for screen readers.\n * If not provided, the button content will be used as the label.\n */\n accessibilityLabel?: string;\n /**\n * Optional accessibility hint to provide additional context about the button's action.\n * Should describe what happens when the button is pressed.\n */\n accessibilityHint?: string;\n /**\n * Optional accessibility role. Defaults to 'button'.\n * Can be overridden for specific use cases.\n */\n accessibilityRole?: 'button' | 'link' | 'menuitem' | 'tab' | 'none';\n /**\n * Optional accessibility actions for custom interactions.\n * Use sparingly and only when default button behavior is insufficient.\n */\n accessibilityActions?: {\n name: string;\n label?: string;\n }[];\n /**\n * Optional callback for handling accessibility action events.\n */\n onAccessibilityAction?: (event: {\n nativeEvent: { actionName: string };\n }) => void;\n} & Omit<\n PressableProps,\n | 'accessibilityRole'\n | 'accessibilityLabel'\n | 'accessibilityHint'\n | 'accessibilityActions'\n | 'onAccessibilityAction'\n >;\n"]}
|
|
1
|
+
{"version":3,"file":"ButtonBase.types.cjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ButtonBasePropsShared,\n IconName,\n} from '@metamask-previews/design-system-shared';\nimport type { PressableProps, StyleProp, ViewStyle } from 'react-native';\n\nimport type { BoxProps } from '../Box/Box.types';\nimport type { BoxRowProps } from '../BoxRow/BoxRow.types';\nimport type { IconProps } from '../Icon';\nimport type { SpinnerProps } from '../temp-components/Spinner';\nimport type { TextProps } from '../Text';\n\n/**\n * ButtonBase component props.\n */\nexport type ButtonBaseProps = ButtonBasePropsShared & {\n /**\n * Required prop for the content to be rendered within the ButtonBase\n */\n children: React.ReactNode | string;\n /**\n * Optional props to be passed to the Text component when children is a string\n */\n textProps?: Omit<Partial<TextProps>, 'children'>;\n /**\n * Optional prop to pass additional properties to the end icon\n */\n spinnerProps?: Partial<SpinnerProps>;\n /**\n * Props passed to the loading overlay wrapper (`Box` around the spinner).\n * Defaults include `twClassName` for full-area centered layout; merge your own `twClassName` to extend.\n * Pass `testID` here for tests — there is no default test id on this wrapper.\n */\n loadingWrapperProps?: Omit<Partial<BoxProps>, 'children'>;\n /**\n * Props passed to the label row (`BoxRow`). Label typography remains controlled via `textProps` on ButtonBase.\n */\n contentWrapperProps?: Omit<Partial<BoxRowProps>, 'children' | 'textProps'>;\n /**\n * Optional prop to specify an icon to show at the start of the button\n */\n startIconName?: IconName;\n /**\n * Optional prop to pass additional properties to the start icon\n */\n startIconProps?: Partial<IconProps>;\n /**\n * Optional prop for a custom element to show at the start of the button\n */\n startAccessory?: React.ReactNode;\n /**\n * Optional prop to specify an icon to show at the end of the button\n */\n endIconName?: IconName;\n /**\n * Optional prop to pass additional properties to the end icon\n */\n endIconProps?: Partial<IconProps>;\n /**\n * Optional prop for a custom element to show at the end of the button\n */\n endAccessory?: React.ReactNode;\n /**\n * Optional prop to add twrnc overriding classNames.\n * Can be a string or a function that receives pressed state and returns a string.\n */\n twClassName?: string | ((pressed: boolean) => string);\n /**\n * Optional prop to control text className based on pressed state.\n */\n textClassName?: (pressed: boolean) => string;\n /**\n * Optional prop to control icon className based on pressed state.\n */\n iconClassName?: (pressed: boolean) => string;\n /**\n * Optional prop to control the style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * Optional accessibility label to describe the button for screen readers.\n * If not provided, the button content will be used as the label.\n */\n accessibilityLabel?: string;\n /**\n * Optional accessibility hint to provide additional context about the button's action.\n * Should describe what happens when the button is pressed.\n */\n accessibilityHint?: string;\n /**\n * Optional accessibility role. Defaults to 'button'.\n * Can be overridden for specific use cases.\n */\n accessibilityRole?: 'button' | 'link' | 'menuitem' | 'tab' | 'none';\n /**\n * Optional accessibility actions for custom interactions.\n * Use sparingly and only when default button behavior is insufficient.\n */\n accessibilityActions?: {\n name: string;\n label?: string;\n }[];\n /**\n * Optional callback for handling accessibility action events.\n */\n onAccessibilityAction?: (event: {\n nativeEvent: { actionName: string };\n }) => void;\n} & Omit<\n PressableProps,\n | 'accessibilityRole'\n | 'accessibilityLabel'\n | 'accessibilityHint'\n | 'accessibilityActions'\n | 'onAccessibilityAction'\n >;\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ButtonBasePropsShared, IconName } from "@metamask-previews/design-system-shared";
|
|
3
3
|
import type { PressableProps, StyleProp, ViewStyle } from "react-native/index.js";
|
|
4
|
+
import type { BoxProps } from "../Box/Box.types.cjs";
|
|
5
|
+
import type { BoxRowProps } from "../BoxRow/BoxRow.types.cjs";
|
|
4
6
|
import type { IconProps } from "../Icon/index.cjs";
|
|
5
7
|
import type { SpinnerProps } from "../temp-components/Spinner/index.cjs";
|
|
6
8
|
import type { TextProps } from "../Text/index.cjs";
|
|
@@ -20,6 +22,16 @@ export type ButtonBaseProps = ButtonBasePropsShared & {
|
|
|
20
22
|
* Optional prop to pass additional properties to the end icon
|
|
21
23
|
*/
|
|
22
24
|
spinnerProps?: Partial<SpinnerProps>;
|
|
25
|
+
/**
|
|
26
|
+
* Props passed to the loading overlay wrapper (`Box` around the spinner).
|
|
27
|
+
* Defaults include `twClassName` for full-area centered layout; merge your own `twClassName` to extend.
|
|
28
|
+
* Pass `testID` here for tests — there is no default test id on this wrapper.
|
|
29
|
+
*/
|
|
30
|
+
loadingWrapperProps?: Omit<Partial<BoxProps>, 'children'>;
|
|
31
|
+
/**
|
|
32
|
+
* Props passed to the label row (`BoxRow`). Label typography remains controlled via `textProps` on ButtonBase.
|
|
33
|
+
*/
|
|
34
|
+
contentWrapperProps?: Omit<Partial<BoxRowProps>, 'children' | 'textProps'>;
|
|
23
35
|
/**
|
|
24
36
|
* Optional prop to specify an icon to show at the start of the button
|
|
25
37
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.types.d.cts","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,QAAQ,EACT,gDAAgD;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,8BAAqB;AAEzE,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AACzC,OAAO,KAAK,EAAE,YAAY,EA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AE,CAAC;KACrC,KAAK,IAAI,CAAC;CACZ,GAAG,IAAI,CACJ,cAAc,EACZ,mBAAmB,GACnB,oBAAoB,GACpB,mBAAmB,GACnB,sBAAsB,GACtB,uBAAuB,CAC1B,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ButtonBasePropsShared, IconName } from "@metamask-previews/design-system-shared";
|
|
3
3
|
import type { PressableProps, StyleProp, ViewStyle } from "react-native/index.js";
|
|
4
|
+
import type { BoxProps } from "../Box/Box.types.mjs";
|
|
5
|
+
import type { BoxRowProps } from "../BoxRow/BoxRow.types.mjs";
|
|
4
6
|
import type { IconProps } from "../Icon/index.mjs";
|
|
5
7
|
import type { SpinnerProps } from "../temp-components/Spinner/index.mjs";
|
|
6
8
|
import type { TextProps } from "../Text/index.mjs";
|
|
@@ -20,6 +22,16 @@ export type ButtonBaseProps = ButtonBasePropsShared & {
|
|
|
20
22
|
* Optional prop to pass additional properties to the end icon
|
|
21
23
|
*/
|
|
22
24
|
spinnerProps?: Partial<SpinnerProps>;
|
|
25
|
+
/**
|
|
26
|
+
* Props passed to the loading overlay wrapper (`Box` around the spinner).
|
|
27
|
+
* Defaults include `twClassName` for full-area centered layout; merge your own `twClassName` to extend.
|
|
28
|
+
* Pass `testID` here for tests — there is no default test id on this wrapper.
|
|
29
|
+
*/
|
|
30
|
+
loadingWrapperProps?: Omit<Partial<BoxProps>, 'children'>;
|
|
31
|
+
/**
|
|
32
|
+
* Props passed to the label row (`BoxRow`). Label typography remains controlled via `textProps` on ButtonBase.
|
|
33
|
+
*/
|
|
34
|
+
contentWrapperProps?: Omit<Partial<BoxRowProps>, 'children' | 'textProps'>;
|
|
23
35
|
/**
|
|
24
36
|
* Optional prop to specify an icon to show at the start of the button
|
|
25
37
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.types.d.mts","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase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;;;OAGG;IACH,oBAAoB,CAAC,EAAE;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,EAAE,CAAC;IACJ;;OAEG;IACH,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC9B,WAAW,EAAE;YAAE,UAAU,EAAE,MAAM,CAAA;SAAE,CAAC;KACrC,KAAK,IAAI,CAAC;CACZ,GAAG,IAAI,CACJ,cAAc,EACZ,mBAAmB,GACnB,oBAAoB,GACpB,mBAAmB,GACnB,sBAAsB,GACtB,uBAAuB,CAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonBase.types.mjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ButtonBasePropsShared,\n IconName,\n} from '@metamask-previews/design-system-shared';\nimport type { PressableProps, StyleProp, ViewStyle } from 'react-native';\n\nimport type { IconProps } from '../Icon';\nimport type { SpinnerProps } from '../temp-components/Spinner';\nimport type { TextProps } from '../Text';\n\n/**\n * ButtonBase component props.\n */\nexport type ButtonBaseProps = ButtonBasePropsShared & {\n /**\n * Required prop for the content to be rendered within the ButtonBase\n */\n children: React.ReactNode | string;\n /**\n * Optional props to be passed to the Text component when children is a string\n */\n textProps?: Omit<Partial<TextProps>, 'children'>;\n /**\n * Optional prop to pass additional properties to the end icon\n */\n spinnerProps?: Partial<SpinnerProps>;\n /**\n * Optional prop to specify an icon to show at the start of the button\n */\n startIconName?: IconName;\n /**\n * Optional prop to pass additional properties to the start icon\n */\n startIconProps?: Partial<IconProps>;\n /**\n * Optional prop for a custom element to show at the start of the button\n */\n startAccessory?: React.ReactNode;\n /**\n * Optional prop to specify an icon to show at the end of the button\n */\n endIconName?: IconName;\n /**\n * Optional prop to pass additional properties to the end icon\n */\n endIconProps?: Partial<IconProps>;\n /**\n * Optional prop for a custom element to show at the end of the button\n */\n endAccessory?: React.ReactNode;\n /**\n * Optional prop to add twrnc overriding classNames.\n * Can be a string or a function that receives pressed state and returns a string.\n */\n twClassName?: string | ((pressed: boolean) => string);\n /**\n * Optional prop to control text className based on pressed state.\n */\n textClassName?: (pressed: boolean) => string;\n /**\n * Optional prop to control icon className based on pressed state.\n */\n iconClassName?: (pressed: boolean) => string;\n /**\n * Optional prop to control the style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * Optional accessibility label to describe the button for screen readers.\n * If not provided, the button content will be used as the label.\n */\n accessibilityLabel?: string;\n /**\n * Optional accessibility hint to provide additional context about the button's action.\n * Should describe what happens when the button is pressed.\n */\n accessibilityHint?: string;\n /**\n * Optional accessibility role. Defaults to 'button'.\n * Can be overridden for specific use cases.\n */\n accessibilityRole?: 'button' | 'link' | 'menuitem' | 'tab' | 'none';\n /**\n * Optional accessibility actions for custom interactions.\n * Use sparingly and only when default button behavior is insufficient.\n */\n accessibilityActions?: {\n name: string;\n label?: string;\n }[];\n /**\n * Optional callback for handling accessibility action events.\n */\n onAccessibilityAction?: (event: {\n nativeEvent: { actionName: string };\n }) => void;\n} & Omit<\n PressableProps,\n | 'accessibilityRole'\n | 'accessibilityLabel'\n | 'accessibilityHint'\n | 'accessibilityActions'\n | 'onAccessibilityAction'\n >;\n"]}
|
|
1
|
+
{"version":3,"file":"ButtonBase.types.mjs","sourceRoot":"","sources":["../../../src/components/ButtonBase/ButtonBase.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n ButtonBasePropsShared,\n IconName,\n} from '@metamask-previews/design-system-shared';\nimport type { PressableProps, StyleProp, ViewStyle } from 'react-native';\n\nimport type { BoxProps } from '../Box/Box.types';\nimport type { BoxRowProps } from '../BoxRow/BoxRow.types';\nimport type { IconProps } from '../Icon';\nimport type { SpinnerProps } from '../temp-components/Spinner';\nimport type { TextProps } from '../Text';\n\n/**\n * ButtonBase component props.\n */\nexport type ButtonBaseProps = ButtonBasePropsShared & {\n /**\n * Required prop for the content to be rendered within the ButtonBase\n */\n children: React.ReactNode | string;\n /**\n * Optional props to be passed to the Text component when children is a string\n */\n textProps?: Omit<Partial<TextProps>, 'children'>;\n /**\n * Optional prop to pass additional properties to the end icon\n */\n spinnerProps?: Partial<SpinnerProps>;\n /**\n * Props passed to the loading overlay wrapper (`Box` around the spinner).\n * Defaults include `twClassName` for full-area centered layout; merge your own `twClassName` to extend.\n * Pass `testID` here for tests — there is no default test id on this wrapper.\n */\n loadingWrapperProps?: Omit<Partial<BoxProps>, 'children'>;\n /**\n * Props passed to the label row (`BoxRow`). Label typography remains controlled via `textProps` on ButtonBase.\n */\n contentWrapperProps?: Omit<Partial<BoxRowProps>, 'children' | 'textProps'>;\n /**\n * Optional prop to specify an icon to show at the start of the button\n */\n startIconName?: IconName;\n /**\n * Optional prop to pass additional properties to the start icon\n */\n startIconProps?: Partial<IconProps>;\n /**\n * Optional prop for a custom element to show at the start of the button\n */\n startAccessory?: React.ReactNode;\n /**\n * Optional prop to specify an icon to show at the end of the button\n */\n endIconName?: IconName;\n /**\n * Optional prop to pass additional properties to the end icon\n */\n endIconProps?: Partial<IconProps>;\n /**\n * Optional prop for a custom element to show at the end of the button\n */\n endAccessory?: React.ReactNode;\n /**\n * Optional prop to add twrnc overriding classNames.\n * Can be a string or a function that receives pressed state and returns a string.\n */\n twClassName?: string | ((pressed: boolean) => string);\n /**\n * Optional prop to control text className based on pressed state.\n */\n textClassName?: (pressed: boolean) => string;\n /**\n * Optional prop to control icon className based on pressed state.\n */\n iconClassName?: (pressed: boolean) => string;\n /**\n * Optional prop to control the style.\n */\n style?: StyleProp<ViewStyle>;\n /**\n * Optional accessibility label to describe the button for screen readers.\n * If not provided, the button content will be used as the label.\n */\n accessibilityLabel?: string;\n /**\n * Optional accessibility hint to provide additional context about the button's action.\n * Should describe what happens when the button is pressed.\n */\n accessibilityHint?: string;\n /**\n * Optional accessibility role. Defaults to 'button'.\n * Can be overridden for specific use cases.\n */\n accessibilityRole?: 'button' | 'link' | 'menuitem' | 'tab' | 'none';\n /**\n * Optional accessibility actions for custom interactions.\n * Use sparingly and only when default button behavior is insufficient.\n */\n accessibilityActions?: {\n name: string;\n label?: string;\n }[];\n /**\n * Optional callback for handling accessibility action events.\n */\n onAccessibilityAction?: (event: {\n nativeEvent: { actionName: string };\n }) => void;\n} & Omit<\n PressableProps,\n | 'accessibilityRole'\n | 'accessibilityLabel'\n | 'accessibilityHint'\n | 'accessibilityActions'\n | 'onAccessibilityAction'\n >;\n"]}
|
|
@@ -26,8 +26,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.ButtonSemantic = void 0;
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
28
|
const ButtonBase_1 = require("../ButtonBase/index.cjs");
|
|
29
|
-
const Icon_1 = require("../Icon/index.cjs");
|
|
30
|
-
const Text_1 = require("../Text/index.cjs");
|
|
31
29
|
const ButtonSemantic_constants_1 = require("./ButtonSemantic.constants.cjs");
|
|
32
30
|
const ButtonSemantic_types_1 = require("./ButtonSemantic.types.cjs");
|
|
33
31
|
const ButtonSemantic = ({ severity, children, textProps, spinnerProps, startIconProps, endIconProps, isLoading = false, twClassName = '', style, ...props }) => {
|
|
@@ -42,21 +40,7 @@ const ButtonSemantic = ({ severity, children, textProps, spinnerProps, startIcon
|
|
|
42
40
|
}, [severity, isLoading, twClassName]);
|
|
43
41
|
const getTextClassName = (0, react_1.useCallback)((_pressed) => ButtonSemantic_constants_1.TWCLASSMAP_BUTTONSEMANTIC_TEXT[severity] ??
|
|
44
42
|
ButtonSemantic_constants_1.TWCLASSMAP_BUTTONSEMANTIC_TEXT[ButtonSemantic_types_1.ButtonSemanticSeverity.Success], [severity]);
|
|
45
|
-
return (<ButtonBase_1.ButtonBase textProps={{
|
|
46
|
-
variant: Text_1.TextVariant.BodyMd,
|
|
47
|
-
fontWeight: Text_1.FontWeight.Medium,
|
|
48
|
-
numberOfLines: 1,
|
|
49
|
-
ellipsizeMode: 'clip',
|
|
50
|
-
...textProps,
|
|
51
|
-
}} spinnerProps={{
|
|
52
|
-
...spinnerProps,
|
|
53
|
-
}} startIconProps={{
|
|
54
|
-
size: Icon_1.IconSize.Sm,
|
|
55
|
-
...startIconProps,
|
|
56
|
-
}} endIconProps={{
|
|
57
|
-
size: Icon_1.IconSize.Sm,
|
|
58
|
-
...endIconProps,
|
|
59
|
-
}} isLoading={isLoading} twClassName={getContainerClassName} textClassName={getTextClassName} iconClassName={getTextClassName} style={style} {...props}>
|
|
43
|
+
return (<ButtonBase_1.ButtonBase textProps={textProps} spinnerProps={spinnerProps} startIconProps={startIconProps} endIconProps={endIconProps} isLoading={isLoading} twClassName={getContainerClassName} textClassName={getTextClassName} iconClassName={getTextClassName} style={style} {...props}>
|
|
60
44
|
{children}
|
|
61
45
|
</ButtonBase_1.ButtonBase>);
|
|
62
46
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonSemantic.cjs","sourceRoot":"","sources":["../../../src/components/ButtonSemantic/ButtonSemantic.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA2C;AAE3C,wDAA2C;
|
|
1
|
+
{"version":3,"file":"ButtonSemantic.cjs","sourceRoot":"","sources":["../../../src/components/ButtonSemantic/ButtonSemantic.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA2C;AAE3C,wDAA2C;AAE3C,6EAIoC;AAEpC,qEAAgE;AAEzD,MAAM,cAAc,GAAG,CAAC,EAC7B,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,SAAS,GAAG,KAAK,EACjB,WAAW,GAAG,EAAE,EAChB,KAAK,EACL,GAAG,KAAK,EACY,EAAE,EAAE;IACxB,MAAM,qBAAqB,GAAG,IAAA,mBAAW,EACvC,CAAC,OAAgB,EAAU,EAAE;QAC3B,MAAM,YAAY,GAChB,OAAO,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CA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UTTONSEMANTIC_BG_PRESSED,\n TWCLASSMAP_BUTTONSEMANTIC_TEXT,\n} from './ButtonSemantic.constants';\nimport type { ButtonSemanticProps } from './ButtonSemantic.types';\nimport { ButtonSemanticSeverity } from './ButtonSemantic.types';\n\nexport const ButtonSemantic = ({\n severity,\n children,\n textProps,\n spinnerProps,\n startIconProps,\n endIconProps,\n isLoading = false,\n twClassName = '',\n style,\n ...props\n}: ButtonSemanticProps) => {\n const getContainerClassName = useCallback(\n (pressed: boolean): string => {\n const classNameStr =\n typeof twClassName === 'function' ? twClassName(pressed) : twClassName;\n\n const bgClass =\n pressed || isLoading\n ? (TWCLASSMAP_BUTTONSEMANTIC_BG_PRESSED[severity] ??\n TWCLASSMAP_BUTTONSEMANTIC_BG_PRESSED[\n ButtonSemanticSeverity.Success\n ])\n : (TWCLASSMAP_BUTTONSEMANTIC_BG[severity] ??\n TWCLASSMAP_BUTTONSEMANTIC_BG[ButtonSemanticSeverity.Success]);\n\n return `${bgClass} ${classNameStr}`;\n },\n [severity, isLoading, twClassName],\n );\n\n const getTextClassName = useCallback(\n (_pressed: boolean): string =>\n TWCLASSMAP_BUTTONSEMANTIC_TEXT[severity] ??\n TWCLASSMAP_BUTTONSEMANTIC_TEXT[ButtonSemanticSeverity.Success],\n [severity],\n );\n\n return (\n <ButtonBase\n textProps={textProps}\n spinnerProps={spinnerProps}\n startIconProps={startIconProps}\n endIconProps={endIconProps}\n isLoading={isLoading}\n twClassName={getContainerClassName}\n textClassName={getTextClassName}\n iconClassName={getTextClassName}\n style={style}\n {...props}\n >\n {children}\n </ButtonBase>\n );\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonSemantic.d.cts","sourceRoot":"","sources":["../../../src/components/ButtonSemantic/ButtonSemantic.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,cAAc;
|
|
1
|
+
{"version":3,"file":"ButtonSemantic.d.cts","sourceRoot":"","sources":["../../../src/components/ButtonSemantic/ButtonSemantic.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,cAAc;AAS3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,mCAA+B;AAGlE,eAAO,MAAM,cAAc,2HAWxB,mBAAmB,sBA2CrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonSemantic.d.mts","sourceRoot":"","sources":["../../../src/components/ButtonSemantic/ButtonSemantic.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,cAAc;
|
|
1
|
+
{"version":3,"file":"ButtonSemantic.d.mts","sourceRoot":"","sources":["../../../src/components/ButtonSemantic/ButtonSemantic.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,cAAc;AAS3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,mCAA+B;AAGlE,eAAO,MAAM,cAAc,2HAWxB,mBAAmB,sBA2CrB,CAAC"}
|
|
@@ -7,8 +7,6 @@ function $importDefault(module) {
|
|
|
7
7
|
import $React, { useCallback } from "react";
|
|
8
8
|
const React = $importDefault($React);
|
|
9
9
|
import { ButtonBase } from "../ButtonBase/index.mjs";
|
|
10
|
-
import { IconSize } from "../Icon/index.mjs";
|
|
11
|
-
import { TextVariant, FontWeight } from "../Text/index.mjs";
|
|
12
10
|
import { TWCLASSMAP_BUTTONSEMANTIC_BG, TWCLASSMAP_BUTTONSEMANTIC_BG_PRESSED, TWCLASSMAP_BUTTONSEMANTIC_TEXT } from "./ButtonSemantic.constants.mjs";
|
|
13
11
|
import { ButtonSemanticSeverity } from "./ButtonSemantic.types.mjs";
|
|
14
12
|
export const ButtonSemantic = ({ severity, children, textProps, spinnerProps, startIconProps, endIconProps, isLoading = false, twClassName = '', style, ...props }) => {
|
|
@@ -23,21 +21,7 @@ export const ButtonSemantic = ({ severity, children, textProps, spinnerProps, st
|
|
|
23
21
|
}, [severity, isLoading, twClassName]);
|
|
24
22
|
const getTextClassName = useCallback((_pressed) => TWCLASSMAP_BUTTONSEMANTIC_TEXT[severity] ??
|
|
25
23
|
TWCLASSMAP_BUTTONSEMANTIC_TEXT[ButtonSemanticSeverity.Success], [severity]);
|
|
26
|
-
return (<ButtonBase textProps={{
|
|
27
|
-
variant: TextVariant.BodyMd,
|
|
28
|
-
fontWeight: FontWeight.Medium,
|
|
29
|
-
numberOfLines: 1,
|
|
30
|
-
ellipsizeMode: 'clip',
|
|
31
|
-
...textProps,
|
|
32
|
-
}} spinnerProps={{
|
|
33
|
-
...spinnerProps,
|
|
34
|
-
}} startIconProps={{
|
|
35
|
-
size: IconSize.Sm,
|
|
36
|
-
...startIconProps,
|
|
37
|
-
}} endIconProps={{
|
|
38
|
-
size: IconSize.Sm,
|
|
39
|
-
...endIconProps,
|
|
40
|
-
}} isLoading={isLoading} twClassName={getContainerClassName} textClassName={getTextClassName} iconClassName={getTextClassName} style={style} {...props}>
|
|
24
|
+
return (<ButtonBase textProps={textProps} spinnerProps={spinnerProps} startIconProps={startIconProps} endIconProps={endIconProps} isLoading={isLoading} twClassName={getContainerClassName} textClassName={getTextClassName} iconClassName={getTextClassName} style={style} {...props}>
|
|
41
25
|
{children}
|
|
42
26
|
</ButtonBase>);
|
|
43
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonSemantic.mjs","sourceRoot":"","sources":["../../../src/components/ButtonSemantic/ButtonSemantic.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,QAAO,EAAE,WAAW,EAAE,cAAc;;AAE3C,OAAO,EAAE,UAAU,EAAE,gCAAsB;
|
|
1
|
+
{"version":3,"file":"ButtonSemantic.mjs","sourceRoot":"","sources":["../../../src/components/ButtonSemantic/ButtonSemantic.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,QAAO,EAAE,WAAW,EAAE,cAAc;;AAE3C,OAAO,EAAE,UAAU,EAAE,gCAAsB;AAE3C,OAAO,EACL,4BAA4B,EAC5B,oCAAoC,EACpC,8BAA8B,EAC/B,uCAAmC;AAEpC,OAAO,EAAE,sBAA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,aAAa,CAAC,CAAC,gBAAgB,CAAC,CAChC,aAAa,CAAC,CAAC,gBAAgB,CAAC,CAChC,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,IAAI,KAAK,CAAC,CAEV;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React, { useCallback } from 'react';\n\nimport { ButtonBase } from '../ButtonBase';\n\nimport {\n TWCLASSMAP_BUTTONSEMANTIC_BG,\n TWCLASSMAP_BUTTONSEMANTIC_BG_PRESSED,\n TWCLASSMAP_BUTTONSEMANTIC_TEXT,\n} from './ButtonSemantic.constants';\nimport type { ButtonSemanticProps } from './ButtonSemantic.types';\nimport { ButtonSemanticSeverity } from './ButtonSemantic.types';\n\nexport const ButtonSemantic = ({\n severity,\n children,\n textProps,\n spinnerProps,\n startIconProps,\n endIconProps,\n isLoading = false,\n twClassName = '',\n style,\n ...props\n}: ButtonSemanticProps) => {\n const getContainerClassName = useCallback(\n (pressed: boolean): string => {\n const classNameStr =\n typeof twClassName === 'function' ? twClassName(pressed) : twClassName;\n\n const bgClass =\n pressed || isLoading\n ? (TWCLASSMAP_BUTTONSEMANTIC_BG_PRESSED[severity] ??\n TWCLASSMAP_BUTTONSEMANTIC_BG_PRESSED[\n ButtonSemanticSeverity.Success\n ])\n : (TWCLASSMAP_BUTTONSEMANTIC_BG[severity] ??\n TWCLASSMAP_BUTTONSEMANTIC_BG[ButtonSemanticSeverity.Success]);\n\n return `${bgClass} ${classNameStr}`;\n },\n [severity, isLoading, twClassName],\n );\n\n const getTextClassName = useCallback(\n (_pressed: boolean): string =>\n TWCLASSMAP_BUTTONSEMANTIC_TEXT[severity] ??\n TWCLASSMAP_BUTTONSEMANTIC_TEXT[ButtonSemanticSeverity.Success],\n [severity],\n );\n\n return (\n <ButtonBase\n textProps={textProps}\n spinnerProps={spinnerProps}\n startIconProps={startIconProps}\n endIconProps={endIconProps}\n isLoading={isLoading}\n twClassName={getContainerClassName}\n textClassName={getTextClassName}\n iconClassName={getTextClassName}\n style={style}\n {...props}\n >\n {children}\n </ButtonBase>\n );\n};\n"]}
|