@pagopa/io-app-design-system 4.2.1 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +3 -3
- package/lib/commonjs/components/alert/Alert.js +44 -65
- package/lib/commonjs/components/alert/Alert.js.map +1 -1
- package/lib/commonjs/components/alert/AlertEdgeToEdge.js +9 -29
- package/lib/commonjs/components/alert/AlertEdgeToEdge.js.map +1 -1
- package/lib/commonjs/components/badge/Badge.js +16 -3
- package/lib/commonjs/components/badge/Badge.js.map +1 -1
- package/lib/commonjs/components/badge/__test__/__snapshots__/badge.test.tsx.snap +9 -5
- package/lib/commonjs/components/banner/Banner.js +10 -34
- package/lib/commonjs/components/banner/Banner.js.map +1 -1
- package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +6 -6
- package/lib/commonjs/components/buttons/ButtonLink.js +26 -54
- package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonOutline.js +27 -45
- package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonSolid.js +24 -45
- package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButton.js +15 -32
- package/lib/commonjs/components/buttons/IconButton.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButtonContained.js +19 -42
- package/lib/commonjs/components/buttons/IconButtonContained.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButtonSolid.js +16 -31
- package/lib/commonjs/components/buttons/IconButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +61 -19
- package/lib/commonjs/components/checkbox/AnimatedCheckbox.js +23 -18
- package/lib/commonjs/components/checkbox/AnimatedCheckbox.js.map +1 -1
- package/lib/commonjs/components/checkbox/CheckboxLabel.js +13 -8
- package/lib/commonjs/components/checkbox/CheckboxLabel.js.map +1 -1
- package/lib/commonjs/components/common/AnimatedTick.js +7 -3
- package/lib/commonjs/components/common/AnimatedTick.js.map +1 -1
- package/lib/commonjs/components/common/LogoPaymentWithFallback.js +9 -3
- package/lib/commonjs/components/common/LogoPaymentWithFallback.js.map +1 -1
- package/lib/commonjs/components/featureInfo/FeatureInfo.js +9 -6
- package/lib/commonjs/components/featureInfo/FeatureInfo.js.map +1 -1
- package/lib/commonjs/components/icons/Icon.js +14 -7
- package/lib/commonjs/components/icons/Icon.js.map +1 -1
- package/lib/commonjs/components/layout/HeaderFirstLevel.js +7 -10
- package/lib/commonjs/components/layout/HeaderFirstLevel.js.map +1 -1
- package/lib/commonjs/components/layout/HeaderSecondLevel.js +8 -9
- package/lib/commonjs/components/layout/HeaderSecondLevel.js.map +1 -1
- package/lib/commonjs/components/layout/index.js +0 -11
- package/lib/commonjs/components/layout/index.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemAction.js +24 -46
- package/lib/commonjs/components/listitems/ListItemAction.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemAmount.js +13 -11
- package/lib/commonjs/components/listitems/ListItemAmount.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemCheckbox.js +25 -48
- package/lib/commonjs/components/listitems/ListItemCheckbox.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemHeader.js +11 -4
- package/lib/commonjs/components/listitems/ListItemHeader.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemInfo.js +14 -17
- package/lib/commonjs/components/listitems/ListItemInfo.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemInfoCopy.js +29 -55
- package/lib/commonjs/components/listitems/ListItemInfoCopy.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemNav.js +36 -64
- package/lib/commonjs/components/listitems/ListItemNav.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemNavAlert.js +32 -58
- package/lib/commonjs/components/listitems/ListItemNavAlert.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemRadio.js +43 -58
- package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js +7 -2
- package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemSwitch.js +12 -14
- package/lib/commonjs/components/listitems/ListItemSwitch.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemTransaction.js +4 -2
- package/lib/commonjs/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/commonjs/components/listitems/{PressableListItemsBase.js → PressableListItemBase.js} +7 -7
- package/lib/commonjs/components/listitems/PressableListItemBase.js.map +1 -0
- package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +442 -430
- package/lib/commonjs/components/listitems/__test__/listitem.test.js +3 -3
- package/lib/commonjs/components/listitems/__test__/listitem.test.js.map +1 -1
- package/lib/commonjs/components/listitems/index.js +11 -11
- package/lib/commonjs/components/listitems/index.js.map +1 -1
- package/lib/commonjs/components/modules/ModuleCredential.js +7 -2
- package/lib/commonjs/components/modules/ModuleCredential.js.map +1 -1
- package/lib/commonjs/components/modules/ModuleNavigation.js +5 -1
- package/lib/commonjs/components/modules/ModuleNavigation.js.map +1 -1
- package/lib/commonjs/components/modules/PressableModuleBase.js +17 -11
- package/lib/commonjs/components/modules/PressableModuleBase.js.map +1 -1
- package/lib/commonjs/components/modules/index.js +8 -8
- package/lib/commonjs/components/modules/index.js.map +1 -1
- package/lib/commonjs/components/numberpad/NumberButton.js +12 -28
- package/lib/commonjs/components/numberpad/NumberButton.js.map +1 -1
- package/lib/commonjs/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +40 -20
- package/lib/commonjs/components/pictograms/Pictogram.js +17 -4
- package/lib/commonjs/components/pictograms/Pictogram.js.map +1 -1
- package/lib/commonjs/components/radio/AnimatedRadio.js +16 -15
- package/lib/commonjs/components/radio/AnimatedRadio.js.map +1 -1
- package/lib/commonjs/components/radio/RadioButtonLabel.js +9 -5
- package/lib/commonjs/components/radio/RadioButtonLabel.js.map +1 -1
- package/lib/commonjs/components/searchInput/SearchInput.js +4 -3
- package/lib/commonjs/components/searchInput/SearchInput.js.map +1 -1
- package/lib/commonjs/components/spacer/Spacer.js +13 -6
- package/lib/commonjs/components/spacer/Spacer.js.map +1 -1
- package/lib/commonjs/components/stack/Stack.js +19 -9
- package/lib/commonjs/components/stack/Stack.js.map +1 -1
- package/lib/commonjs/components/tabs/TabItem.js +15 -21
- package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
- package/lib/commonjs/components/tag/Tag.js +21 -8
- package/lib/commonjs/components/tag/Tag.js.map +1 -1
- package/lib/commonjs/components/textInput/TextInput.js.map +1 -1
- package/lib/commonjs/components/textInput/TextInputBase.js +23 -10
- package/lib/commonjs/components/textInput/TextInputBase.js.map +1 -1
- package/lib/commonjs/components/typography/IOText.js +3 -6
- package/lib/commonjs/components/typography/IOText.js.map +1 -1
- package/lib/commonjs/components/typography/__test__/__snapshots__/ComposedBodyFromArray.test.tsx.snap +84 -84
- package/lib/commonjs/components/typography/__test__/__snapshots__/typography.test.tsx.snap +50 -50
- package/lib/commonjs/core/IOAnimations.js +6 -12
- package/lib/commonjs/core/IOAnimations.js.map +1 -1
- package/lib/commonjs/hooks/index.js +28 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/useListItemAnimation.js +40 -0
- package/lib/commonjs/hooks/useListItemAnimation.js.map +1 -0
- package/lib/commonjs/hooks/useScaleAnimation.js +36 -0
- package/lib/commonjs/hooks/useScaleAnimation.js.map +1 -0
- package/lib/commonjs/index.js +11 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/accessibility.js +29 -1
- package/lib/commonjs/utils/accessibility.js.map +1 -1
- package/lib/commonjs/utils/fonts.js +3 -2
- package/lib/commonjs/utils/fonts.js.map +1 -1
- package/lib/commonjs/utils/hooks/index.js +28 -0
- package/lib/commonjs/utils/hooks/index.js.map +1 -0
- package/lib/commonjs/utils/hooks/useSpringPressProgressValue.js +5 -7
- package/lib/commonjs/utils/hooks/useSpringPressProgressValue.js.map +1 -1
- package/lib/module/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +3 -3
- package/lib/module/components/alert/Alert.js +45 -67
- package/lib/module/components/alert/Alert.js.map +1 -1
- package/lib/module/components/alert/AlertEdgeToEdge.js +10 -31
- package/lib/module/components/alert/AlertEdgeToEdge.js.map +1 -1
- package/lib/module/components/badge/Badge.js +16 -3
- package/lib/module/components/badge/Badge.js.map +1 -1
- package/lib/module/components/badge/__test__/__snapshots__/badge.test.tsx.snap +9 -5
- package/lib/module/components/banner/Banner.js +10 -33
- package/lib/module/components/banner/Banner.js.map +1 -1
- package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +6 -6
- package/lib/module/components/buttons/ButtonLink.js +29 -57
- package/lib/module/components/buttons/ButtonLink.js.map +1 -1
- package/lib/module/components/buttons/ButtonOutline.js +30 -48
- package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/module/components/buttons/ButtonSolid.js +27 -48
- package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/IconButton.js +18 -35
- package/lib/module/components/buttons/IconButton.js.map +1 -1
- package/lib/module/components/buttons/IconButtonContained.js +21 -45
- package/lib/module/components/buttons/IconButtonContained.js.map +1 -1
- package/lib/module/components/buttons/IconButtonSolid.js +18 -34
- package/lib/module/components/buttons/IconButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +61 -19
- package/lib/module/components/checkbox/AnimatedCheckbox.js +23 -18
- package/lib/module/components/checkbox/AnimatedCheckbox.js.map +1 -1
- package/lib/module/components/checkbox/CheckboxLabel.js +14 -9
- package/lib/module/components/checkbox/CheckboxLabel.js.map +1 -1
- package/lib/module/components/common/AnimatedTick.js +7 -3
- package/lib/module/components/common/AnimatedTick.js.map +1 -1
- package/lib/module/components/common/LogoPaymentWithFallback.js +9 -3
- package/lib/module/components/common/LogoPaymentWithFallback.js.map +1 -1
- package/lib/module/components/featureInfo/FeatureInfo.js +11 -8
- package/lib/module/components/featureInfo/FeatureInfo.js.map +1 -1
- package/lib/module/components/icons/Icon.js +15 -6
- package/lib/module/components/icons/Icon.js.map +1 -1
- package/lib/module/components/layout/HeaderFirstLevel.js +8 -11
- package/lib/module/components/layout/HeaderFirstLevel.js.map +1 -1
- package/lib/module/components/layout/HeaderSecondLevel.js +9 -10
- package/lib/module/components/layout/HeaderSecondLevel.js.map +1 -1
- package/lib/module/components/layout/index.js +0 -1
- package/lib/module/components/layout/index.js.map +1 -1
- package/lib/module/components/listitems/ListItemAction.js +25 -48
- package/lib/module/components/listitems/ListItemAction.js.map +1 -1
- package/lib/module/components/listitems/ListItemAmount.js +13 -11
- package/lib/module/components/listitems/ListItemAmount.js.map +1 -1
- package/lib/module/components/listitems/ListItemCheckbox.js +28 -51
- package/lib/module/components/listitems/ListItemCheckbox.js.map +1 -1
- package/lib/module/components/listitems/ListItemHeader.js +11 -4
- package/lib/module/components/listitems/ListItemHeader.js.map +1 -1
- package/lib/module/components/listitems/ListItemInfo.js +14 -17
- package/lib/module/components/listitems/ListItemInfo.js.map +1 -1
- package/lib/module/components/listitems/ListItemInfoCopy.js +30 -57
- package/lib/module/components/listitems/ListItemInfoCopy.js.map +1 -1
- package/lib/module/components/listitems/ListItemNav.js +38 -65
- package/lib/module/components/listitems/ListItemNav.js.map +1 -1
- package/lib/module/components/listitems/ListItemNavAlert.js +33 -58
- package/lib/module/components/listitems/ListItemNavAlert.js.map +1 -1
- package/lib/module/components/listitems/ListItemRadio.js +46 -61
- package/lib/module/components/listitems/ListItemRadio.js.map +1 -1
- package/lib/module/components/listitems/ListItemRadioWithAmount.js +7 -2
- package/lib/module/components/listitems/ListItemRadioWithAmount.js.map +1 -1
- package/lib/module/components/listitems/ListItemSwitch.js +12 -14
- package/lib/module/components/listitems/ListItemSwitch.js.map +1 -1
- package/lib/module/components/listitems/ListItemTransaction.js +3 -1
- package/lib/module/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/module/components/listitems/{PressableListItemsBase.js → PressableListItemBase.js} +7 -7
- package/lib/module/components/listitems/PressableListItemBase.js.map +1 -0
- package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +442 -430
- package/lib/module/components/listitems/__test__/listitem.test.js +1 -1
- package/lib/module/components/listitems/__test__/listitem.test.js.map +1 -1
- package/lib/module/components/listitems/index.js +1 -1
- package/lib/module/components/listitems/index.js.map +1 -1
- package/lib/module/components/modules/ModuleCredential.js +7 -2
- package/lib/module/components/modules/ModuleCredential.js.map +1 -1
- package/lib/module/components/modules/ModuleNavigation.js +5 -1
- package/lib/module/components/modules/ModuleNavigation.js.map +1 -1
- package/lib/module/components/modules/PressableModuleBase.js +17 -10
- package/lib/module/components/modules/PressableModuleBase.js.map +1 -1
- package/lib/module/components/modules/index.js +1 -1
- package/lib/module/components/modules/index.js.map +1 -1
- package/lib/module/components/numberpad/NumberButton.js +14 -30
- package/lib/module/components/numberpad/NumberButton.js.map +1 -1
- package/lib/module/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +40 -20
- package/lib/module/components/pictograms/Pictogram.js +17 -4
- package/lib/module/components/pictograms/Pictogram.js.map +1 -1
- package/lib/module/components/radio/AnimatedRadio.js +16 -15
- package/lib/module/components/radio/AnimatedRadio.js.map +1 -1
- package/lib/module/components/radio/RadioButtonLabel.js +10 -6
- package/lib/module/components/radio/RadioButtonLabel.js.map +1 -1
- package/lib/module/components/searchInput/SearchInput.js +5 -4
- package/lib/module/components/searchInput/SearchInput.js.map +1 -1
- package/lib/module/components/spacer/Spacer.js +11 -5
- package/lib/module/components/spacer/Spacer.js.map +1 -1
- package/lib/module/components/stack/Stack.js +19 -9
- package/lib/module/components/stack/Stack.js.map +1 -1
- package/lib/module/components/tabs/TabItem.js +18 -24
- package/lib/module/components/tabs/TabItem.js.map +1 -1
- package/lib/module/components/tag/Tag.js +21 -8
- package/lib/module/components/tag/Tag.js.map +1 -1
- package/lib/module/components/textInput/TextInput.js.map +1 -1
- package/lib/module/components/textInput/TextInputBase.js +23 -10
- package/lib/module/components/textInput/TextInputBase.js.map +1 -1
- package/lib/module/components/typography/IOText.js +5 -8
- package/lib/module/components/typography/IOText.js.map +1 -1
- package/lib/module/components/typography/__test__/__snapshots__/ComposedBodyFromArray.test.tsx.snap +84 -84
- package/lib/module/components/typography/__test__/__snapshots__/typography.test.tsx.snap +50 -50
- package/lib/module/core/IOAnimations.js +4 -10
- package/lib/module/core/IOAnimations.js.map +1 -1
- package/lib/module/hooks/index.js +3 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/useListItemAnimation.js +33 -0
- package/lib/module/hooks/useListItemAnimation.js.map +1 -0
- package/lib/module/hooks/useScaleAnimation.js +29 -0
- package/lib/module/hooks/useScaleAnimation.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/accessibility.js +28 -1
- package/lib/module/utils/accessibility.js.map +1 -1
- package/lib/module/utils/fonts.js +1 -0
- package/lib/module/utils/fonts.js.map +1 -1
- package/lib/module/utils/hooks/index.js +3 -0
- package/lib/module/utils/hooks/index.js.map +1 -0
- package/lib/module/utils/hooks/useSpringPressProgressValue.js +5 -5
- package/lib/module/utils/hooks/useSpringPressProgressValue.js.map +1 -1
- package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
- package/lib/typescript/components/alert/AlertEdgeToEdge.d.ts.map +1 -1
- package/lib/typescript/components/badge/Badge.d.ts +2 -1
- package/lib/typescript/components/badge/Badge.d.ts.map +1 -1
- package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonLink.d.ts +1 -1
- package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonOutline.d.ts +1 -1
- package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonSolid.d.ts +1 -1
- package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IconButton.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IconButtonContained.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IconButtonSolid.d.ts.map +1 -1
- package/lib/typescript/components/checkbox/AnimatedCheckbox.d.ts +2 -1
- package/lib/typescript/components/checkbox/AnimatedCheckbox.d.ts.map +1 -1
- package/lib/typescript/components/checkbox/CheckboxLabel.d.ts +2 -1
- package/lib/typescript/components/checkbox/CheckboxLabel.d.ts.map +1 -1
- package/lib/typescript/components/common/AnimatedTick.d.ts +4 -3
- package/lib/typescript/components/common/AnimatedTick.d.ts.map +1 -1
- package/lib/typescript/components/common/LogoPaymentWithFallback.d.ts.map +1 -1
- package/lib/typescript/components/featureInfo/FeatureInfo.d.ts.map +1 -1
- package/lib/typescript/components/icons/Icon.d.ts +5 -3
- package/lib/typescript/components/icons/Icon.d.ts.map +1 -1
- package/lib/typescript/components/layout/HeaderFirstLevel.d.ts.map +1 -1
- package/lib/typescript/components/layout/HeaderSecondLevel.d.ts.map +1 -1
- package/lib/typescript/components/layout/index.d.ts +0 -1
- package/lib/typescript/components/layout/index.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemAction.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemAmount.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemCheckbox.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemHeader.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemInfo.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemInfoCopy.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemNav.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemNavAlert.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemRadio.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemRadioWithAmount.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemSwitch.d.ts +2 -2
- package/lib/typescript/components/listitems/ListItemSwitch.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemTransaction.d.ts +1 -1
- package/lib/typescript/components/listitems/ListItemTransaction.d.ts.map +1 -1
- package/lib/typescript/components/listitems/{PressableListItemsBase.d.ts → PressableListItemBase.d.ts} +3 -2
- package/lib/typescript/components/listitems/PressableListItemBase.d.ts.map +1 -0
- package/lib/typescript/components/listitems/index.d.ts +1 -1
- package/lib/typescript/components/listitems/index.d.ts.map +1 -1
- package/lib/typescript/components/modules/ModuleCredential.d.ts.map +1 -1
- package/lib/typescript/components/modules/ModuleNavigation.d.ts.map +1 -1
- package/lib/typescript/components/modules/PressableModuleBase.d.ts.map +1 -1
- package/lib/typescript/components/modules/index.d.ts +1 -1
- package/lib/typescript/components/modules/index.d.ts.map +1 -1
- package/lib/typescript/components/numberpad/NumberButton.d.ts.map +1 -1
- package/lib/typescript/components/pictograms/Pictogram.d.ts +5 -3
- package/lib/typescript/components/pictograms/Pictogram.d.ts.map +1 -1
- package/lib/typescript/components/pictograms/types.d.ts +1 -2
- package/lib/typescript/components/pictograms/types.d.ts.map +1 -1
- package/lib/typescript/components/radio/AnimatedRadio.d.ts +2 -1
- package/lib/typescript/components/radio/AnimatedRadio.d.ts.map +1 -1
- package/lib/typescript/components/radio/RadioButtonLabel.d.ts +2 -1
- package/lib/typescript/components/radio/RadioButtonLabel.d.ts.map +1 -1
- package/lib/typescript/components/searchInput/SearchInput.d.ts.map +1 -1
- package/lib/typescript/components/spacer/Spacer.d.ts +1 -0
- package/lib/typescript/components/spacer/Spacer.d.ts.map +1 -1
- package/lib/typescript/components/stack/Stack.d.ts +2 -1
- package/lib/typescript/components/stack/Stack.d.ts.map +1 -1
- package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -1
- package/lib/typescript/components/tag/Tag.d.ts +4 -2
- package/lib/typescript/components/tag/Tag.d.ts.map +1 -1
- package/lib/typescript/components/textInput/TextInput.d.ts +2 -1
- package/lib/typescript/components/textInput/TextInput.d.ts.map +1 -1
- package/lib/typescript/components/textInput/TextInputBase.d.ts.map +1 -1
- package/lib/typescript/components/typography/BodyMonospace.d.ts +1 -1
- package/lib/typescript/components/typography/ButtonText.d.ts +1 -1
- package/lib/typescript/components/typography/Caption.d.ts +1 -1
- package/lib/typescript/components/typography/H1.d.ts +1 -1
- package/lib/typescript/components/typography/H2.d.ts +1 -1
- package/lib/typescript/components/typography/H3.d.ts +1 -1
- package/lib/typescript/components/typography/H4.d.ts +1 -1
- package/lib/typescript/components/typography/H5.d.ts +1 -1
- package/lib/typescript/components/typography/H6.d.ts +1 -1
- package/lib/typescript/components/typography/Hero.d.ts +1 -1
- package/lib/typescript/components/typography/IOText.d.ts.map +1 -1
- package/lib/typescript/components/typography/markdown/MdH1.d.ts +1 -1
- package/lib/typescript/components/typography/markdown/MdH2.d.ts +1 -1
- package/lib/typescript/components/typography/markdown/MdH3.d.ts +1 -1
- package/lib/typescript/core/IOAnimations.d.ts +6 -10
- package/lib/typescript/core/IOAnimations.d.ts.map +1 -1
- package/lib/typescript/core/IOStyles.d.ts +7 -7
- package/lib/typescript/hooks/index.d.ts +3 -0
- package/lib/typescript/hooks/index.d.ts.map +1 -0
- package/lib/typescript/hooks/useListItemAnimation.d.ts +10 -0
- package/lib/typescript/hooks/useListItemAnimation.d.ts.map +1 -0
- package/lib/typescript/hooks/useScaleAnimation.d.ts +10 -0
- package/lib/typescript/hooks/useScaleAnimation.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/accessibility.d.ts +10 -0
- package/lib/typescript/utils/accessibility.d.ts.map +1 -1
- package/lib/typescript/utils/fonts.d.ts +2 -1
- package/lib/typescript/utils/fonts.d.ts.map +1 -1
- package/lib/typescript/utils/hooks/index.d.ts +3 -0
- package/lib/typescript/utils/hooks/index.d.ts.map +1 -0
- package/lib/typescript/utils/hooks/useSpringPressProgressValue.d.ts +7 -8
- package/lib/typescript/utils/hooks/useSpringPressProgressValue.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +3 -3
- package/src/components/alert/Alert.tsx +49 -106
- package/src/components/alert/AlertEdgeToEdge.tsx +6 -46
- package/src/components/badge/Badge.tsx +29 -4
- package/src/components/badge/__test__/__snapshots__/badge.test.tsx.snap +9 -5
- package/src/components/banner/Banner.tsx +6 -54
- package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +6 -6
- package/src/components/buttons/ButtonLink.tsx +36 -89
- package/src/components/buttons/ButtonOutline.tsx +40 -75
- package/src/components/buttons/ButtonSolid.tsx +21 -67
- package/src/components/buttons/IconButton.tsx +12 -47
- package/src/components/buttons/IconButtonContained.tsx +21 -57
- package/src/components/buttons/IconButtonSolid.tsx +16 -46
- package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +61 -19
- package/src/components/checkbox/AnimatedCheckbox.tsx +36 -18
- package/src/components/checkbox/CheckboxLabel.tsx +22 -10
- package/src/components/common/AnimatedTick.tsx +9 -3
- package/src/components/common/LogoPaymentWithFallback.tsx +27 -5
- package/src/components/featureInfo/FeatureInfo.tsx +13 -9
- package/src/components/icons/Icon.tsx +23 -7
- package/src/components/layout/HeaderFirstLevel.tsx +11 -21
- package/src/components/layout/HeaderSecondLevel.tsx +5 -14
- package/src/components/layout/index.tsx +0 -1
- package/src/components/listitems/ListItemAction.tsx +28 -73
- package/src/components/listitems/ListItemAmount.tsx +16 -11
- package/src/components/listitems/ListItemCheckbox.tsx +39 -83
- package/src/components/listitems/ListItemHeader.tsx +14 -4
- package/src/components/listitems/ListItemInfo.tsx +27 -20
- package/src/components/listitems/ListItemInfoCopy.tsx +37 -86
- package/src/components/listitems/ListItemNav.tsx +55 -112
- package/src/components/listitems/ListItemNavAlert.tsx +42 -102
- package/src/components/listitems/ListItemRadio.tsx +60 -107
- package/src/components/listitems/ListItemRadioWithAmount.tsx +9 -3
- package/src/components/listitems/ListItemSwitch.tsx +21 -27
- package/src/components/listitems/ListItemTransaction.tsx +4 -1
- package/src/components/listitems/{PressableListItemsBase.tsx → PressableListItemBase.tsx} +7 -6
- package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +442 -430
- package/src/components/listitems/__test__/listitem.test.tsx +1 -1
- package/src/components/listitems/index.tsx +1 -1
- package/src/components/modules/ModuleCredential.tsx +5 -2
- package/src/components/modules/ModuleNavigation.tsx +3 -1
- package/src/components/modules/PressableModuleBase.tsx +15 -8
- package/src/components/modules/index.tsx +1 -1
- package/src/components/numberpad/NumberButton.tsx +12 -43
- package/src/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +40 -20
- package/src/components/pictograms/Pictogram.tsx +24 -5
- package/src/components/pictograms/types.ts +1 -3
- package/src/components/radio/AnimatedRadio.tsx +31 -15
- package/src/components/radio/RadioButtonLabel.tsx +16 -8
- package/src/components/searchInput/SearchInput.tsx +10 -5
- package/src/components/spacer/Spacer.tsx +21 -6
- package/src/components/stack/Stack.tsx +25 -14
- package/src/components/tabs/TabItem.tsx +15 -29
- package/src/components/tag/Tag.tsx +26 -8
- package/src/components/textInput/TextInput.tsx +2 -1
- package/src/components/textInput/TextInputBase.tsx +44 -11
- package/src/components/typography/IOText.tsx +5 -6
- package/src/components/typography/__test__/__snapshots__/ComposedBodyFromArray.test.tsx.snap +84 -84
- package/src/components/typography/__test__/__snapshots__/typography.test.tsx.snap +50 -50
- package/src/core/IOAnimations.ts +8 -10
- package/src/hooks/index.tsx +2 -0
- package/src/hooks/useListItemAnimation.tsx +59 -0
- package/src/hooks/useScaleAnimation.tsx +41 -0
- package/src/index.tsx +1 -0
- package/src/utils/accessibility.ts +32 -1
- package/src/utils/fonts.ts +1 -0
- package/src/utils/hooks/index.tsx +2 -0
- package/src/utils/hooks/useSpringPressProgressValue.ts +14 -8
- package/lib/commonjs/components/layout/FooterWithButtons.js +0 -84
- package/lib/commonjs/components/layout/FooterWithButtons.js.map +0 -1
- package/lib/commonjs/components/listitems/PressableListItemsBase.js.map +0 -1
- package/lib/commonjs/components/listitems/hooks/useListItemSpringAnimation.js +0 -56
- package/lib/commonjs/components/listitems/hooks/useListItemSpringAnimation.js.map +0 -1
- package/lib/commonjs/components/modules/hooks/useModuleSpringAnimation.js +0 -41
- package/lib/commonjs/components/modules/hooks/useModuleSpringAnimation.js.map +0 -1
- package/lib/module/components/layout/FooterWithButtons.js +0 -75
- package/lib/module/components/layout/FooterWithButtons.js.map +0 -1
- package/lib/module/components/listitems/PressableListItemsBase.js.map +0 -1
- package/lib/module/components/listitems/hooks/useListItemSpringAnimation.js +0 -47
- package/lib/module/components/listitems/hooks/useListItemSpringAnimation.js.map +0 -1
- package/lib/module/components/modules/hooks/useModuleSpringAnimation.js +0 -34
- package/lib/module/components/modules/hooks/useModuleSpringAnimation.js.map +0 -1
- package/lib/typescript/components/layout/FooterWithButtons.d.ts +0 -16
- package/lib/typescript/components/layout/FooterWithButtons.d.ts.map +0 -1
- package/lib/typescript/components/listitems/PressableListItemsBase.d.ts.map +0 -1
- package/lib/typescript/components/listitems/hooks/useListItemSpringAnimation.d.ts +0 -13
- package/lib/typescript/components/listitems/hooks/useListItemSpringAnimation.d.ts.map +0 -1
- package/lib/typescript/components/modules/hooks/useModuleSpringAnimation.d.ts +0 -10
- package/lib/typescript/components/modules/hooks/useModuleSpringAnimation.d.ts.map +0 -1
- package/src/components/layout/FooterWithButtons.tsx +0 -90
- package/src/components/listitems/hooks/useListItemSpringAnimation.ts +0 -72
- package/src/components/modules/hooks/useModuleSpringAnimation.ts +0 -49
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { forwardRef, useMemo } from "react";
|
|
2
2
|
import { GestureResponderEvent, Pressable, View } from "react-native";
|
|
3
3
|
import Animated, {
|
|
4
|
-
Extrapolate,
|
|
5
|
-
interpolate,
|
|
6
4
|
interpolateColor,
|
|
7
|
-
useAnimatedProps,
|
|
8
5
|
useAnimatedStyle,
|
|
9
|
-
|
|
10
|
-
useSharedValue,
|
|
11
|
-
withSpring
|
|
6
|
+
useReducedMotion
|
|
12
7
|
} from "react-native-reanimated";
|
|
13
8
|
import {
|
|
14
9
|
IOButtonStyles,
|
|
15
10
|
IOColors,
|
|
16
|
-
|
|
17
|
-
IOSpringValues,
|
|
11
|
+
IOSpacingScale,
|
|
18
12
|
hexToRgba,
|
|
19
13
|
useIOExperimentalDesign
|
|
20
14
|
} from "../../core";
|
|
15
|
+
import { useScaleAnimation } from "../../hooks";
|
|
21
16
|
import { WithTestID } from "../../utils/types";
|
|
22
17
|
import {
|
|
23
18
|
AnimatedIcon,
|
|
@@ -25,7 +20,6 @@ import {
|
|
|
25
20
|
IOIcons,
|
|
26
21
|
IconClassComponent
|
|
27
22
|
} from "../icons";
|
|
28
|
-
import { HSpacer } from "../spacer/Spacer";
|
|
29
23
|
import { IOText, buttonTextFontSize } from "../typography";
|
|
30
24
|
|
|
31
25
|
export type ColorButtonLink = "primary" | "contrast";
|
|
@@ -96,8 +90,9 @@ const mapLegacyColorStates: Record<
|
|
|
96
90
|
};
|
|
97
91
|
|
|
98
92
|
const DISABLED_OPACITY = 0.5;
|
|
93
|
+
const ICON_MARGIN = 8;
|
|
99
94
|
|
|
100
|
-
export const ButtonLink =
|
|
95
|
+
export const ButtonLink = forwardRef<View, ButtonLinkProps>(
|
|
101
96
|
(
|
|
102
97
|
{
|
|
103
98
|
color = "primary",
|
|
@@ -112,8 +107,10 @@ export const ButtonLink = React.forwardRef<View, ButtonLinkProps>(
|
|
|
112
107
|
},
|
|
113
108
|
ref
|
|
114
109
|
) => {
|
|
115
|
-
const isPressed = useSharedValue(0);
|
|
116
110
|
const { isExperimental } = useIOExperimentalDesign();
|
|
111
|
+
const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
|
|
112
|
+
useScaleAnimation();
|
|
113
|
+
const reducedMotion = useReducedMotion();
|
|
117
114
|
|
|
118
115
|
const colorMap = useMemo(
|
|
119
116
|
() => (isExperimental ? mapColorStates : mapLegacyColorStates),
|
|
@@ -122,70 +119,20 @@ export const ButtonLink = React.forwardRef<View, ButtonLinkProps>(
|
|
|
122
119
|
|
|
123
120
|
const AnimatedIOText = Animated.createAnimatedComponent(IOText);
|
|
124
121
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
// Using a spring-based animation for our interpolations
|
|
129
|
-
const progressPressed = useDerivedValue(() =>
|
|
130
|
-
withSpring(isPressed.value, IOSpringValues.button)
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
// Interpolate animation values from `isPressed` values
|
|
134
|
-
const pressedAnimationStyle = useAnimatedStyle(() => {
|
|
135
|
-
// Link color states to the pressed states
|
|
136
|
-
|
|
137
|
-
// Scale down button slightly when pressed
|
|
138
|
-
const scale = interpolate(
|
|
139
|
-
progressPressed.value,
|
|
140
|
-
[0, 1],
|
|
141
|
-
[1, animationScaleValue],
|
|
142
|
-
Extrapolate.CLAMP
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
return {
|
|
146
|
-
transform: [{ scale }]
|
|
147
|
-
};
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
const pressedColorLabelAnimationStyle = useAnimatedStyle(() => {
|
|
151
|
-
// Link color states to the pressed states
|
|
152
|
-
|
|
153
|
-
const labelColor = interpolateColor(
|
|
154
|
-
progressPressed.value,
|
|
122
|
+
const pressedColorAnimationStyle = useAnimatedStyle(() => ({
|
|
123
|
+
color: interpolateColor(
|
|
124
|
+
progress.value,
|
|
155
125
|
[0, 1],
|
|
156
126
|
[colorMap[color].label.default, colorMap[color].label.pressed]
|
|
157
|
-
)
|
|
158
|
-
|
|
159
|
-
return {
|
|
160
|
-
color: labelColor
|
|
161
|
-
};
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
// Animate the <Icon> color prop
|
|
165
|
-
const pressedColorIconAnimationStyle = useAnimatedProps(() => {
|
|
166
|
-
const iconColor = interpolateColor(
|
|
167
|
-
progressPressed.value,
|
|
168
|
-
[0, 1],
|
|
169
|
-
[colorMap[color].label.default, colorMap[color].label.pressed]
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
return { color: iconColor };
|
|
173
|
-
});
|
|
127
|
+
)
|
|
128
|
+
}));
|
|
174
129
|
|
|
175
130
|
const AnimatedIconClassComponent =
|
|
176
131
|
Animated.createAnimatedComponent(IconClassComponent);
|
|
177
132
|
|
|
178
|
-
const onPressIn = useCallback(() => {
|
|
179
|
-
// eslint-disable-next-line functional/immutable-data
|
|
180
|
-
isPressed.value = 1;
|
|
181
|
-
}, [isPressed]);
|
|
182
|
-
const onPressOut = useCallback(() => {
|
|
183
|
-
// eslint-disable-next-line functional/immutable-data
|
|
184
|
-
isPressed.value = 0;
|
|
185
|
-
}, [isPressed]);
|
|
186
|
-
|
|
187
133
|
// Icon size
|
|
188
134
|
const iconSize: IOIconSizeScale = 24;
|
|
135
|
+
const iconMargin: IOSpacingScale = 8;
|
|
189
136
|
|
|
190
137
|
return (
|
|
191
138
|
<Pressable
|
|
@@ -208,31 +155,31 @@ export const ButtonLink = React.forwardRef<View, ButtonLinkProps>(
|
|
|
208
155
|
style={[
|
|
209
156
|
IOButtonStyles.buttonLink,
|
|
210
157
|
iconPosition === "end" && { flexDirection: "row-reverse" },
|
|
158
|
+
{ columnGap: iconMargin },
|
|
211
159
|
disabled ? { opacity: DISABLED_OPACITY } : {},
|
|
160
|
+
{ columnGap: ICON_MARGIN },
|
|
212
161
|
/* Prevent Reanimated from overriding background colors
|
|
213
162
|
if button is disabled */
|
|
214
|
-
!disabled &&
|
|
163
|
+
!disabled && !reducedMotion && scaleAnimatedStyle
|
|
215
164
|
]}
|
|
216
165
|
>
|
|
217
|
-
{icon &&
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
</>
|
|
235
|
-
)}
|
|
166
|
+
{icon &&
|
|
167
|
+
(!disabled ? (
|
|
168
|
+
<AnimatedIconClassComponent
|
|
169
|
+
allowFontScaling
|
|
170
|
+
name={icon}
|
|
171
|
+
animatedProps={pressedColorAnimationStyle}
|
|
172
|
+
color={colorMap[color]?.label?.default}
|
|
173
|
+
size={iconSize}
|
|
174
|
+
/>
|
|
175
|
+
) : (
|
|
176
|
+
<AnimatedIcon
|
|
177
|
+
allowFontScaling
|
|
178
|
+
name={icon}
|
|
179
|
+
color={colorMap[color]?.label?.disabled}
|
|
180
|
+
size={iconSize}
|
|
181
|
+
/>
|
|
182
|
+
))}
|
|
236
183
|
<AnimatedIOText
|
|
237
184
|
accessible={false}
|
|
238
185
|
accessibilityElementsHidden
|
|
@@ -243,7 +190,7 @@ export const ButtonLink = React.forwardRef<View, ButtonLinkProps>(
|
|
|
243
190
|
style={
|
|
244
191
|
disabled
|
|
245
192
|
? { color: colorMap[color]?.label?.disabled }
|
|
246
|
-
: { ...
|
|
193
|
+
: { ...pressedColorAnimationStyle }
|
|
247
194
|
}
|
|
248
195
|
numberOfLines={1}
|
|
249
196
|
ellipsizeMode="tail"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ComponentProps,
|
|
1
|
+
import React, { ComponentProps, forwardRef } from "react";
|
|
2
2
|
import {
|
|
3
3
|
GestureResponderEvent,
|
|
4
4
|
Pressable,
|
|
@@ -6,24 +6,19 @@ import {
|
|
|
6
6
|
View
|
|
7
7
|
} from "react-native";
|
|
8
8
|
import Animated, {
|
|
9
|
-
Extrapolate,
|
|
10
|
-
interpolate,
|
|
11
9
|
interpolateColor,
|
|
12
10
|
useAnimatedProps,
|
|
13
11
|
useAnimatedStyle,
|
|
14
|
-
|
|
15
|
-
useSharedValue,
|
|
16
|
-
withSpring
|
|
12
|
+
useReducedMotion
|
|
17
13
|
} from "react-native-reanimated";
|
|
18
14
|
import {
|
|
19
15
|
IOButtonLegacyStyles,
|
|
20
16
|
IOButtonStyles,
|
|
21
17
|
IOColors,
|
|
22
|
-
IOScaleValues,
|
|
23
|
-
IOSpringValues,
|
|
24
18
|
hexToRgba,
|
|
25
19
|
useIOExperimentalDesign
|
|
26
20
|
} from "../../core/";
|
|
21
|
+
import { useScaleAnimation } from "../../hooks";
|
|
27
22
|
import { WithTestID } from "../../utils/types";
|
|
28
23
|
import {
|
|
29
24
|
AnimatedIcon,
|
|
@@ -31,7 +26,6 @@ import {
|
|
|
31
26
|
IOIcons,
|
|
32
27
|
IconClassComponent
|
|
33
28
|
} from "../icons";
|
|
34
|
-
import { HSpacer } from "../spacer/Spacer";
|
|
35
29
|
import { IOText, buttonTextFontSize } from "../typography";
|
|
36
30
|
|
|
37
31
|
type ColorButtonOutline = "primary" | "contrast" | "danger";
|
|
@@ -201,6 +195,7 @@ const IOButtonLegacyStylesLocal = StyleSheet.create({
|
|
|
201
195
|
const iconSize: IOIconSizeScale = 20;
|
|
202
196
|
|
|
203
197
|
const DISABLED_OPACITY = 0.5;
|
|
198
|
+
const ICON_MARGIN = 8;
|
|
204
199
|
|
|
205
200
|
const IOButtonStylesLocal = StyleSheet.create({
|
|
206
201
|
buttonWithBorder: {
|
|
@@ -208,7 +203,7 @@ const IOButtonStylesLocal = StyleSheet.create({
|
|
|
208
203
|
}
|
|
209
204
|
});
|
|
210
205
|
|
|
211
|
-
export const ButtonOutline =
|
|
206
|
+
export const ButtonOutline = forwardRef<View, ButtonOutline>(
|
|
212
207
|
(
|
|
213
208
|
{
|
|
214
209
|
color = "primary",
|
|
@@ -225,7 +220,9 @@ export const ButtonOutline = React.forwardRef<View, ButtonOutline>(
|
|
|
225
220
|
ref
|
|
226
221
|
) => {
|
|
227
222
|
const { isExperimental } = useIOExperimentalDesign();
|
|
228
|
-
const
|
|
223
|
+
const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
|
|
224
|
+
useScaleAnimation();
|
|
225
|
+
const reducedMotion = useReducedMotion();
|
|
229
226
|
|
|
230
227
|
const AnimatedIOText = Animated.createAnimatedComponent(IOText);
|
|
231
228
|
|
|
@@ -243,80 +240,48 @@ export const ButtonOutline = React.forwardRef<View, ButtonOutline>(
|
|
|
243
240
|
() => (isExperimental ? IOButtonStylesLocal : IOButtonLegacyStylesLocal),
|
|
244
241
|
[isExperimental]
|
|
245
242
|
);
|
|
246
|
-
// Scaling transformation applied when the button is pressed
|
|
247
|
-
const animationScaleValue = IOScaleValues?.basicButton?.pressedState;
|
|
248
|
-
|
|
249
|
-
// Using a spring-based animation for our interpolations
|
|
250
|
-
const progressPressed = useDerivedValue(() =>
|
|
251
|
-
withSpring(isPressed.value, IOSpringValues.button)
|
|
252
|
-
);
|
|
253
243
|
|
|
254
244
|
// Interpolate animation values from `isPressed` values
|
|
255
245
|
const pressedAnimationStyle = useAnimatedStyle(() => {
|
|
256
246
|
// Link color states to the pressed states
|
|
257
247
|
const backgroundColor = interpolateColor(
|
|
258
|
-
|
|
248
|
+
progress.value,
|
|
259
249
|
[0, 1],
|
|
260
250
|
[colorMap[color].background.default, colorMap[color].background.pressed]
|
|
261
251
|
);
|
|
262
252
|
|
|
263
253
|
const borderColor = interpolateColor(
|
|
264
|
-
|
|
254
|
+
progress.value,
|
|
265
255
|
[0, 1],
|
|
266
256
|
[colorMap[color].border.default, colorMap[color].border.pressed]
|
|
267
257
|
);
|
|
268
258
|
|
|
269
|
-
// Scale down button slightly when pressed
|
|
270
|
-
const scale = interpolate(
|
|
271
|
-
progressPressed.value,
|
|
272
|
-
[0, 1],
|
|
273
|
-
[1, animationScaleValue],
|
|
274
|
-
Extrapolate.CLAMP
|
|
275
|
-
);
|
|
276
|
-
|
|
277
259
|
return {
|
|
278
260
|
borderColor,
|
|
279
|
-
backgroundColor
|
|
280
|
-
transform: [{ scale }]
|
|
261
|
+
backgroundColor
|
|
281
262
|
};
|
|
282
263
|
});
|
|
283
264
|
|
|
284
|
-
const pressedColorLabelAnimationStyle = useAnimatedStyle(() => {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
const labelColor = interpolateColor(
|
|
288
|
-
progressPressed.value,
|
|
265
|
+
const pressedColorLabelAnimationStyle = useAnimatedStyle(() => ({
|
|
266
|
+
color: interpolateColor(
|
|
267
|
+
progress.value,
|
|
289
268
|
[0, 1],
|
|
290
269
|
[colorMap[color].border.default, colorMap[color].border.pressed]
|
|
291
|
-
)
|
|
292
|
-
|
|
293
|
-
return {
|
|
294
|
-
color: labelColor
|
|
295
|
-
};
|
|
296
|
-
});
|
|
270
|
+
)
|
|
271
|
+
}));
|
|
297
272
|
|
|
298
273
|
// Animate the <Icon> color prop
|
|
299
|
-
const pressedColorIconAnimationStyle = useAnimatedProps(() => {
|
|
300
|
-
|
|
301
|
-
|
|
274
|
+
const pressedColorIconAnimationStyle = useAnimatedProps(() => ({
|
|
275
|
+
color: interpolateColor(
|
|
276
|
+
progress.value,
|
|
302
277
|
[0, 1],
|
|
303
278
|
[colorMap[color].label.default, colorMap[color].label.pressed]
|
|
304
|
-
)
|
|
305
|
-
|
|
306
|
-
});
|
|
279
|
+
)
|
|
280
|
+
}));
|
|
307
281
|
|
|
308
282
|
const AnimatedIconClassComponent =
|
|
309
283
|
Animated.createAnimatedComponent(IconClassComponent);
|
|
310
284
|
|
|
311
|
-
const onPressIn = useCallback(() => {
|
|
312
|
-
// eslint-disable-next-line functional/immutable-data
|
|
313
|
-
isPressed.value = 1;
|
|
314
|
-
}, [isPressed]);
|
|
315
|
-
const onPressOut = useCallback(() => {
|
|
316
|
-
// eslint-disable-next-line functional/immutable-data
|
|
317
|
-
isPressed.value = 0;
|
|
318
|
-
}, [isPressed]);
|
|
319
|
-
|
|
320
285
|
return (
|
|
321
286
|
<Pressable
|
|
322
287
|
ref={ref}
|
|
@@ -338,6 +303,7 @@ export const ButtonOutline = React.forwardRef<View, ButtonOutline>(
|
|
|
338
303
|
isExperimental && fullWidth && { paddingHorizontal: 16 },
|
|
339
304
|
buttonStylesLocal.buttonWithBorder,
|
|
340
305
|
buttonStyles.buttonSizeDefault,
|
|
306
|
+
{ columnGap: ICON_MARGIN },
|
|
341
307
|
iconPosition === "end" && { flexDirection: "row-reverse" },
|
|
342
308
|
disabled
|
|
343
309
|
? {
|
|
@@ -351,28 +317,27 @@ export const ButtonOutline = React.forwardRef<View, ButtonOutline>(
|
|
|
351
317
|
},
|
|
352
318
|
/* Prevent Reanimated from overriding background colors
|
|
353
319
|
if button is disabled */
|
|
320
|
+
!reducedMotion && !disabled && scaleAnimatedStyle,
|
|
354
321
|
!disabled && pressedAnimationStyle
|
|
355
322
|
]}
|
|
356
323
|
>
|
|
357
|
-
{icon &&
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
</>
|
|
375
|
-
)}
|
|
324
|
+
{icon &&
|
|
325
|
+
(!disabled ? (
|
|
326
|
+
<AnimatedIconClassComponent
|
|
327
|
+
allowFontScaling
|
|
328
|
+
name={icon}
|
|
329
|
+
animatedProps={pressedColorIconAnimationStyle}
|
|
330
|
+
color={colorMap[color]?.label?.default}
|
|
331
|
+
size={iconSize}
|
|
332
|
+
/>
|
|
333
|
+
) : (
|
|
334
|
+
<AnimatedIcon
|
|
335
|
+
allowFontScaling
|
|
336
|
+
name={icon}
|
|
337
|
+
color={colorMap[color]?.label?.disabled}
|
|
338
|
+
size={iconSize}
|
|
339
|
+
/>
|
|
340
|
+
))}
|
|
376
341
|
<AnimatedIOText
|
|
377
342
|
font={isExperimental ? "Titillio" : "TitilliumSansPro"}
|
|
378
343
|
weight={"Semibold"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ComponentProps, useCallback
|
|
1
|
+
import React, { ComponentProps, useCallback } from "react";
|
|
2
2
|
import {
|
|
3
3
|
GestureResponderEvent,
|
|
4
4
|
Pressable,
|
|
@@ -7,29 +7,23 @@ import {
|
|
|
7
7
|
} from "react-native";
|
|
8
8
|
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
9
9
|
import Animated, {
|
|
10
|
-
Extrapolate,
|
|
11
|
-
interpolate,
|
|
12
10
|
interpolateColor,
|
|
13
11
|
useAnimatedStyle,
|
|
14
|
-
|
|
15
|
-
useSharedValue,
|
|
16
|
-
withSpring
|
|
12
|
+
useReducedMotion
|
|
17
13
|
} from "react-native-reanimated";
|
|
18
14
|
import {
|
|
19
15
|
IOButtonLegacyStyles,
|
|
20
16
|
IOButtonStyles,
|
|
21
17
|
IOColors,
|
|
22
|
-
IOScaleValues,
|
|
23
|
-
IOSpringValues,
|
|
24
18
|
enterTransitionInnerContent,
|
|
25
19
|
enterTransitionInnerContentSmall,
|
|
26
20
|
exitTransitionInnerContent,
|
|
27
21
|
useIOExperimentalDesign
|
|
28
22
|
} from "../../core";
|
|
23
|
+
import { useScaleAnimation } from "../../hooks";
|
|
29
24
|
import { WithTestID } from "../../utils/types";
|
|
30
25
|
import { IOIconSizeScale, IOIcons, Icon } from "../icons";
|
|
31
26
|
import { LoadingSpinner } from "../loadingSpinner";
|
|
32
|
-
import { HSpacer } from "../spacer/Spacer";
|
|
33
27
|
import { ButtonText } from "../typography/ButtonText";
|
|
34
28
|
|
|
35
29
|
export type ButtonSolidColor = "primary" | "danger" | "contrast";
|
|
@@ -53,6 +47,7 @@ const legacyStyles = StyleSheet.create({
|
|
|
53
47
|
});
|
|
54
48
|
|
|
55
49
|
const colorPrimaryButtonDisabled: IOColors = "grey-200";
|
|
50
|
+
const ICON_MARGIN = 8;
|
|
56
51
|
const DISABLED_OPACITY = 0.5;
|
|
57
52
|
|
|
58
53
|
// Icon size
|
|
@@ -176,21 +171,10 @@ export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
|
|
|
176
171
|
},
|
|
177
172
|
ref
|
|
178
173
|
) => {
|
|
179
|
-
const isPressed = useSharedValue(0);
|
|
180
174
|
const { isExperimental } = useIOExperimentalDesign();
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
/* Prevent the component from triggering the `isEntering' transition
|
|
185
|
-
on the on the first render. Solution from this discussion:
|
|
186
|
-
https://github.com/software-mansion/react-native-reanimated/discussions/2513
|
|
187
|
-
*/
|
|
188
|
-
const isMounted = useRef(false);
|
|
189
|
-
|
|
190
|
-
useEffect(() => {
|
|
191
|
-
// eslint-disable-next-line functional/immutable-data
|
|
192
|
-
isMounted.current = true;
|
|
193
|
-
}, []);
|
|
175
|
+
const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
|
|
176
|
+
useScaleAnimation();
|
|
177
|
+
const reducedMotion = useReducedMotion();
|
|
194
178
|
|
|
195
179
|
const colorMap = React.useMemo(
|
|
196
180
|
() => (isExperimental ? mapColorStates : mapLegacyColorStates),
|
|
@@ -202,43 +186,18 @@ export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
|
|
|
202
186
|
[isExperimental]
|
|
203
187
|
);
|
|
204
188
|
|
|
205
|
-
// Using a spring-based animation for our interpolations
|
|
206
|
-
const progressPressed = useDerivedValue(() =>
|
|
207
|
-
withSpring(isPressed.value, IOSpringValues.button)
|
|
208
|
-
);
|
|
209
|
-
|
|
210
189
|
// Interpolate animation values from `isPressed` values
|
|
211
190
|
const pressedAnimationStyle = useAnimatedStyle(() => {
|
|
212
191
|
// Link color states to the pressed states
|
|
213
192
|
const backgroundColor = interpolateColor(
|
|
214
|
-
|
|
193
|
+
progress.value,
|
|
215
194
|
[0, 1],
|
|
216
195
|
[colorMap[color].default, colorMap[color].pressed]
|
|
217
196
|
);
|
|
218
197
|
|
|
219
|
-
|
|
220
|
-
const scale = interpolate(
|
|
221
|
-
progressPressed.value,
|
|
222
|
-
[0, 1],
|
|
223
|
-
[1, animationScaleValue],
|
|
224
|
-
Extrapolate.CLAMP
|
|
225
|
-
);
|
|
226
|
-
|
|
227
|
-
return {
|
|
228
|
-
backgroundColor,
|
|
229
|
-
transform: [{ scale }]
|
|
230
|
-
};
|
|
198
|
+
return { backgroundColor };
|
|
231
199
|
});
|
|
232
200
|
|
|
233
|
-
const onPressIn = useCallback(() => {
|
|
234
|
-
// eslint-disable-next-line functional/immutable-data
|
|
235
|
-
isPressed.value = 1;
|
|
236
|
-
}, [isPressed]);
|
|
237
|
-
const onPressOut = useCallback(() => {
|
|
238
|
-
// eslint-disable-next-line functional/immutable-data
|
|
239
|
-
isPressed.value = 0;
|
|
240
|
-
}, [isPressed]);
|
|
241
|
-
|
|
242
201
|
const handleOnPress = useCallback(
|
|
243
202
|
(event: GestureResponderEvent) => {
|
|
244
203
|
/* Don't call `onPress` if the button is
|
|
@@ -289,15 +248,14 @@ export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
|
|
|
289
248
|
: { backgroundColor: colorMap[color]?.default },
|
|
290
249
|
/* Prevent Reanimated from overriding background colors
|
|
291
250
|
if button is disabled */
|
|
251
|
+
!disabled && !reducedMotion && scaleAnimatedStyle,
|
|
292
252
|
!disabled && pressedAnimationStyle
|
|
293
253
|
]}
|
|
294
254
|
>
|
|
295
255
|
{loading && (
|
|
296
256
|
<Animated.View
|
|
297
257
|
style={buttonStyles.buttonInner}
|
|
298
|
-
entering={
|
|
299
|
-
isMounted.current ? enterTransitionInnerContentSmall : undefined
|
|
300
|
-
}
|
|
258
|
+
entering={enterTransitionInnerContentSmall}
|
|
301
259
|
exiting={exitTransitionInnerContent}
|
|
302
260
|
>
|
|
303
261
|
<LoadingSpinner color={foregroundColor} />
|
|
@@ -308,24 +266,20 @@ export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
|
|
|
308
266
|
<Animated.View
|
|
309
267
|
style={[
|
|
310
268
|
buttonStyles.buttonInner,
|
|
269
|
+
{ columnGap: ICON_MARGIN },
|
|
270
|
+
/* If 'iconPosition' is set to 'end', we use
|
|
271
|
+
reverse flex property to invert the position */
|
|
311
272
|
iconPosition === "end" && { flexDirection: "row-reverse" }
|
|
312
273
|
]}
|
|
313
|
-
entering={
|
|
314
|
-
isMounted.current ? enterTransitionInnerContent : undefined
|
|
315
|
-
}
|
|
316
|
-
/* Temporarily disable the exiting transition because it caused
|
|
317
|
-
a weird glitch on page exit */
|
|
318
|
-
// exiting={exitTransitionInnerContent}
|
|
274
|
+
entering={enterTransitionInnerContent}
|
|
319
275
|
>
|
|
320
276
|
{icon && (
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
{
|
|
326
|
-
|
|
327
|
-
<HSpacer size={8} />
|
|
328
|
-
</>
|
|
277
|
+
<Icon
|
|
278
|
+
allowFontScaling
|
|
279
|
+
name={icon}
|
|
280
|
+
size={iconSize}
|
|
281
|
+
color={foregroundColor}
|
|
282
|
+
/>
|
|
329
283
|
)}
|
|
330
284
|
<ButtonText
|
|
331
285
|
color={foregroundColor}
|