@pagopa/io-app-design-system 4.2.1 → 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/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 +14 -40
- 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 +2 -2
- package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemTransaction.js +2 -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 +13 -7
- 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/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/tabs/TabItem.js +15 -21
- package/lib/commonjs/components/tabs/TabItem.js.map +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/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/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 +15 -42
- 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 +1 -1
- package/lib/module/components/listitems/ListItemRadioWithAmount.js.map +1 -1
- package/lib/module/components/listitems/ListItemTransaction.js +1 -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 +13 -7
- 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/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/tabs/TabItem.js +18 -24
- package/lib/module/components/tabs/TabItem.js.map +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/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/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/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/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/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 +10 -66
- 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 +2 -1
- package/src/components/listitems/ListItemTransaction.tsx +1 -1
- package/src/components/listitems/{PressableListItemsBase.tsx → PressableListItemBase.tsx} +7 -6
- package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +13 -7
- package/src/components/listitems/__test__/listitem.test.tsx +1 -1
- package/src/components/listitems/index.tsx +1 -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 +20 -0
- package/src/components/tabs/TabItem.tsx +15 -29
- 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/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,25 +1,23 @@
|
|
|
1
|
-
import React, { useMemo } from "react";
|
|
1
|
+
import React, { useEffect, useMemo } from "react";
|
|
2
2
|
import { GestureResponderEvent, Pressable, StyleSheet } from "react-native";
|
|
3
3
|
import Animated, {
|
|
4
|
-
|
|
5
|
-
interpolate,
|
|
4
|
+
SharedValue,
|
|
6
5
|
interpolateColor,
|
|
7
6
|
useAnimatedStyle,
|
|
8
7
|
useDerivedValue,
|
|
8
|
+
useReducedMotion,
|
|
9
9
|
useSharedValue,
|
|
10
10
|
withSpring
|
|
11
11
|
} from "react-native-reanimated";
|
|
12
12
|
import {
|
|
13
13
|
IOColors,
|
|
14
|
-
IOScaleValues,
|
|
15
14
|
IOSpringValues,
|
|
16
15
|
hexToRgba,
|
|
17
16
|
useIOExperimentalDesign
|
|
18
17
|
} from "../../core";
|
|
19
|
-
import {
|
|
18
|
+
import { useScaleAnimation } from "../../hooks";
|
|
20
19
|
import { WithTestID } from "../../utils/types";
|
|
21
20
|
import { IOIcons, Icon } from "../icons";
|
|
22
|
-
import { HSpacer } from "../spacer";
|
|
23
21
|
import { BodySmall } from "../typography";
|
|
24
22
|
|
|
25
23
|
type ColorMode = "light" | "dark";
|
|
@@ -148,11 +146,9 @@ const TabItem = ({
|
|
|
148
146
|
icon,
|
|
149
147
|
iconSelected
|
|
150
148
|
}: TabItem) => {
|
|
151
|
-
const {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
onPressOut
|
|
155
|
-
} = useSpringPressProgressValue(IOSpringValues.selection);
|
|
149
|
+
const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
|
|
150
|
+
useScaleAnimation();
|
|
151
|
+
const reducedMotion = useReducedMotion();
|
|
156
152
|
|
|
157
153
|
const { isExperimental } = useIOExperimentalDesign();
|
|
158
154
|
const colors = useMemo(
|
|
@@ -180,12 +176,12 @@ const TabItem = ({
|
|
|
180
176
|
0.1
|
|
181
177
|
);
|
|
182
178
|
|
|
183
|
-
const isSelected:
|
|
179
|
+
const isSelected: SharedValue<number> = useSharedValue(0);
|
|
184
180
|
const progressSelected = useDerivedValue(() =>
|
|
185
181
|
withSpring(isSelected.value, IOSpringValues.selection)
|
|
186
182
|
);
|
|
187
183
|
|
|
188
|
-
|
|
184
|
+
useEffect(() => {
|
|
189
185
|
// eslint-disable-next-line functional/immutable-data
|
|
190
186
|
isSelected.value = selected ? 1 : 0;
|
|
191
187
|
}, [isSelected, selected]);
|
|
@@ -194,7 +190,7 @@ const TabItem = ({
|
|
|
194
190
|
const animatedStyle = useAnimatedStyle(() => {
|
|
195
191
|
// Link color states to the pressed states
|
|
196
192
|
const pressedBackgroundColor = interpolateColor(
|
|
197
|
-
|
|
193
|
+
progress.value,
|
|
198
194
|
[0, 1],
|
|
199
195
|
[colors.background.default, opaquePressedBackgroundColor]
|
|
200
196
|
);
|
|
@@ -211,22 +207,13 @@ const TabItem = ({
|
|
|
211
207
|
[colors.border.default, colors.border.selected]
|
|
212
208
|
);
|
|
213
209
|
|
|
214
|
-
// Scale down button slightly when pressed
|
|
215
|
-
const scale = interpolate(
|
|
216
|
-
progressPressed.value,
|
|
217
|
-
[0, 1],
|
|
218
|
-
[1, IOScaleValues?.basicButton?.pressedState],
|
|
219
|
-
Extrapolate.CLAMP
|
|
220
|
-
);
|
|
221
|
-
|
|
222
210
|
return {
|
|
223
211
|
backgroundColor: selected
|
|
224
212
|
? selectedBackgroundColor
|
|
225
213
|
: pressedBackgroundColor,
|
|
226
|
-
borderColor: selected ? selectedBorderColor : borderColor
|
|
227
|
-
transform: [{ scale }]
|
|
214
|
+
borderColor: selected ? selectedBorderColor : borderColor
|
|
228
215
|
};
|
|
229
|
-
}, [
|
|
216
|
+
}, [progress, progressSelected, selected]);
|
|
230
217
|
|
|
231
218
|
const activeIcon = selected ? iconSelected ?? icon : icon;
|
|
232
219
|
|
|
@@ -246,16 +233,15 @@ const TabItem = ({
|
|
|
246
233
|
<Animated.View
|
|
247
234
|
style={[
|
|
248
235
|
styles.container,
|
|
236
|
+
{ columnGap: 4 },
|
|
237
|
+
!reducedMotion && scaleAnimatedStyle,
|
|
249
238
|
animatedStyle,
|
|
250
239
|
fullWidth && styles.fullWidth,
|
|
251
240
|
disabled && styles.disabled
|
|
252
241
|
]}
|
|
253
242
|
>
|
|
254
243
|
{activeIcon && (
|
|
255
|
-
|
|
256
|
-
<Icon name={activeIcon} color={foregroundColor} size={16} />
|
|
257
|
-
<HSpacer size={4} />
|
|
258
|
-
</>
|
|
244
|
+
<Icon name={activeIcon} color={foregroundColor} size={16} />
|
|
259
245
|
)}
|
|
260
246
|
<BodySmall weight="Semibold" color={foregroundColor}>
|
|
261
247
|
{label}
|
package/src/core/IOAnimations.ts
CHANGED
|
@@ -27,17 +27,15 @@ export const IOSpringValues = {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export
|
|
30
|
+
export type IOSpringValues = keyof typeof IOSpringValues;
|
|
31
|
+
|
|
32
|
+
export const IOScaleEffect = {
|
|
31
33
|
// Slight scale effect
|
|
32
|
-
|
|
33
|
-
pressedState: 0.99
|
|
34
|
-
},
|
|
34
|
+
slight: 0.99,
|
|
35
35
|
// Medium scale effect
|
|
36
|
-
|
|
37
|
-
pressedState: 0.97
|
|
38
|
-
},
|
|
36
|
+
medium: 0.97,
|
|
39
37
|
// Exaggerated scale effect
|
|
40
|
-
|
|
41
|
-
pressedState: 0.95
|
|
42
|
-
}
|
|
38
|
+
exaggerated: 0.95
|
|
43
39
|
};
|
|
40
|
+
|
|
41
|
+
export type IOScaleEffect = keyof typeof IOScaleEffect;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { GestureResponderEvent, ViewStyle } from "react-native";
|
|
2
|
+
import {
|
|
3
|
+
AnimatedStyle,
|
|
4
|
+
Extrapolation,
|
|
5
|
+
interpolate,
|
|
6
|
+
interpolateColor,
|
|
7
|
+
SharedValue,
|
|
8
|
+
useAnimatedStyle
|
|
9
|
+
} from "react-native-reanimated";
|
|
10
|
+
import { hexToRgba, IOColors, IOScaleEffect, useIOTheme } from "../core";
|
|
11
|
+
import { useSpringPressProgressValue } from "../utils/hooks";
|
|
12
|
+
|
|
13
|
+
export const useListItemAnimation = (): {
|
|
14
|
+
progress: SharedValue<number>;
|
|
15
|
+
onPressIn: (event: GestureResponderEvent) => void;
|
|
16
|
+
onPressOut: (event: GestureResponderEvent) => void;
|
|
17
|
+
scaleAnimatedStyle: AnimatedStyle<ViewStyle>;
|
|
18
|
+
backgroundAnimatedStyle: AnimatedStyle<ViewStyle>;
|
|
19
|
+
} => {
|
|
20
|
+
const { progress, onPressIn, onPressOut } =
|
|
21
|
+
useSpringPressProgressValue("button");
|
|
22
|
+
|
|
23
|
+
const theme = useIOTheme();
|
|
24
|
+
|
|
25
|
+
const mapBackgroundStates: Record<string, string> = {
|
|
26
|
+
default: hexToRgba(IOColors[theme["listItem-pressed"]], 0),
|
|
27
|
+
pressed: IOColors[theme["listItem-pressed"]]
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Interpolate animation values from `isPressed` values
|
|
31
|
+
const scaleAnimatedStyle = useAnimatedStyle(() => ({
|
|
32
|
+
transform: [
|
|
33
|
+
{
|
|
34
|
+
scale: interpolate(
|
|
35
|
+
progress.value,
|
|
36
|
+
[0, 1],
|
|
37
|
+
[1, IOScaleEffect.slight],
|
|
38
|
+
Extrapolation.CLAMP
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
const backgroundAnimatedStyle = useAnimatedStyle(() => ({
|
|
45
|
+
backgroundColor: interpolateColor(
|
|
46
|
+
progress.value,
|
|
47
|
+
[0, 1],
|
|
48
|
+
[mapBackgroundStates.default, mapBackgroundStates.pressed]
|
|
49
|
+
)
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
progress,
|
|
54
|
+
onPressIn,
|
|
55
|
+
onPressOut,
|
|
56
|
+
scaleAnimatedStyle,
|
|
57
|
+
backgroundAnimatedStyle
|
|
58
|
+
};
|
|
59
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { GestureResponderEvent, ViewStyle } from "react-native";
|
|
2
|
+
import {
|
|
3
|
+
AnimatedStyle,
|
|
4
|
+
Extrapolation,
|
|
5
|
+
interpolate,
|
|
6
|
+
SharedValue,
|
|
7
|
+
useAnimatedStyle
|
|
8
|
+
} from "react-native-reanimated";
|
|
9
|
+
import { IOScaleEffect } from "../core";
|
|
10
|
+
import { useSpringPressProgressValue } from "../utils/hooks";
|
|
11
|
+
|
|
12
|
+
export const useScaleAnimation = (
|
|
13
|
+
magnitude: IOScaleEffect = "slight"
|
|
14
|
+
): {
|
|
15
|
+
progress: SharedValue<number>;
|
|
16
|
+
onPressIn: (event: GestureResponderEvent) => void;
|
|
17
|
+
onPressOut: (event: GestureResponderEvent) => void;
|
|
18
|
+
scaleAnimatedStyle: AnimatedStyle<ViewStyle>;
|
|
19
|
+
} => {
|
|
20
|
+
const { progress, onPressIn, onPressOut } =
|
|
21
|
+
useSpringPressProgressValue("button");
|
|
22
|
+
|
|
23
|
+
// Scaling transformation applied when the button is pressed
|
|
24
|
+
const animationScaleValue = IOScaleEffect[magnitude];
|
|
25
|
+
|
|
26
|
+
const scaleAnimatedStyle = useAnimatedStyle(() => {
|
|
27
|
+
// Scale down button slightly when pressed
|
|
28
|
+
const scale = interpolate(
|
|
29
|
+
progress.value,
|
|
30
|
+
[0, 1],
|
|
31
|
+
[1, animationScaleValue],
|
|
32
|
+
Extrapolation.CLAMP
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
transform: [{ scale }]
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return { progress, onPressIn, onPressOut, scaleAnimatedStyle };
|
|
41
|
+
};
|
package/src/index.tsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { GestureResponderEvent } from "react-native";
|
|
3
|
+
import {
|
|
4
|
+
SharedValue,
|
|
3
5
|
useDerivedValue,
|
|
4
6
|
useSharedValue,
|
|
5
7
|
withSpring
|
|
@@ -7,19 +9,23 @@ import Animated, {
|
|
|
7
9
|
import { IOSpringValues } from "../../core";
|
|
8
10
|
|
|
9
11
|
export const useSpringPressProgressValue = (
|
|
10
|
-
springValue =
|
|
11
|
-
)
|
|
12
|
-
|
|
12
|
+
springValue: IOSpringValues = "button"
|
|
13
|
+
): {
|
|
14
|
+
progress: SharedValue<number>;
|
|
15
|
+
onPressIn: (event: GestureResponderEvent) => void;
|
|
16
|
+
onPressOut: (event: GestureResponderEvent) => void;
|
|
17
|
+
} => {
|
|
18
|
+
const isPressed: SharedValue<number> = useSharedValue(0);
|
|
13
19
|
|
|
14
20
|
const progress = useDerivedValue(() =>
|
|
15
|
-
withSpring(isPressed.value, springValue)
|
|
21
|
+
withSpring(isPressed.value, IOSpringValues[springValue])
|
|
16
22
|
);
|
|
17
23
|
|
|
18
|
-
const onPressIn =
|
|
24
|
+
const onPressIn = useCallback(() => {
|
|
19
25
|
// eslint-disable-next-line functional/immutable-data
|
|
20
26
|
isPressed.value = 1;
|
|
21
27
|
}, [isPressed]);
|
|
22
|
-
const onPressOut =
|
|
28
|
+
const onPressOut = useCallback(() => {
|
|
23
29
|
// eslint-disable-next-line functional/immutable-data
|
|
24
30
|
isPressed.value = 0;
|
|
25
31
|
}, [isPressed]);
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.FooterWithButtons = void 0;
|
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
10
|
-
var _core = require("../../core");
|
|
11
|
-
var _BlockButtons = require("./BlockButtons");
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
// TODO: Refactor with an unique component like `FooterTopShadow` after bonus vacanze
|
|
15
|
-
const styles = _reactNative.StyleSheet.create({
|
|
16
|
-
container: {
|
|
17
|
-
overflow: "hidden",
|
|
18
|
-
width: "100%",
|
|
19
|
-
// This Magic number is an heritage of the app code-base, this component should be removed in favor of `GradientBottomAction`
|
|
20
|
-
marginTop: -50,
|
|
21
|
-
paddingTop: 50
|
|
22
|
-
},
|
|
23
|
-
sticky: {
|
|
24
|
-
position: "absolute",
|
|
25
|
-
bottom: 0
|
|
26
|
-
},
|
|
27
|
-
footerShadow: {
|
|
28
|
-
backgroundColor: _core.IOColors.white,
|
|
29
|
-
paddingHorizontal: _core.IOVisualCostants.appMarginDefault,
|
|
30
|
-
// iOS shadow
|
|
31
|
-
shadowColor: _core.IOColors.black,
|
|
32
|
-
shadowOffset: {
|
|
33
|
-
width: 0,
|
|
34
|
-
height: 50
|
|
35
|
-
},
|
|
36
|
-
shadowOpacity: 0.5,
|
|
37
|
-
shadowRadius: 37,
|
|
38
|
-
elevation: 20 // Prop supported on Android only
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const verticalSpacing = 16;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Implements a component that show buttons as sticky footer
|
|
46
|
-
* It can include 1, 2 or 3 buttons. If they are 2, they can have the inlineHalf or the inlineOneThird style
|
|
47
|
-
* @deprecated This component is deprecated. Use `FooterActions` or `FooterActionsInline` instead.
|
|
48
|
-
* `FooterActionsInline` is the official replacement for `FooterWithButtons`, but use it only
|
|
49
|
-
* if explicitly required.
|
|
50
|
-
*/
|
|
51
|
-
const FooterWithButtons = ({
|
|
52
|
-
sticky = false,
|
|
53
|
-
onLayoutChange,
|
|
54
|
-
...rest
|
|
55
|
-
}) => {
|
|
56
|
-
const insets = (0, _reactNativeSafeAreaContext.useSafeAreaInsets)();
|
|
57
|
-
const onLayout = event => {
|
|
58
|
-
onLayoutChange === null || onLayoutChange === void 0 || onLayoutChange(event.nativeEvent.layout.height);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/* Check if the iPhone bottom handle is present.
|
|
62
|
-
If not add a default margin to prevent the
|
|
63
|
-
button from sticking to the bottom. */
|
|
64
|
-
const bottomMargin = (0, React.useMemo)(() => insets.bottom === 0 ? verticalSpacing : insets.bottom, [insets]);
|
|
65
|
-
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
66
|
-
style: {
|
|
67
|
-
...styles.container,
|
|
68
|
-
...(sticky ? styles.sticky : {})
|
|
69
|
-
},
|
|
70
|
-
accessible: rest.accessible,
|
|
71
|
-
pointerEvents: "box-none",
|
|
72
|
-
testID: "FooterWithButtons"
|
|
73
|
-
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
74
|
-
onLayout: onLayout,
|
|
75
|
-
style: [styles.footerShadow, {
|
|
76
|
-
paddingBottom: bottomMargin,
|
|
77
|
-
paddingTop: verticalSpacing
|
|
78
|
-
}]
|
|
79
|
-
}, /*#__PURE__*/React.createElement(_BlockButtons.BlockButtons, rest)));
|
|
80
|
-
};
|
|
81
|
-
exports.FooterWithButtons = FooterWithButtons;
|
|
82
|
-
var _default = FooterWithButtons;
|
|
83
|
-
exports.default = _default;
|
|
84
|
-
//# sourceMappingURL=FooterWithButtons.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","_interopRequireWildcard","require","_reactNative","_reactNativeSafeAreaContext","_core","_BlockButtons","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","styles","StyleSheet","create","container","overflow","width","marginTop","paddingTop","sticky","position","bottom","footerShadow","backgroundColor","IOColors","white","paddingHorizontal","IOVisualCostants","appMarginDefault","shadowColor","black","shadowOffset","height","shadowOpacity","shadowRadius","elevation","verticalSpacing","FooterWithButtons","onLayoutChange","rest","insets","useSafeAreaInsets","onLayout","event","nativeEvent","layout","bottomMargin","useMemo","createElement","View","style","accessible","pointerEvents","testID","paddingBottom","BlockButtons","exports","_default"],"sourceRoot":"../../../../src","sources":["components/layout/FooterWithButtons.tsx"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAAiE,SAAAK,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAP,wBAAAW,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cA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,MAAM,CAACb,MAAM,CAAC;EACnD,CAAC;;EAED;AACF;AACA;EACE,MAAMc,YAAoB,GAAG,IAAAC,aAAO,EAClC,MAAOP,MAAM,CAACnB,MAAM,KAAK,CAAC,GAAGe,eAAe,GAAGI,MAAM,CAACnB,MAAO,EAC7D,CAACmB,MAAM,CACT,CAAC;EAED,oBACE1D,KAAA,CAAAkE,aAAA,CAAC/D,YAAA,CAAAgE,IAAI;IACHC,KAAK,EAAE;MAAE,GAAGvC,MAAM,CAACG,SAAS;MAAE,IAAIK,MAAM,GAAGR,MAAM,CAACQ,MAAM,GAAG,CAAC,CAAC;IAAE,CAAE;IACjEgC,UAAU,EAAEZ,IAAI,CAACY,UAAW;IAC5BC,aAAa,EAAE,UAAW;IAC1BC,MAAM,EAAC;EAAmB,gBAE1BvE,KAAA,CAAAkE,aAAA,CAAC/D,YAAA,CAAAgE,IAAI;IACHP,QAAQ,EAAEA,QAAS;IACnBQ,KAAK,EAAE,CACLvC,MAAM,CAACW,YAAY,EACnB;MAAEgC,aAAa,EAAER,YAAY;MAAE5B,UAAU,EAAEkB;IAAgB,CAAC;EAC5D,gBAEFtD,KAAA,CAAAkE,aAAA,CAAC5D,aAAA,CAAAmE,YAAY,EAAKhB,IAAO,CACrB,CACF,CAAC;AAEX,CAAC;AAACiB,OAAA,CAAAnB,iBAAA,GAAAA,iBAAA;AAAA,IAAAoB,QAAA,GAEapB,iBAAiB;AAAAmB,OAAA,CAAA5D,OAAA,GAAA6D,QAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_interopRequireDefault","_core","_useListItemSpringAnimation","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","_extends","assign","bind","target","i","arguments","length","source","apply","PressableListItemBase","onPress","testID","children","accessibilityRole","props","onPressIn","onPressOut","animatedScaleStyle","animatedBackgroundStyle","useListItemSpringAnimation","createElement","Pressable","accessible","onTouchEnd","View","style","IOListItemStyles","listItem","listItemInner","columnGap","IOListItemVisualParams","iconMargin","exports"],"sourceRoot":"../../../../src","sources":["components/listitems/PressableListItemsBase.tsx"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,IAAAK,2BAAA,GAAAL,OAAA;AAAgF,SAAAG,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAX,wBAAAO,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAQ,KAAA,GAAAL,wBAAA,CAAAC,WAAA,OAAAI,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAT,GAAA,YAAAQ,KAAA,CAAAE,GAAA,CAAAV,GAAA,SAAAW,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAhB,GAAA,QAAAgB,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAnB,GAAA,EAAAgB,GAAA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AU;IACrBC,UAAU,EAAEA,UAAW;IACvBO,UAAU,EAAEP,UAAW;IACvBH,iBAAiB,EAAEA,iBAAiB,IAAI;EAAS,GAC7CC,KAAK,gBAET5C,KAAA,CAAAkD,aAAA,CAAC9C,sBAAA,CAAAM,OAAQ,CAAC4C,IAAI;IACZC,KAAK,EAAE,CAACC,sBAAgB,CAACC,QAAQ,EAAET,uBAAuB;EAAE,gBAE5DhD,KAAA,CAAAkD,aAAA,CAAC9C,sBAAA,CAAAM,OAAQ,CAAC4C,IAAI;IACZC,KAAK,EAAE,CACLC,sBAAgB,CAACE,aAAa,EAC9B;MAAEC,SAAS,EAAEC,4BAAsB,CAACC;IAAW,CAAC,EAChDd,kBAAkB;EAClB,GAEDL,QACY,CACF,CACN,CAAC;AAEhB,CAAC;AAACoB,OAAA,CAAAvB,qBAAA,GAAAA,qBAAA"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useListItemSpringAnimation = void 0;
|
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNativeReanimated = require("react-native-reanimated");
|
|
9
|
-
var _core = require("../../../core");
|
|
10
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
-
const useListItemSpringAnimation = () => {
|
|
13
|
-
var _IOScaleValues$basicB;
|
|
14
|
-
const theme = (0, _core.useIOTheme)();
|
|
15
|
-
const isPressed = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
16
|
-
const mapBackgroundStates = {
|
|
17
|
-
default: (0, _core.hexToRgba)(_core.IOColors[theme["listItem-pressed"]], 0),
|
|
18
|
-
pressed: _core.IOColors[theme["listItem-pressed"]]
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// Scaling transformation applied when the button is pressed
|
|
22
|
-
const animationScaleValue = _core.IOScaleValues === null || _core.IOScaleValues === void 0 || (_IOScaleValues$basicB = _core.IOScaleValues.basicButton) === null || _IOScaleValues$basicB === void 0 ? void 0 : _IOScaleValues$basicB.pressedState;
|
|
23
|
-
const progressPressed = (0, _reactNativeReanimated.useDerivedValue)(() => (0, _reactNativeReanimated.withSpring)(isPressed.value, _core.IOSpringValues.button));
|
|
24
|
-
|
|
25
|
-
// Interpolate animation values from `isPressed` values
|
|
26
|
-
const animatedScaleStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
27
|
-
const scale = (0, _reactNativeReanimated.interpolate)(progressPressed.value, [0, 1], [1, animationScaleValue], _reactNativeReanimated.Extrapolate.CLAMP);
|
|
28
|
-
return {
|
|
29
|
-
transform: [{
|
|
30
|
-
scale
|
|
31
|
-
}]
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
const animatedBackgroundStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
35
|
-
const backgroundColor = (0, _reactNativeReanimated.interpolateColor)(progressPressed.value, [0, 1], [mapBackgroundStates.default, mapBackgroundStates.pressed]);
|
|
36
|
-
return {
|
|
37
|
-
backgroundColor
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
const onPressIn = React.useCallback(() => {
|
|
41
|
-
// eslint-disable-next-line functional/immutable-data
|
|
42
|
-
isPressed.value = 1;
|
|
43
|
-
}, [isPressed]);
|
|
44
|
-
const onPressOut = React.useCallback(() => {
|
|
45
|
-
// eslint-disable-next-line functional/immutable-data
|
|
46
|
-
isPressed.value = 0;
|
|
47
|
-
}, [isPressed]);
|
|
48
|
-
return {
|
|
49
|
-
onPressIn,
|
|
50
|
-
onPressOut,
|
|
51
|
-
animatedScaleStyle,
|
|
52
|
-
animatedBackgroundStyle
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
exports.useListItemSpringAnimation = useListItemSpringAnimation;
|
|
56
|
-
//# sourceMappingURL=useListItemSpringAnimation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","_interopRequireWildcard","require","_reactNativeReanimated","_core","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","useListItemSpringAnimation","_IOScaleValues$basicB","theme","useIOTheme","isPressed","useSharedValue","mapBackgroundStates","hexToRgba","IOColors","pressed","animationScaleValue","IOScaleValues","basicButton","pressedState","progressPressed","useDerivedValue","withSpring","value","IOSpringValues","button","animatedScaleStyle","useAnimatedStyle","scale","interpolate","Extrapolate","CLAMP","transform","animatedBackgroundStyle","backgroundColor","interpolateColor","onPressIn","useCallback","onPressOut","exports"],"sourceRoot":"../../../../../src","sources":["components/listitems/hooks/useListItemSpringAnimation.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AASA,IAAAE,KAAA,GAAAF,OAAA;AAMuB,SAA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S,CAAC,CAAC;EACf,MAAM4B,UAAU,GAAG3D,KAAK,CAAC0D,WAAW,CAAC,MAAM;IACzC;IACA3B,SAAS,CAACa,KAAK,GAAG,CAAC;EACrB,CAAC,EAAE,CAACb,SAAS,CAAC,CAAC;EAEf,OAAO;IAAE0B,SAAS;IAAEE,UAAU;IAAEZ,kBAAkB;IAAEO;EAAwB,CAAC;AAC/E,CAAC;AAACM,OAAA,CAAAjC,0BAAA,GAAAA,0BAAA"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.useModuleSpringAnimation = void 0;
|
|
7
|
-
var _reactNativeReanimated = require("react-native-reanimated");
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _core = require("../../../core");
|
|
10
|
-
const useModuleSpringAnimation = () => {
|
|
11
|
-
var _IOScaleValues$magnif;
|
|
12
|
-
const isPressed = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
13
|
-
// Scaling transformation applied when the button is pressed
|
|
14
|
-
const animationScaleValue = _core.IOScaleValues === null || _core.IOScaleValues === void 0 || (_IOScaleValues$magnif = _core.IOScaleValues.magnifiedButton) === null || _IOScaleValues$magnif === void 0 ? void 0 : _IOScaleValues$magnif.pressedState;
|
|
15
|
-
const scaleTraversed = (0, _reactNativeReanimated.useDerivedValue)(() => (0, _reactNativeReanimated.withSpring)(isPressed.value, _core.IOSpringValues.button));
|
|
16
|
-
|
|
17
|
-
// Interpolate animation values from `isPressed` values
|
|
18
|
-
const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
19
|
-
const scale = (0, _reactNativeReanimated.interpolate)(scaleTraversed.value, [0, 1], [1, animationScaleValue], _reactNativeReanimated.Extrapolate.CLAMP);
|
|
20
|
-
return {
|
|
21
|
-
transform: [{
|
|
22
|
-
scale
|
|
23
|
-
}]
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
const handlePressIn = (0, _react.useCallback)(() => {
|
|
27
|
-
// eslint-disable-next-line functional/immutable-data
|
|
28
|
-
isPressed.value = 1;
|
|
29
|
-
}, [isPressed]);
|
|
30
|
-
const handlePressOut = (0, _react.useCallback)(() => {
|
|
31
|
-
// eslint-disable-next-line functional/immutable-data
|
|
32
|
-
isPressed.value = 0;
|
|
33
|
-
}, [isPressed]);
|
|
34
|
-
return {
|
|
35
|
-
animatedStyle,
|
|
36
|
-
handlePressIn,
|
|
37
|
-
handlePressOut
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
exports.useModuleSpringAnimation = useModuleSpringAnimation;
|
|
41
|
-
//# sourceMappingURL=useModuleSpringAnimation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeReanimated","require","_react","_core","useModuleSpringAnimation","_IOScaleValues$magnif","isPressed","useSharedValue","animationScaleValue","IOScaleValues","magnifiedButton","pressedState","scaleTraversed","useDerivedValue","withSpring","value","IOSpringValues","button","animatedStyle","useAnimatedStyle","scale","interpolate","Extrapolate","CLAMP","transform","handlePressIn","useCallback","handlePressOut","exports"],"sourceRoot":"../../../../../src","sources":["components/modules/hooks/useModuleSpringAnimation.ts"],"mappings":";;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAQA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEO,MAAMG,wBAAwB,GAAGA,CAAA,KAAM;EAAA,IAAAC,qBAAA;EAC5C,MAAMC,SAAS,GAAG,IAAAC,qCAAc,EAAC,CAAC,CAAC;EACnC;EACA,MAAMC,mBAAmB,GAAGC,mBAAa,aAAbA,mBAAa,gBAAAJ,qBAAA,GAAbI,mBAAa,CAAEC,eAAe,cAAAL,qBAAA,uBAA9BA,qBAAA,CAAgCM,YAAY;EAExE,MAAMC,cAAc,GAAG,IAAAC,sCAAe,EAAC,MACrC,IAAAC,iCAAU,EAACR,SAAS,CAACS,KAAK,EAAEC,oBAAc,CAACC,MAAM,CACnD,CAAC;;EAED;EACA,MAAMC,aAAa,GAAG,IAAAC,uCAAgB,EAAC,MAAM;IAC3C,MAAMC,KAAK,GAAG,IAAAC,kCAAW,EACvBT,cAAc,CAACG,KAAK,EACpB,CAAC,CAAC,EAAE,CAAC,CAAC,EACN,CAAC,CAAC,EAAEP,mBAAmB,CAAC,EACxBc,kCAAW,CAACC,KACd,CAAC;IAED,OAAO;MACLC,SAAS,EAAE,CAAC;QAAEJ;MAAM,CAAC;IACvB,CAAC;EACH,CAAC,CAAC;EAEF,MAAMK,aAAa,GAAG,IAAAC,kBAAW,EAAC,MAAM;IACtC;IACApB,SAAS,CAACS,KAAK,GAAG,CAAC;EACrB,CAAC,EAAE,CAACT,SAAS,CAAC,CAAC;EACf,MAAMqB,cAAc,GAAG,IAAAD,kBAAW,EAAC,MAAM;IACvC;IACApB,SAAS,CAACS,KAAK,GAAG,CAAC;EACrB,CAAC,EAAE,CAACT,SAAS,CAAC,CAAC;EAEf,OAAO;IACLY,aAAa;IACbO,aAAa;IACbE;EACF,CAAC;AACH,CAAC;AAACC,OAAA,CAAAxB,wBAAA,GAAAA,wBAAA"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { useMemo } from "react";
|
|
3
|
-
import { StyleSheet, View } from "react-native";
|
|
4
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
|
-
import { IOColors, IOVisualCostants } from "../../core";
|
|
6
|
-
import { BlockButtons } from "./BlockButtons";
|
|
7
|
-
// TODO: Refactor with an unique component like `FooterTopShadow` after bonus vacanze
|
|
8
|
-
const styles = StyleSheet.create({
|
|
9
|
-
container: {
|
|
10
|
-
overflow: "hidden",
|
|
11
|
-
width: "100%",
|
|
12
|
-
// This Magic number is an heritage of the app code-base, this component should be removed in favor of `GradientBottomAction`
|
|
13
|
-
marginTop: -50,
|
|
14
|
-
paddingTop: 50
|
|
15
|
-
},
|
|
16
|
-
sticky: {
|
|
17
|
-
position: "absolute",
|
|
18
|
-
bottom: 0
|
|
19
|
-
},
|
|
20
|
-
footerShadow: {
|
|
21
|
-
backgroundColor: IOColors.white,
|
|
22
|
-
paddingHorizontal: IOVisualCostants.appMarginDefault,
|
|
23
|
-
// iOS shadow
|
|
24
|
-
shadowColor: IOColors.black,
|
|
25
|
-
shadowOffset: {
|
|
26
|
-
width: 0,
|
|
27
|
-
height: 50
|
|
28
|
-
},
|
|
29
|
-
shadowOpacity: 0.5,
|
|
30
|
-
shadowRadius: 37,
|
|
31
|
-
elevation: 20 // Prop supported on Android only
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const verticalSpacing = 16;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Implements a component that show buttons as sticky footer
|
|
39
|
-
* It can include 1, 2 or 3 buttons. If they are 2, they can have the inlineHalf or the inlineOneThird style
|
|
40
|
-
* @deprecated This component is deprecated. Use `FooterActions` or `FooterActionsInline` instead.
|
|
41
|
-
* `FooterActionsInline` is the official replacement for `FooterWithButtons`, but use it only
|
|
42
|
-
* if explicitly required.
|
|
43
|
-
*/
|
|
44
|
-
export const FooterWithButtons = ({
|
|
45
|
-
sticky = false,
|
|
46
|
-
onLayoutChange,
|
|
47
|
-
...rest
|
|
48
|
-
}) => {
|
|
49
|
-
const insets = useSafeAreaInsets();
|
|
50
|
-
const onLayout = event => {
|
|
51
|
-
onLayoutChange === null || onLayoutChange === void 0 || onLayoutChange(event.nativeEvent.layout.height);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/* Check if the iPhone bottom handle is present.
|
|
55
|
-
If not add a default margin to prevent the
|
|
56
|
-
button from sticking to the bottom. */
|
|
57
|
-
const bottomMargin = useMemo(() => insets.bottom === 0 ? verticalSpacing : insets.bottom, [insets]);
|
|
58
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
59
|
-
style: {
|
|
60
|
-
...styles.container,
|
|
61
|
-
...(sticky ? styles.sticky : {})
|
|
62
|
-
},
|
|
63
|
-
accessible: rest.accessible,
|
|
64
|
-
pointerEvents: "box-none",
|
|
65
|
-
testID: "FooterWithButtons"
|
|
66
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
67
|
-
onLayout: onLayout,
|
|
68
|
-
style: [styles.footerShadow, {
|
|
69
|
-
paddingBottom: bottomMargin,
|
|
70
|
-
paddingTop: verticalSpacing
|
|
71
|
-
}]
|
|
72
|
-
}, /*#__PURE__*/React.createElement(BlockButtons, rest)));
|
|
73
|
-
};
|
|
74
|
-
export default FooterWithButtons;
|
|
75
|
-
//# sourceMappingURL=FooterWithButtons.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","StyleSheet","View","useSafeAreaInsets","IOColors","IOVisualCostants","BlockButtons","styles","create","container","overflow","width","marginTop","paddingTop","sticky","position","bottom","footerShadow","backgroundColor","white","paddingHorizontal","appMarginDefault","shadowColor","black","shadowOffset","height","shadowOpacity","shadowRadius","elevation","verticalSpacing","FooterWithButtons","onLayoutChange","rest","insets","onLayout","event","nativeEvent","layout","bottomMargin","createElement","style","accessible","pointerEvents","testID","paddingBottom"],"sourceRoot":"../../../../src","sources":["components/layout/FooterWithButtons.tsx"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,SAASC,OAAO,QAAQ,OAAO;AAC/B,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,QAAQ,EAAkBC,gBAAgB,QAAQ,YAAY;AACvE,SAASC,YAAY,QAA2B,gBAAgB;AAOhE;AACA,MAAMC,MAAM,GAAGN,UAAU,CAACO,MAAM,CAAC;EAC/BC,SAAS,EAAE;IACTC,QAAQ,EAAE,QAAQ;IAClBC,KAAK,EAAE,MAAM;IACb;IACAC,SAAS,EAAE,CAAC,EAAE;IACdC,UAAU,EAAE;E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A,CAAAwC,aAAA,CAACrC,IAAI;IACHgC,QAAQ,EAAEA,QAAS;IACnBM,KAAK,EAAE,CACLjC,MAAM,CAACU,YAAY,EACnB;MAAE2B,aAAa,EAAEN,YAAY;MAAEzB,UAAU,EAAEgB;IAAgB,CAAC;EAC5D,gBAEF9B,KAAA,CAAAwC,aAAA,CAACjC,YAAY,EAAK0B,IAAO,CACrB,CACF,CAAC;AAEX,CAAC;AAED,eAAeF,iBAAiB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","Pressable","Animated","IOListItemStyles","IOListItemVisualParams","useListItemSpringAnimation","PressableListItemBase","onPress","testID","children","accessibilityRole","props","onPressIn","onPressOut","animatedScaleStyle","animatedBackgroundStyle","createElement","_extends","accessible","onTouchEnd","View","style","listItem","listItemInner","columnGap","iconMargin"],"sourceRoot":"../../../../src","sources":["components/listitems/PressableListItemsBase.tsx"],"mappings":";AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,SAAS,QAAQ,cAAc;AACxC,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,gBAAgB,EAAEC,sBAAsB,QAAQ,YAAY;AAErE,SAASC,0BAA0B,QAAQ,oCAAoC;AAa/E,OAAO,MAAMC,qBAAqB,GAAGA,CAAC;EACpCC,OAAO;EACPC,MAAM;EACNC,QAAQ;EACRC,iBAAiB;EACjB,GAAGC;AACwC,CAAC,KAAK;EACjD,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,kBAAkB;IAAEC;EAAwB,CAAC,GAC1EV,0BAA0B,CAAC,CAAC;EAC9B,oBACEL,KAAA,CAAAgB,aAAA,CAACf,SAAS,EAAAgB,QAAA;IACRV,OAAO,EAAEA,OAAQ;IACjBC,MAAM,EAAEA,MAAO;IACfU,UAAU,EAAE,IAAK;IACjBN,SAAS,EAAEA,SAAU;IACrBC,UAAU,EAAEA,UAAW;IACvBM,UAAU,EAAEN,UAAW;IACvBH,iBAAiB,EAAEA,iBAAiB,IAAI;EAAS,GAC7CC,KAAK,gBAETX,KAAA,CAAAgB,aAAA,CAACd,QAAQ,CAACkB,IAAI;IACZC,KAAK,EAAE,CAAClB,gBAAgB,CAACmB,QAAQ,EAAEP,uBAAuB;EAAE,gBAE5Df,KAAA,CAAAgB,aAAA,CAACd,QAAQ,CAACkB,IAAI;IACZC,KAAK,EAAE,CACLlB,gBAAgB,CAACoB,aAAa,EAC9B;MAAEC,SAAS,EAAEpB,sBAAsB,CAACqB;IAAW,CAAC,EAChDX,kBAAkB;EAClB,GAEDL,QACY,CACF,CACN,CAAC;AAEhB,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Extrapolate, interpolate, interpolateColor, useAnimatedStyle, useDerivedValue, useSharedValue, withSpring } from "react-native-reanimated";
|
|
3
|
-
import { IOColors, IOScaleValues, IOSpringValues, hexToRgba, useIOTheme } from "../../../core";
|
|
4
|
-
export const useListItemSpringAnimation = () => {
|
|
5
|
-
var _IOScaleValues$basicB;
|
|
6
|
-
const theme = useIOTheme();
|
|
7
|
-
const isPressed = useSharedValue(0);
|
|
8
|
-
const mapBackgroundStates = {
|
|
9
|
-
default: hexToRgba(IOColors[theme["listItem-pressed"]], 0),
|
|
10
|
-
pressed: IOColors[theme["listItem-pressed"]]
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
// Scaling transformation applied when the button is pressed
|
|
14
|
-
const animationScaleValue = IOScaleValues === null || IOScaleValues === void 0 || (_IOScaleValues$basicB = IOScaleValues.basicButton) === null || _IOScaleValues$basicB === void 0 ? void 0 : _IOScaleValues$basicB.pressedState;
|
|
15
|
-
const progressPressed = useDerivedValue(() => withSpring(isPressed.value, IOSpringValues.button));
|
|
16
|
-
|
|
17
|
-
// Interpolate animation values from `isPressed` values
|
|
18
|
-
const animatedScaleStyle = useAnimatedStyle(() => {
|
|
19
|
-
const scale = interpolate(progressPressed.value, [0, 1], [1, animationScaleValue], Extrapolate.CLAMP);
|
|
20
|
-
return {
|
|
21
|
-
transform: [{
|
|
22
|
-
scale
|
|
23
|
-
}]
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
const animatedBackgroundStyle = useAnimatedStyle(() => {
|
|
27
|
-
const backgroundColor = interpolateColor(progressPressed.value, [0, 1], [mapBackgroundStates.default, mapBackgroundStates.pressed]);
|
|
28
|
-
return {
|
|
29
|
-
backgroundColor
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
const onPressIn = React.useCallback(() => {
|
|
33
|
-
// eslint-disable-next-line functional/immutable-data
|
|
34
|
-
isPressed.value = 1;
|
|
35
|
-
}, [isPressed]);
|
|
36
|
-
const onPressOut = React.useCallback(() => {
|
|
37
|
-
// eslint-disable-next-line functional/immutable-data
|
|
38
|
-
isPressed.value = 0;
|
|
39
|
-
}, [isPressed]);
|
|
40
|
-
return {
|
|
41
|
-
onPressIn,
|
|
42
|
-
onPressOut,
|
|
43
|
-
animatedScaleStyle,
|
|
44
|
-
animatedBackgroundStyle
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=useListItemSpringAnimation.js.map
|