@pagopa/io-app-design-system 4.2.0 → 4.3.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/alert/Alert.js +10 -31
- 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/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 +1 -1
- package/lib/commonjs/components/buttons/ButtonLink.js +20 -53
- package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonOutline.js +24 -44
- package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonSolid.js +14 -39
- package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButton.js +13 -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 +15 -31
- package/lib/commonjs/components/buttons/IconButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +34 -10
- 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 +16 -41
- package/lib/commonjs/components/listitems/ListItemAction.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemCheckbox.js +13 -41
- package/lib/commonjs/components/listitems/ListItemCheckbox.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemHeader.js +2 -2
- package/lib/commonjs/components/listitems/ListItemHeader.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemInfoCopy.js +15 -43
- package/lib/commonjs/components/listitems/ListItemInfoCopy.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemNav.js +17 -48
- package/lib/commonjs/components/listitems/ListItemNav.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemNavAlert.js +19 -50
- package/lib/commonjs/components/listitems/ListItemNavAlert.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemRadio.js +20 -50
- package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js +13 -25
- package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemTransaction.js +4 -5
- 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 +45 -81
- 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 +35 -28
- package/lib/commonjs/components/modules/ModuleCredential.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 +20 -0
- package/lib/commonjs/components/stack/Stack.js +4 -3
- 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/typography/H6.js +1 -1
- package/lib/commonjs/components/typography/__test__/__snapshots__/typography.test.tsx.snap +1 -1
- 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/fonts.js +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/alert/Alert.js +10 -32
- 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/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 +1 -1
- package/lib/module/components/buttons/ButtonLink.js +23 -56
- package/lib/module/components/buttons/ButtonLink.js.map +1 -1
- package/lib/module/components/buttons/ButtonOutline.js +27 -47
- package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/module/components/buttons/ButtonSolid.js +17 -42
- package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/IconButton.js +16 -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 +17 -34
- package/lib/module/components/buttons/IconButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +34 -10
- 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 +17 -43
- package/lib/module/components/listitems/ListItemAction.js.map +1 -1
- package/lib/module/components/listitems/ListItemCheckbox.js +15 -43
- package/lib/module/components/listitems/ListItemCheckbox.js.map +1 -1
- package/lib/module/components/listitems/ListItemHeader.js +2 -2
- package/lib/module/components/listitems/ListItemHeader.js.map +1 -1
- package/lib/module/components/listitems/ListItemInfoCopy.js +16 -45
- package/lib/module/components/listitems/ListItemInfoCopy.js.map +1 -1
- package/lib/module/components/listitems/ListItemNav.js +17 -47
- package/lib/module/components/listitems/ListItemNav.js.map +1 -1
- package/lib/module/components/listitems/ListItemNavAlert.js +19 -49
- package/lib/module/components/listitems/ListItemNavAlert.js.map +1 -1
- package/lib/module/components/listitems/ListItemRadio.js +22 -52
- package/lib/module/components/listitems/ListItemRadio.js.map +1 -1
- package/lib/module/components/listitems/ListItemRadioWithAmount.js +14 -26
- package/lib/module/components/listitems/ListItemRadioWithAmount.js.map +1 -1
- package/lib/module/components/listitems/ListItemTransaction.js +3 -4
- 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 +45 -81
- 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 +36 -29
- package/lib/module/components/modules/ModuleCredential.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 +20 -0
- package/lib/module/components/stack/Stack.js +4 -3
- 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/typography/H6.js +1 -1
- package/lib/module/components/typography/__test__/__snapshots__/typography.test.tsx.snap +1 -1
- 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/fonts.js +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/banner/Banner.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +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/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/ListItemCheckbox.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/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 +2 -2
- package/lib/typescript/components/modules/ModuleCredential.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/stack/Stack.d.ts +4 -3
- 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/core/IOAnimations.d.ts +6 -10
- package/lib/typescript/core/IOAnimations.d.ts.map +1 -1
- 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/fonts.d.ts +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/alert/Alert.tsx +7 -46
- package/src/components/alert/AlertEdgeToEdge.tsx +6 -46
- package/src/components/banner/Banner.tsx +6 -52
- package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +1 -1
- package/src/components/buttons/ButtonLink.tsx +32 -89
- package/src/components/buttons/ButtonOutline.tsx +26 -60
- package/src/components/buttons/ButtonSolid.tsx +11 -58
- package/src/components/buttons/IconButton.tsx +10 -47
- package/src/components/buttons/IconButtonContained.tsx +21 -57
- package/src/components/buttons/IconButtonSolid.tsx +15 -46
- package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +34 -10
- package/src/components/layout/index.tsx +0 -1
- package/src/components/listitems/ListItemAction.tsx +11 -67
- package/src/components/listitems/ListItemCheckbox.tsx +10 -68
- package/src/components/listitems/ListItemHeader.tsx +2 -2
- package/src/components/listitems/ListItemInfoCopy.tsx +11 -71
- package/src/components/listitems/ListItemNav.tsx +13 -74
- package/src/components/listitems/ListItemNavAlert.tsx +18 -92
- package/src/components/listitems/ListItemRadio.tsx +14 -75
- package/src/components/listitems/ListItemRadioWithAmount.tsx +16 -31
- package/src/components/listitems/ListItemTransaction.tsx +3 -7
- package/src/components/listitems/{PressableListItemsBase.tsx → PressableListItemBase.tsx} +7 -6
- package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +45 -81
- package/src/components/listitems/__test__/listitem.test.tsx +1 -1
- package/src/components/listitems/index.tsx +1 -1
- package/src/components/modules/ModuleCredential.tsx +49 -39
- 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 +20 -0
- package/src/components/stack/Stack.tsx +11 -3
- package/src/components/tabs/TabItem.tsx +15 -29
- package/src/components/typography/H6.tsx +1 -1
- package/src/components/typography/__test__/__snapshots__/typography.test.tsx.snap +1 -1
- 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/fonts.ts +1 -1
- 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,33 +1,23 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useState } from "react";
|
|
3
3
|
import { Image, Pressable, StyleSheet, View } from "react-native";
|
|
4
4
|
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
5
|
-
import Animated
|
|
6
|
-
Extrapolate,
|
|
7
|
-
interpolate,
|
|
8
|
-
interpolateColor,
|
|
9
|
-
useAnimatedStyle,
|
|
10
|
-
useDerivedValue,
|
|
11
|
-
useSharedValue,
|
|
12
|
-
withSpring
|
|
13
|
-
} from "react-native-reanimated";
|
|
5
|
+
import Animated from "react-native-reanimated";
|
|
14
6
|
import Placeholder from "rn-placeholder";
|
|
15
7
|
import {
|
|
16
|
-
IOColors,
|
|
17
|
-
IOScaleValues,
|
|
18
8
|
IOSelectionListItemStyles,
|
|
19
9
|
IOSelectionListItemVisualParams,
|
|
20
|
-
IOSpringValues,
|
|
21
10
|
IOStyles,
|
|
22
|
-
hexToRgba,
|
|
23
11
|
useIOTheme
|
|
24
12
|
} from "../../core";
|
|
13
|
+
import { useListItemAnimation } from "../../hooks";
|
|
25
14
|
import { WithTestID } from "../../utils/types";
|
|
26
15
|
import { IOIcons, Icon } from "../icons";
|
|
27
16
|
import { IOLogoPaymentType, LogoPayment } from "../logos";
|
|
28
17
|
import { AnimatedRadio } from "../radio/AnimatedRadio";
|
|
29
18
|
import { HSpacer, VSpacer } from "../spacer";
|
|
30
19
|
import { H6, BodySmall } from "../typography";
|
|
20
|
+
import { VStack } from "../stack";
|
|
31
21
|
|
|
32
22
|
type ListItemRadioGraphicProps =
|
|
33
23
|
| { icon?: never; paymentLogo: IOLogoPaymentType; uri?: never }
|
|
@@ -91,58 +81,10 @@ export const ListItemRadio = ({
|
|
|
91
81
|
testID
|
|
92
82
|
}: ListItemRadioProps) => {
|
|
93
83
|
const [toggleValue, setToggleValue] = useState(selected ?? false);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
// Scaling transformation applied when the button is pressed
|
|
97
|
-
const animationScaleValue = IOScaleValues?.basicButton?.pressedState;
|
|
98
|
-
|
|
99
|
-
const progressPressed = useDerivedValue(() =>
|
|
100
|
-
withSpring(isPressed.value, IOSpringValues.button)
|
|
101
|
-
);
|
|
102
|
-
|
|
103
|
-
// Theme
|
|
84
|
+
const { onPressIn, onPressOut, scaleAnimatedStyle, backgroundAnimatedStyle } =
|
|
85
|
+
useListItemAnimation();
|
|
104
86
|
const theme = useIOTheme();
|
|
105
87
|
|
|
106
|
-
const mapBackgroundStates: Record<string, string> = {
|
|
107
|
-
default: hexToRgba(IOColors[theme["listItem-pressed"]], 0),
|
|
108
|
-
pressed: IOColors[theme["listItem-pressed"]]
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// Interpolate animation values from `isPressed` values
|
|
112
|
-
const animatedScaleStyle = useAnimatedStyle(() => {
|
|
113
|
-
const scale = interpolate(
|
|
114
|
-
progressPressed.value,
|
|
115
|
-
[0, 1],
|
|
116
|
-
[1, animationScaleValue],
|
|
117
|
-
Extrapolate.CLAMP
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
return {
|
|
121
|
-
transform: [{ scale }]
|
|
122
|
-
};
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
const handlePressIn = useCallback(() => {
|
|
126
|
-
// eslint-disable-next-line functional/immutable-data
|
|
127
|
-
isPressed.value = 1;
|
|
128
|
-
}, [isPressed]);
|
|
129
|
-
const handlePressOut = useCallback(() => {
|
|
130
|
-
// eslint-disable-next-line functional/immutable-data
|
|
131
|
-
isPressed.value = 0;
|
|
132
|
-
}, [isPressed]);
|
|
133
|
-
|
|
134
|
-
const animatedBackgroundStyle = useAnimatedStyle(() => {
|
|
135
|
-
const backgroundColor = interpolateColor(
|
|
136
|
-
progressPressed.value,
|
|
137
|
-
[0, 1],
|
|
138
|
-
[mapBackgroundStates.default, mapBackgroundStates.pressed]
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
return {
|
|
142
|
-
backgroundColor
|
|
143
|
-
};
|
|
144
|
-
});
|
|
145
|
-
|
|
146
88
|
const toggleRadioItem = () => {
|
|
147
89
|
ReactNativeHapticFeedback.trigger("impactLight");
|
|
148
90
|
setToggleValue(!toggleValue);
|
|
@@ -154,14 +96,11 @@ export const ListItemRadio = ({
|
|
|
154
96
|
const disabledStyle = { opacity: disabled ? DISABLED_OPACITY : 1 };
|
|
155
97
|
|
|
156
98
|
const SkeletonDescriptionLines = () => (
|
|
157
|
-
|
|
158
|
-
<VSpacer size={8} />
|
|
99
|
+
<VStack space={8}>
|
|
159
100
|
<Placeholder.Box animate="fade" radius={8} width={"100%"} height={8} />
|
|
160
|
-
<VSpacer size={8} />
|
|
161
101
|
<Placeholder.Box animate="fade" radius={8} width={"100%"} height={8} />
|
|
162
|
-
<VSpacer size={8} />
|
|
163
102
|
<Placeholder.Box animate="fade" radius={8} width={"100%"} height={8} />
|
|
164
|
-
|
|
103
|
+
</VStack>
|
|
165
104
|
);
|
|
166
105
|
|
|
167
106
|
const SkeletonIcon = () => (
|
|
@@ -180,7 +119,7 @@ export const ListItemRadio = ({
|
|
|
180
119
|
);
|
|
181
120
|
|
|
182
121
|
const SkeletonComponent = () => (
|
|
183
|
-
<View style={IOSelectionListItemStyles.listItem}>
|
|
122
|
+
<View style={[IOSelectionListItemStyles.listItem, { rowGap: 8 }]}>
|
|
184
123
|
<View style={IOSelectionListItemStyles.listItemInner}>
|
|
185
124
|
<View
|
|
186
125
|
style={[
|
|
@@ -220,23 +159,23 @@ export const ListItemRadio = ({
|
|
|
220
159
|
accessibilityLabel={accessibilityLabel}
|
|
221
160
|
accessibilityHint={accessibilityHint}
|
|
222
161
|
onPress={toggleRadioItem}
|
|
223
|
-
onPressIn={
|
|
224
|
-
onPressOut={
|
|
225
|
-
onTouchEnd={
|
|
162
|
+
onPressIn={onPressIn}
|
|
163
|
+
onPressOut={onPressOut}
|
|
164
|
+
onTouchEnd={onPressOut}
|
|
226
165
|
testID={testID}
|
|
227
166
|
disabled={disabled}
|
|
228
167
|
>
|
|
229
168
|
<Animated.View
|
|
230
169
|
style={[
|
|
231
170
|
IOSelectionListItemStyles.listItem,
|
|
232
|
-
|
|
171
|
+
backgroundAnimatedStyle,
|
|
233
172
|
disabledStyle
|
|
234
173
|
]}
|
|
235
174
|
// This is required to avoid opacity
|
|
236
175
|
// inheritance on Android
|
|
237
176
|
needsOffscreenAlphaCompositing={true}
|
|
238
177
|
>
|
|
239
|
-
<Animated.View style={
|
|
178
|
+
<Animated.View style={scaleAnimatedStyle}>
|
|
240
179
|
<View style={IOSelectionListItemStyles.listItemInner}>
|
|
241
180
|
<View style={[IOStyles.row, { flexShrink: 1 }]}>
|
|
242
181
|
{startImage && (
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { View } from "react-native";
|
|
3
3
|
import RNReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
4
4
|
import { IOColors, useIOTheme } from "../../core";
|
|
5
5
|
import { Icon } from "../icons";
|
|
6
6
|
import { AnimatedRadio } from "../radio/AnimatedRadio";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { PressableListItemBase } from "./
|
|
7
|
+
import { HStack } from "../stack";
|
|
8
|
+
import { BodySmall, H6 } from "../typography";
|
|
9
|
+
import { PressableListItemBase } from "./PressableListItemBase";
|
|
10
10
|
|
|
11
11
|
export type ListItemRadioWithAmountProps = {
|
|
12
12
|
onValueChange?: (newValue: boolean) => void;
|
|
@@ -34,6 +34,7 @@ export const ListItemRadioWithAmount = ({
|
|
|
34
34
|
formattedAmountString
|
|
35
35
|
}: ListItemRadioWithAmountProps) => {
|
|
36
36
|
const [toggleValue, setToggleValue] = React.useState(selected ?? false);
|
|
37
|
+
|
|
37
38
|
const pressHandler = () => {
|
|
38
39
|
RNReactNativeHapticFeedback.trigger("impactLight");
|
|
39
40
|
setToggleValue(val => !val);
|
|
@@ -55,45 +56,29 @@ export const ListItemRadioWithAmount = ({
|
|
|
55
56
|
}}
|
|
56
57
|
>
|
|
57
58
|
<View style={{ flexShrink: 1 }}>
|
|
58
|
-
<
|
|
59
|
-
weight="Semibold"
|
|
60
|
-
numberOfLines={1}
|
|
61
|
-
color={theme["textBody-default"]}
|
|
62
|
-
>
|
|
59
|
+
<H6 numberOfLines={1} color={theme["textBody-default"]}>
|
|
63
60
|
{label}
|
|
64
|
-
</
|
|
61
|
+
</H6>
|
|
65
62
|
{isSuggested && (
|
|
66
|
-
|
|
67
|
-
<
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
{suggestReason}
|
|
73
|
-
</BodySmall>
|
|
74
|
-
</View>
|
|
75
|
-
</>
|
|
63
|
+
<HStack space={4} style={{ alignItems: "center" }}>
|
|
64
|
+
<Icon name="sparkles" size={16} color={suggestColor} />
|
|
65
|
+
<BodySmall weight="Regular" color={suggestColor}>
|
|
66
|
+
{suggestReason}
|
|
67
|
+
</BodySmall>
|
|
68
|
+
</HStack>
|
|
76
69
|
)}
|
|
77
70
|
</View>
|
|
78
|
-
<
|
|
71
|
+
<HStack
|
|
72
|
+
space={8}
|
|
79
73
|
pointerEvents="none"
|
|
80
74
|
accessibilityElementsHidden
|
|
81
75
|
importantForAccessibility="no-hide-descendants"
|
|
82
|
-
style={{ flexDirection: "row" }}
|
|
83
76
|
>
|
|
84
77
|
<H6 color={theme["interactiveElem-default"]}>
|
|
85
78
|
{formattedAmountString}
|
|
86
79
|
</H6>
|
|
87
|
-
<HSpacer size={8} />
|
|
88
80
|
<AnimatedRadio checked={selected ?? toggleValue} />
|
|
89
|
-
</
|
|
81
|
+
</HStack>
|
|
90
82
|
</PressableListItemBase>
|
|
91
83
|
);
|
|
92
84
|
};
|
|
93
|
-
|
|
94
|
-
const styles = StyleSheet.create({
|
|
95
|
-
rowCenter: {
|
|
96
|
-
flexDirection: "row",
|
|
97
|
-
alignItems: "center"
|
|
98
|
-
}
|
|
99
|
-
});
|
|
@@ -25,7 +25,7 @@ import { H6, BodySmall } from "../typography";
|
|
|
25
25
|
import {
|
|
26
26
|
PressableBaseProps,
|
|
27
27
|
PressableListItemBase
|
|
28
|
-
} from "./
|
|
28
|
+
} from "./PressableListItemBase";
|
|
29
29
|
|
|
30
30
|
export type ListItemTransactionBadge = {
|
|
31
31
|
text: string;
|
|
@@ -146,13 +146,9 @@ export const ListItemTransaction = ({
|
|
|
146
146
|
</View>
|
|
147
147
|
)}
|
|
148
148
|
<View style={{ flexShrink: 1 }}>
|
|
149
|
-
<
|
|
150
|
-
numberOfLines={numberOfLines}
|
|
151
|
-
color={theme["textBody-default"]}
|
|
152
|
-
weight="Semibold"
|
|
153
|
-
>
|
|
149
|
+
<H6 numberOfLines={numberOfLines} color={theme["textBody-default"]}>
|
|
154
150
|
{title}
|
|
155
|
-
</
|
|
151
|
+
</H6>
|
|
156
152
|
<BodySmall weight="Regular" color={theme["textBody-tertiary"]}>
|
|
157
153
|
{subtitle}
|
|
158
154
|
</BodySmall>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { PropsWithChildren } from "react";
|
|
2
3
|
import { Pressable } from "react-native";
|
|
3
4
|
import Animated from "react-native-reanimated";
|
|
4
5
|
import { IOListItemStyles, IOListItemVisualParams } from "../../core";
|
|
5
6
|
import { WithTestID } from "../../utils/types";
|
|
6
|
-
import {
|
|
7
|
+
import { useListItemAnimation } from "../../hooks";
|
|
7
8
|
|
|
8
9
|
export type PressableBaseProps = WithTestID<
|
|
9
10
|
Pick<
|
|
@@ -22,9 +23,9 @@ export const PressableListItemBase = ({
|
|
|
22
23
|
children,
|
|
23
24
|
accessibilityRole,
|
|
24
25
|
...props
|
|
25
|
-
}:
|
|
26
|
-
const { onPressIn, onPressOut,
|
|
27
|
-
|
|
26
|
+
}: PropsWithChildren<PressableBaseProps>) => {
|
|
27
|
+
const { onPressIn, onPressOut, scaleAnimatedStyle, backgroundAnimatedStyle } =
|
|
28
|
+
useListItemAnimation();
|
|
28
29
|
return (
|
|
29
30
|
<Pressable
|
|
30
31
|
onPress={onPress}
|
|
@@ -37,13 +38,13 @@ export const PressableListItemBase = ({
|
|
|
37
38
|
{...props}
|
|
38
39
|
>
|
|
39
40
|
<Animated.View
|
|
40
|
-
style={[IOListItemStyles.listItem,
|
|
41
|
+
style={[IOListItemStyles.listItem, backgroundAnimatedStyle]}
|
|
41
42
|
>
|
|
42
43
|
<Animated.View
|
|
43
44
|
style={[
|
|
44
45
|
IOListItemStyles.listItemInner,
|
|
45
46
|
{ columnGap: IOListItemVisualParams.iconMargin },
|
|
46
|
-
|
|
47
|
+
scaleAnimatedStyle
|
|
47
48
|
]}
|
|
48
49
|
>
|
|
49
50
|
{children}
|