@pagopa/io-app-design-system 5.0.0-2 → 5.0.0-3
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.map +1 -1
- package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +0 -4
- package/lib/commonjs/components/buttons/ButtonOutline.js +8 -8
- package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButton.js +1 -1
- package/lib/commonjs/components/buttons/IconButton.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButtonContained.js +3 -3
- package/lib/commonjs/components/buttons/IconButtonContained.js.map +1 -1
- package/lib/commonjs/components/icons/Icon.js +2 -2
- package/lib/commonjs/components/icons/Icon.js.map +1 -1
- package/lib/commonjs/components/icons/README.md +1 -1
- package/lib/commonjs/components/layout/HeaderFirstLevel.js +35 -15
- package/lib/commonjs/components/layout/HeaderFirstLevel.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemHeader.js +9 -20
- package/lib/commonjs/components/listitems/ListItemHeader.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemInfo.js +47 -13
- package/lib/commonjs/components/listitems/ListItemInfo.js.map +1 -1
- package/lib/commonjs/components/listitems/PressableListItemBase.js.map +1 -1
- package/lib/commonjs/components/modules/PressableModuleBase.js +10 -2
- package/lib/commonjs/components/modules/PressableModuleBase.js.map +1 -1
- package/lib/commonjs/components/numberpad/NumberButton.js +12 -2
- 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/otpInput/OTPInput.js +2 -1
- package/lib/commonjs/components/otpInput/OTPInput.js.map +1 -1
- package/lib/commonjs/components/pictograms/Pictogram.js +3 -24
- package/lib/commonjs/components/pictograms/Pictogram.js.map +1 -1
- package/lib/commonjs/components/pictograms/svg/{PictogramUmbrellaNew.js → PictogramUmbrella.js} +3 -3
- package/lib/commonjs/components/pictograms/svg/PictogramUmbrella.js.map +1 -0
- package/lib/commonjs/components/searchInput/SearchInput.js +15 -4
- package/lib/commonjs/components/searchInput/SearchInput.js.map +1 -1
- package/lib/commonjs/components/spacer/Spacer.js +1 -1
- package/lib/commonjs/components/spacer/Spacer.js.map +1 -1
- package/lib/commonjs/components/textInput/TextInputBase.js +18 -15
- package/lib/commonjs/components/textInput/TextInputBase.js.map +1 -1
- package/lib/commonjs/components/textInput/TextInputValidation.js +8 -6
- package/lib/commonjs/components/textInput/TextInputValidation.js.map +1 -1
- package/lib/commonjs/components/typography/__test__/__snapshots__/typography.test.tsx.snap +7 -7
- package/lib/commonjs/components/typography/__test__/typography.test.js +13 -13
- package/lib/commonjs/components/typography/__test__/typography.test.js.map +1 -1
- package/lib/commonjs/core/IOColors.js +21 -105
- package/lib/commonjs/core/IOColors.js.map +1 -1
- package/lib/commonjs/core/IOThemeContextProvider.js +14 -9
- package/lib/commonjs/core/IOThemeContextProvider.js.map +1 -1
- package/lib/module/components/alert/Alert.js.map +1 -1
- package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +0 -4
- package/lib/module/components/buttons/ButtonOutline.js +8 -8
- package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/module/components/buttons/IconButton.js +1 -1
- package/lib/module/components/buttons/IconButton.js.map +1 -1
- package/lib/module/components/buttons/IconButtonContained.js +3 -3
- package/lib/module/components/buttons/IconButtonContained.js.map +1 -1
- package/lib/module/components/icons/Icon.js +2 -2
- package/lib/module/components/icons/Icon.js.map +1 -1
- package/lib/module/components/icons/README.md +1 -1
- package/lib/module/components/layout/HeaderFirstLevel.js +37 -17
- package/lib/module/components/layout/HeaderFirstLevel.js.map +1 -1
- package/lib/module/components/listitems/ListItemHeader.js +9 -20
- package/lib/module/components/listitems/ListItemHeader.js.map +1 -1
- package/lib/module/components/listitems/ListItemInfo.js +48 -15
- package/lib/module/components/listitems/ListItemInfo.js.map +1 -1
- package/lib/module/components/listitems/PressableListItemBase.js.map +1 -1
- package/lib/module/components/modules/PressableModuleBase.js +10 -2
- package/lib/module/components/modules/PressableModuleBase.js.map +1 -1
- package/lib/module/components/numberpad/NumberButton.js +14 -4
- 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/otpInput/OTPInput.js +2 -1
- package/lib/module/components/otpInput/OTPInput.js.map +1 -1
- package/lib/module/components/pictograms/Pictogram.js +2 -22
- package/lib/module/components/pictograms/Pictogram.js.map +1 -1
- package/lib/module/components/pictograms/svg/{PictogramUmbrellaNew.js → PictogramUmbrella.js} +3 -3
- package/lib/module/components/pictograms/svg/PictogramUmbrella.js.map +1 -0
- package/lib/module/components/searchInput/SearchInput.js +15 -4
- package/lib/module/components/searchInput/SearchInput.js.map +1 -1
- package/lib/module/components/spacer/Spacer.js +1 -1
- package/lib/module/components/spacer/Spacer.js.map +1 -1
- package/lib/module/components/textInput/TextInputBase.js +19 -16
- package/lib/module/components/textInput/TextInputBase.js.map +1 -1
- package/lib/module/components/textInput/TextInputValidation.js +8 -6
- package/lib/module/components/textInput/TextInputValidation.js.map +1 -1
- package/lib/module/components/typography/__test__/__snapshots__/typography.test.tsx.snap +7 -7
- package/lib/module/components/typography/__test__/typography.test.js +13 -13
- package/lib/module/components/typography/__test__/typography.test.js.map +1 -1
- package/lib/module/core/IOColors.js +20 -103
- package/lib/module/core/IOColors.js.map +1 -1
- package/lib/module/core/IOThemeContextProvider.js +12 -8
- package/lib/module/core/IOThemeContextProvider.js.map +1 -1
- package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
- package/lib/typescript/components/layout/HeaderFirstLevel.d.ts +8 -28
- package/lib/typescript/components/layout/HeaderFirstLevel.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemHeader.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemInfo.d.ts +13 -11
- package/lib/typescript/components/listitems/ListItemInfo.d.ts.map +1 -1
- package/lib/typescript/components/listitems/PressableListItemBase.d.ts +2 -2
- package/lib/typescript/components/listitems/PressableListItemBase.d.ts.map +1 -1
- package/lib/typescript/components/modules/PressableModuleBase.d.ts.map +1 -1
- package/lib/typescript/components/numberpad/NumberButton.d.ts.map +1 -1
- package/lib/typescript/components/otpInput/OTPInput.d.ts.map +1 -1
- package/lib/typescript/components/pictograms/Pictogram.d.ts +3 -12
- package/lib/typescript/components/pictograms/Pictogram.d.ts.map +1 -1
- package/lib/typescript/components/pictograms/svg/PictogramUmbrella.d.ts +5 -0
- package/lib/typescript/components/pictograms/svg/PictogramUmbrella.d.ts.map +1 -0
- package/lib/typescript/components/pictograms/types.d.ts +0 -1
- package/lib/typescript/components/pictograms/types.d.ts.map +1 -1
- package/lib/typescript/components/searchInput/SearchInput.d.ts.map +1 -1
- package/lib/typescript/components/textInput/TextInputBase.d.ts +2 -2
- package/lib/typescript/components/textInput/TextInputBase.d.ts.map +1 -1
- package/lib/typescript/components/textInput/TextInputValidation.d.ts.map +1 -1
- package/lib/typescript/components/tooltip/styles.d.ts +2 -2
- 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/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/IOColors.d.ts +1 -40
- package/lib/typescript/core/IOColors.d.ts.map +1 -1
- package/lib/typescript/core/IOStyles.d.ts +2 -2
- package/lib/typescript/core/IOThemeContextProvider.d.ts +6 -6
- package/lib/typescript/core/IOThemeContextProvider.d.ts.map +1 -1
- package/lib/typescript/utils/fonts.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/alert/Alert.tsx +3 -2
- package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +0 -4
- package/src/components/buttons/ButtonOutline.tsx +8 -8
- package/src/components/buttons/IconButton.tsx +1 -1
- package/src/components/buttons/IconButtonContained.tsx +3 -3
- package/src/components/icons/Icon.tsx +2 -2
- package/src/components/icons/README.md +1 -1
- package/src/components/layout/HeaderFirstLevel.tsx +50 -68
- package/src/components/listitems/ListItemHeader.tsx +9 -34
- package/src/components/listitems/ListItemInfo.tsx +107 -53
- package/src/components/listitems/PressableListItemBase.tsx +3 -2
- package/src/components/modules/PressableModuleBase.tsx +15 -4
- package/src/components/numberpad/NumberButton.tsx +19 -3
- package/src/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +40 -20
- package/src/components/otpInput/OTPInput.tsx +1 -0
- package/src/components/pictograms/Pictogram.tsx +2 -24
- package/src/components/pictograms/svg/{PictogramUmbrellaNew.tsx → PictogramUmbrella.tsx} +2 -2
- package/src/components/pictograms/types.ts +0 -1
- package/src/components/searchInput/SearchInput.tsx +25 -3
- package/src/components/spacer/Spacer.tsx +1 -1
- package/src/components/textInput/TextInputBase.tsx +28 -15
- package/src/components/textInput/TextInputValidation.tsx +18 -10
- package/src/components/typography/__test__/__snapshots__/typography.test.tsx.snap +7 -7
- package/src/components/typography/__test__/typography.test.tsx +18 -16
- package/src/core/IOColors.ts +24 -104
- package/src/core/IOThemeContextProvider.tsx +25 -15
- package/lib/commonjs/components/Advice/Advice.js +0 -42
- package/lib/commonjs/components/Advice/Advice.js.map +0 -1
- package/lib/commonjs/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +0 -213
- package/lib/commonjs/components/Advice/__test__/advice.test.js +0 -26
- package/lib/commonjs/components/Advice/__test__/advice.test.js.map +0 -1
- package/lib/commonjs/components/Advice/index.js +0 -17
- package/lib/commonjs/components/Advice/index.js.map +0 -1
- package/lib/commonjs/components/pictograms/svg/PictogramCompleted.js +0 -33
- package/lib/commonjs/components/pictograms/svg/PictogramCompleted.js.map +0 -1
- package/lib/commonjs/components/pictograms/svg/PictogramProcessing.js +0 -33
- package/lib/commonjs/components/pictograms/svg/PictogramProcessing.js.map +0 -1
- package/lib/commonjs/components/pictograms/svg/PictogramUmbrellaNew.js.map +0 -1
- package/lib/commonjs/components/pictograms/svg/originals/PictogramCompleted.svg +0 -14
- package/lib/module/components/Advice/Advice.js +0 -34
- package/lib/module/components/Advice/Advice.js.map +0 -1
- package/lib/module/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +0 -213
- package/lib/module/components/Advice/__test__/advice.test.js +0 -21
- package/lib/module/components/Advice/__test__/advice.test.js.map +0 -1
- package/lib/module/components/Advice/index.js +0 -2
- package/lib/module/components/Advice/index.js.map +0 -1
- package/lib/module/components/pictograms/svg/PictogramCompleted.js +0 -25
- package/lib/module/components/pictograms/svg/PictogramCompleted.js.map +0 -1
- package/lib/module/components/pictograms/svg/PictogramProcessing.js +0 -25
- package/lib/module/components/pictograms/svg/PictogramProcessing.js.map +0 -1
- package/lib/module/components/pictograms/svg/PictogramUmbrellaNew.js.map +0 -1
- package/lib/module/components/pictograms/svg/originals/PictogramCompleted.svg +0 -14
- package/lib/typescript/components/Advice/Advice.d.ts +0 -16
- package/lib/typescript/components/Advice/Advice.d.ts.map +0 -1
- package/lib/typescript/components/Advice/__test__/advice.test.d.ts +0 -2
- package/lib/typescript/components/Advice/__test__/advice.test.d.ts.map +0 -1
- package/lib/typescript/components/Advice/index.d.ts +0 -2
- package/lib/typescript/components/Advice/index.d.ts.map +0 -1
- package/lib/typescript/components/pictograms/svg/PictogramCompleted.d.ts +0 -5
- package/lib/typescript/components/pictograms/svg/PictogramCompleted.d.ts.map +0 -1
- package/lib/typescript/components/pictograms/svg/PictogramProcessing.d.ts +0 -5
- package/lib/typescript/components/pictograms/svg/PictogramProcessing.d.ts.map +0 -1
- package/lib/typescript/components/pictograms/svg/PictogramUmbrellaNew.d.ts +0 -5
- package/lib/typescript/components/pictograms/svg/PictogramUmbrellaNew.d.ts.map +0 -1
- package/src/components/Advice/Advice.tsx +0 -42
- package/src/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +0 -213
- package/src/components/Advice/__test__/advice.test.tsx +0 -22
- package/src/components/Advice/index.tsx +0 -1
- package/src/components/pictograms/svg/PictogramCompleted.tsx +0 -22
- package/src/components/pictograms/svg/PictogramProcessing.tsx +0 -22
- package/src/components/pictograms/svg/originals/PictogramCompleted.svg +0 -14
- /package/lib/commonjs/components/pictograms/svg/originals/{PictogramUmbrellaNew.svg → PictogramUmbrella.svg} +0 -0
- /package/lib/module/components/pictograms/svg/originals/{PictogramUmbrellaNew.svg → PictogramUmbrella.svg} +0 -0
- /package/src/components/pictograms/svg/originals/{PictogramUmbrellaNew.svg → PictogramUmbrella.svg} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { useEffect, useLayoutEffect } from "react";
|
|
2
|
+
import { createRef, useEffect, useLayoutEffect } from "react";
|
|
3
3
|
import {
|
|
4
4
|
AccessibilityInfo,
|
|
5
5
|
findNodeHandle,
|
|
@@ -7,7 +7,9 @@ import {
|
|
|
7
7
|
View
|
|
8
8
|
} from "react-native";
|
|
9
9
|
import Animated, {
|
|
10
|
+
AnimatedRef,
|
|
10
11
|
useAnimatedStyle,
|
|
12
|
+
useScrollViewOffset,
|
|
11
13
|
useSharedValue,
|
|
12
14
|
withTiming
|
|
13
15
|
} from "react-native-reanimated";
|
|
@@ -24,44 +26,15 @@ import { HStack } from "../stack";
|
|
|
24
26
|
import { H3 } from "../typography";
|
|
25
27
|
import { HeaderActionProps } from "./common";
|
|
26
28
|
|
|
27
|
-
type
|
|
29
|
+
export type HeaderFirstLevel = WithTestID<{
|
|
28
30
|
title: string;
|
|
29
|
-
// This Prop will be removed once all the screens on the first level routing will be refactored
|
|
30
|
-
backgroundColor?: "light" | "dark";
|
|
31
|
-
ignoreSafeAreaMargin?: boolean;
|
|
32
|
-
}>;
|
|
33
|
-
|
|
34
|
-
interface Base extends CommonProps {
|
|
35
|
-
type: "base";
|
|
36
|
-
firstAction?: never;
|
|
37
|
-
secondAction?: never;
|
|
38
|
-
thirdAction?: never;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
interface OneAction extends CommonProps {
|
|
42
|
-
type: "singleAction";
|
|
43
|
-
firstAction: HeaderActionProps;
|
|
44
|
-
secondAction?: never;
|
|
45
|
-
thirdAction?: never;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface TwoActions extends CommonProps {
|
|
49
|
-
type: "twoActions";
|
|
50
31
|
firstAction: HeaderActionProps;
|
|
51
32
|
secondAction: HeaderActionProps;
|
|
52
|
-
thirdAction?:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
firstAction: HeaderActionProps;
|
|
58
|
-
secondAction: HeaderActionProps;
|
|
59
|
-
thirdAction: HeaderActionProps;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export type HeaderFirstLevel = Base | OneAction | TwoActions | ThreeActions;
|
|
63
|
-
|
|
64
|
-
const HEADER_BG_COLOR_DARK: IOColors = "bluegrey";
|
|
33
|
+
thirdAction?: HeaderActionProps;
|
|
34
|
+
animatedRef?: AnimatedRef<Animated.ScrollView>;
|
|
35
|
+
animatedFlatListRef?: AnimatedRef<Animated.FlatList<any>>;
|
|
36
|
+
ignoreSafeAreaMargin?: boolean;
|
|
37
|
+
}>;
|
|
65
38
|
|
|
66
39
|
const styles = StyleSheet.create({
|
|
67
40
|
headerInner: {
|
|
@@ -71,20 +44,28 @@ const styles = StyleSheet.create({
|
|
|
71
44
|
flexDirection: "row",
|
|
72
45
|
alignItems: "center",
|
|
73
46
|
justifyContent: "space-between"
|
|
47
|
+
},
|
|
48
|
+
headerDivider: {
|
|
49
|
+
position: "absolute",
|
|
50
|
+
width: "100%",
|
|
51
|
+
height: StyleSheet.hairlineWidth,
|
|
52
|
+
left: 0,
|
|
53
|
+
right: 0,
|
|
54
|
+
bottom: 0
|
|
74
55
|
}
|
|
75
56
|
});
|
|
76
57
|
|
|
77
58
|
export const HeaderFirstLevel = ({
|
|
78
59
|
title,
|
|
79
|
-
type,
|
|
80
60
|
testID,
|
|
81
|
-
backgroundColor = "light",
|
|
82
|
-
ignoreSafeAreaMargin = false,
|
|
83
61
|
firstAction,
|
|
84
62
|
secondAction,
|
|
85
|
-
thirdAction
|
|
63
|
+
thirdAction,
|
|
64
|
+
ignoreSafeAreaMargin = false,
|
|
65
|
+
animatedRef,
|
|
66
|
+
animatedFlatListRef
|
|
86
67
|
}: HeaderFirstLevel) => {
|
|
87
|
-
const titleRef =
|
|
68
|
+
const titleRef = createRef<View>();
|
|
88
69
|
const insets = useSafeAreaInsets();
|
|
89
70
|
const theme = useIOTheme();
|
|
90
71
|
const paddingTop = useSharedValue(ignoreSafeAreaMargin ? 0 : insets.top);
|
|
@@ -96,6 +77,12 @@ export const HeaderFirstLevel = ({
|
|
|
96
77
|
}
|
|
97
78
|
});
|
|
98
79
|
|
|
80
|
+
/* We show the divider only when the header is scrolled down */
|
|
81
|
+
const offset = useScrollViewOffset(
|
|
82
|
+
(animatedRef as AnimatedRef<Animated.ScrollView>) ||
|
|
83
|
+
(animatedFlatListRef as AnimatedRef<Animated.FlatList<any>>)
|
|
84
|
+
);
|
|
85
|
+
|
|
99
86
|
useEffect(() => {
|
|
100
87
|
// eslint-disable-next-line functional/immutable-data
|
|
101
88
|
paddingTop.value = withTiming(
|
|
@@ -108,52 +95,47 @@ export const HeaderFirstLevel = ({
|
|
|
108
95
|
paddingTop: paddingTop.value
|
|
109
96
|
}));
|
|
110
97
|
|
|
98
|
+
const animatedDivider = useAnimatedStyle(() => ({
|
|
99
|
+
opacity: withTiming(offset.value > 0 ? 1 : 0, { duration: 200 })
|
|
100
|
+
}));
|
|
101
|
+
|
|
111
102
|
return (
|
|
112
103
|
<Animated.View
|
|
113
104
|
style={[
|
|
114
|
-
{
|
|
115
|
-
backgroundColor:
|
|
116
|
-
backgroundColor === "light"
|
|
117
|
-
? IOColors[theme["appBackground-primary"]]
|
|
118
|
-
: IOColors[HEADER_BG_COLOR_DARK]
|
|
119
|
-
},
|
|
105
|
+
{ backgroundColor: IOColors[theme["appBackground-primary"]] },
|
|
120
106
|
animatedStyle
|
|
121
107
|
]}
|
|
122
108
|
accessibilityRole="header"
|
|
123
109
|
testID={testID}
|
|
124
110
|
>
|
|
111
|
+
{/* Divider */}
|
|
112
|
+
{(animatedRef || animatedFlatListRef) && (
|
|
113
|
+
<Animated.View
|
|
114
|
+
style={[
|
|
115
|
+
{
|
|
116
|
+
...styles.headerDivider,
|
|
117
|
+
backgroundColor: IOColors[theme["divider-default"]]
|
|
118
|
+
},
|
|
119
|
+
animatedDivider
|
|
120
|
+
]}
|
|
121
|
+
/>
|
|
122
|
+
)}
|
|
123
|
+
|
|
125
124
|
<View style={styles.headerInner}>
|
|
126
125
|
<View ref={titleRef} accessible accessibilityRole="header">
|
|
127
126
|
<H3
|
|
128
127
|
weight="Bold"
|
|
129
128
|
style={{ flexShrink: 1 }}
|
|
130
129
|
numberOfLines={1}
|
|
131
|
-
color={
|
|
132
|
-
backgroundColor === "dark" ? "white" : theme["textBody-default"]
|
|
133
|
-
}
|
|
130
|
+
color={theme["textHeading-default"]}
|
|
134
131
|
>
|
|
135
132
|
{title}
|
|
136
133
|
</H3>
|
|
137
134
|
</View>
|
|
138
135
|
<HStack space={16} style={{ flexShrink: 0 }}>
|
|
139
|
-
{
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
color={backgroundColor === "dark" ? "contrast" : "primary"}
|
|
143
|
-
/>
|
|
144
|
-
)}
|
|
145
|
-
{(type === "twoActions" || type === "threeActions") && (
|
|
146
|
-
<IconButton
|
|
147
|
-
{...secondAction}
|
|
148
|
-
color={backgroundColor === "dark" ? "contrast" : "primary"}
|
|
149
|
-
/>
|
|
150
|
-
)}
|
|
151
|
-
{type !== "base" && (
|
|
152
|
-
<IconButton
|
|
153
|
-
{...firstAction}
|
|
154
|
-
color={backgroundColor === "dark" ? "contrast" : "primary"}
|
|
155
|
-
/>
|
|
156
|
-
)}
|
|
136
|
+
{thirdAction && <IconButton {...thirdAction} color={"primary"} />}
|
|
137
|
+
<IconButton {...secondAction} color={"primary"} />
|
|
138
|
+
<IconButton {...firstAction} color={"primary"} />
|
|
157
139
|
</HStack>
|
|
158
140
|
</View>
|
|
159
141
|
</Animated.View>
|
|
@@ -65,30 +65,19 @@ export const ListItemHeader = ({
|
|
|
65
65
|
const { dynamicFontScale, spacingScaleMultiplier, hugeFontEnabled } =
|
|
66
66
|
useIOFontDynamicScale();
|
|
67
67
|
|
|
68
|
-
const listItemAccessibilityLabel = useMemo(
|
|
69
|
-
() => (accessibilityLabel ? accessibilityLabel : `${label}`),
|
|
70
|
-
[label, accessibilityLabel]
|
|
71
|
-
);
|
|
72
|
-
|
|
73
68
|
const itemInfoTextComponent = useMemo(
|
|
74
69
|
() => (
|
|
75
70
|
<View
|
|
76
|
-
accessible
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
? "no-hide-descendants"
|
|
80
|
-
: "yes"
|
|
81
|
-
}
|
|
82
|
-
accessibilityElementsHidden={
|
|
83
|
-
endElement !== undefined && endElement.type !== "badge"
|
|
84
|
-
}
|
|
71
|
+
accessible
|
|
72
|
+
accessibilityRole="header"
|
|
73
|
+
accessibilityLabel={accessibilityLabel ?? label}
|
|
85
74
|
>
|
|
86
75
|
<H6 role="heading" color={theme["textBody-tertiary"]}>
|
|
87
76
|
{label}
|
|
88
77
|
</H6>
|
|
89
78
|
</View>
|
|
90
79
|
),
|
|
91
|
-
[label,
|
|
80
|
+
[label, accessibilityLabel, theme]
|
|
92
81
|
);
|
|
93
82
|
|
|
94
83
|
const listItemAction = useCallback(() => {
|
|
@@ -97,21 +86,12 @@ export const ListItemHeader = ({
|
|
|
97
86
|
|
|
98
87
|
switch (type) {
|
|
99
88
|
case "buttonLink":
|
|
100
|
-
const buttonLinkAccessibilityLabel = `${listItemAccessibilityLabel}; ${componentProps.accessibilityLabel}`;
|
|
101
|
-
|
|
102
89
|
return (
|
|
103
|
-
<ButtonLink
|
|
104
|
-
{...componentProps}
|
|
105
|
-
accessibilityLabel={buttonLinkAccessibilityLabel}
|
|
106
|
-
/>
|
|
90
|
+
<ButtonLink {...componentProps} />
|
|
107
91
|
);
|
|
108
|
-
case "iconButton":
|
|
109
|
-
const iconButtonAccessibilityLabel = `${listItemAccessibilityLabel}; ${componentProps.accessibilityLabel}`;
|
|
92
|
+
case "iconButton":
|
|
110
93
|
return (
|
|
111
|
-
<IconButton
|
|
112
|
-
{...componentProps}
|
|
113
|
-
accessibilityLabel={iconButtonAccessibilityLabel}
|
|
114
|
-
/>
|
|
94
|
+
<IconButton {...componentProps} />
|
|
115
95
|
);
|
|
116
96
|
case "badge":
|
|
117
97
|
return <Badge {...componentProps} />;
|
|
@@ -120,19 +100,14 @@ export const ListItemHeader = ({
|
|
|
120
100
|
}
|
|
121
101
|
}
|
|
122
102
|
return <></>;
|
|
123
|
-
}, [endElement
|
|
103
|
+
}, [endElement]);
|
|
124
104
|
|
|
125
105
|
return (
|
|
126
106
|
<View
|
|
127
107
|
style={IOListItemStyles.listItem}
|
|
128
108
|
testID={testID}
|
|
129
|
-
accessible={endElement === undefined ? true : false}
|
|
130
|
-
accessibilityLabel={listItemAccessibilityLabel}
|
|
131
109
|
>
|
|
132
|
-
<View
|
|
133
|
-
style={IOListItemStyles.listItemInner}
|
|
134
|
-
importantForAccessibility={endElement ? "auto" : "no-hide-descendants"}
|
|
135
|
-
>
|
|
110
|
+
<View style={IOListItemStyles.listItemInner}>
|
|
136
111
|
{iconName && !hugeFontEnabled && (
|
|
137
112
|
<View
|
|
138
113
|
style={{
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import React, { ComponentProps, useCallback, useMemo } from "react";
|
|
2
|
-
import { AccessibilityRole, Platform, View } from "react-native";
|
|
1
|
+
import React, { ComponentProps, ReactNode, useCallback, useMemo } from "react";
|
|
2
|
+
import { AccessibilityRole, Platform, Pressable, View } from "react-native";
|
|
3
|
+
import Animated from "react-native-reanimated";
|
|
3
4
|
import {
|
|
4
5
|
IOListItemStyles,
|
|
5
6
|
IOListItemVisualParams,
|
|
6
7
|
IOStyles,
|
|
7
8
|
useIOTheme
|
|
8
9
|
} from "../../core";
|
|
10
|
+
import { useListItemAnimation } from "../../hooks";
|
|
9
11
|
import { useIOFontDynamicScale } from "../../utils/accessibility";
|
|
10
12
|
import { WithTestID } from "../../utils/types";
|
|
11
13
|
import { Badge } from "../badge";
|
|
@@ -13,7 +15,7 @@ import { ButtonLink, IconButton } from "../buttons";
|
|
|
13
15
|
import { LogoPaymentWithFallback } from "../common/LogoPaymentWithFallback";
|
|
14
16
|
import { IOIconSizeScale, IOIcons, Icon } from "../icons";
|
|
15
17
|
import { IOLogoPaymentType } from "../logos";
|
|
16
|
-
import {
|
|
18
|
+
import { BodySmall, H6 } from "../typography";
|
|
17
19
|
|
|
18
20
|
type ButtonLinkActionProps = {
|
|
19
21
|
type: "buttonLink";
|
|
@@ -35,25 +37,32 @@ type EndElementProps =
|
|
|
35
37
|
| IconButtonActionProps
|
|
36
38
|
| BadgeProps;
|
|
37
39
|
|
|
40
|
+
type GraphicProps =
|
|
41
|
+
| {
|
|
42
|
+
paymentLogoIcon?: IOLogoPaymentType;
|
|
43
|
+
icon?: never;
|
|
44
|
+
}
|
|
45
|
+
| {
|
|
46
|
+
paymentLogoIcon?: never;
|
|
47
|
+
icon?: IOIcons;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
type InteractiveProps = Pick<
|
|
51
|
+
ComponentProps<typeof Pressable>,
|
|
52
|
+
"onLongPress" | "accessibilityActions" | "onAccessibilityAction"
|
|
53
|
+
>;
|
|
54
|
+
|
|
38
55
|
export type ListItemInfo = WithTestID<{
|
|
39
56
|
label: string;
|
|
40
|
-
value: string |
|
|
57
|
+
value: string | ReactNode;
|
|
41
58
|
numberOfLines?: number;
|
|
42
59
|
endElement?: EndElementProps;
|
|
43
60
|
// Accessibility
|
|
44
61
|
accessibilityLabel?: string;
|
|
45
62
|
accessibilityRole?: AccessibilityRole;
|
|
46
63
|
}> &
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
paymentLogoIcon?: IOLogoPaymentType;
|
|
50
|
-
icon?: never;
|
|
51
|
-
}
|
|
52
|
-
| {
|
|
53
|
-
icon?: IOIcons;
|
|
54
|
-
paymentLogoIcon?: never;
|
|
55
|
-
}
|
|
56
|
-
);
|
|
64
|
+
GraphicProps &
|
|
65
|
+
InteractiveProps;
|
|
57
66
|
|
|
58
67
|
const PAYMENT_LOGO_SIZE: IOIconSizeScale = 24;
|
|
59
68
|
|
|
@@ -66,22 +75,25 @@ export const ListItemInfo = ({
|
|
|
66
75
|
endElement,
|
|
67
76
|
accessibilityLabel,
|
|
68
77
|
accessibilityRole,
|
|
78
|
+
accessibilityActions,
|
|
79
|
+
onAccessibilityAction,
|
|
80
|
+
onLongPress,
|
|
69
81
|
testID
|
|
70
82
|
}: ListItemInfo) => {
|
|
71
83
|
const theme = useIOTheme();
|
|
72
84
|
const { dynamicFontScale, spacingScaleMultiplier, hugeFontEnabled } =
|
|
73
85
|
useIOFontDynamicScale();
|
|
74
86
|
|
|
87
|
+
const { onPressIn, onPressOut, scaleAnimatedStyle, backgroundAnimatedStyle } =
|
|
88
|
+
useListItemAnimation();
|
|
89
|
+
|
|
75
90
|
const componentValueToAccessibility = useMemo(
|
|
76
91
|
() => (typeof value === "string" ? value : ""),
|
|
77
92
|
[value]
|
|
78
93
|
);
|
|
79
94
|
|
|
80
95
|
const listItemAccessibilityLabel = useMemo(
|
|
81
|
-
() =>
|
|
82
|
-
accessibilityLabel
|
|
83
|
-
? accessibilityLabel
|
|
84
|
-
: `${label}; ${componentValueToAccessibility}`,
|
|
96
|
+
() => accessibilityLabel ?? `${label}; ${componentValueToAccessibility}`,
|
|
85
97
|
[label, componentValueToAccessibility, accessibilityLabel]
|
|
86
98
|
);
|
|
87
99
|
|
|
@@ -136,44 +148,86 @@ export const ListItemInfo = ({
|
|
|
136
148
|
return <></>;
|
|
137
149
|
}, [endElement]);
|
|
138
150
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
151
|
+
const ListItemInfoContent = () => (
|
|
152
|
+
<>
|
|
153
|
+
{icon && !hugeFontEnabled && (
|
|
154
|
+
<Icon
|
|
155
|
+
allowFontScaling
|
|
156
|
+
name={icon}
|
|
157
|
+
color="grey-450"
|
|
158
|
+
size={IOListItemVisualParams.iconSize}
|
|
159
|
+
/>
|
|
160
|
+
)}
|
|
161
|
+
{paymentLogoIcon && (
|
|
162
|
+
<LogoPaymentWithFallback
|
|
163
|
+
brand={paymentLogoIcon}
|
|
164
|
+
size={PAYMENT_LOGO_SIZE}
|
|
165
|
+
/>
|
|
166
|
+
)}
|
|
167
|
+
<View style={IOStyles.flex}>{itemInfoTextComponent}</View>
|
|
168
|
+
{endElement && <View>{listItemInfoAction()}</View>}
|
|
169
|
+
</>
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
if (onLongPress) {
|
|
173
|
+
return (
|
|
174
|
+
<Pressable
|
|
175
|
+
onLongPress={onLongPress}
|
|
176
|
+
testID={testID}
|
|
177
|
+
accessible={!endElement}
|
|
178
|
+
onPressIn={onPressIn}
|
|
179
|
+
onPressOut={onPressOut}
|
|
180
|
+
onTouchEnd={onPressOut}
|
|
181
|
+
accessibilityRole={"button"}
|
|
182
|
+
accessibilityLabel={listItemAccessibilityLabel}
|
|
183
|
+
accessibilityActions={accessibilityActions}
|
|
184
|
+
onAccessibilityAction={onAccessibilityAction}
|
|
185
|
+
>
|
|
186
|
+
<Animated.View
|
|
187
|
+
style={[IOListItemStyles.listItem, backgroundAnimatedStyle]}
|
|
188
|
+
>
|
|
189
|
+
<Animated.View
|
|
190
|
+
style={[
|
|
191
|
+
IOListItemStyles.listItemInner,
|
|
192
|
+
{
|
|
193
|
+
columnGap:
|
|
194
|
+
IOListItemVisualParams.iconMargin *
|
|
195
|
+
dynamicFontScale *
|
|
196
|
+
spacingScaleMultiplier
|
|
197
|
+
},
|
|
198
|
+
scaleAnimatedStyle
|
|
199
|
+
]}
|
|
200
|
+
>
|
|
201
|
+
<ListItemInfoContent />
|
|
202
|
+
</Animated.View>
|
|
203
|
+
</Animated.View>
|
|
204
|
+
</Pressable>
|
|
205
|
+
);
|
|
206
|
+
} else {
|
|
207
|
+
return (
|
|
147
208
|
<View
|
|
148
|
-
style={
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
dynamicFontScale *
|
|
154
|
-
spacingScaleMultiplier
|
|
155
|
-
}
|
|
156
|
-
]}
|
|
209
|
+
style={IOListItemStyles.listItem}
|
|
210
|
+
testID={testID}
|
|
211
|
+
accessible={!endElement}
|
|
212
|
+
accessibilityLabel={listItemAccessibilityLabel}
|
|
213
|
+
accessibilityRole={accessibilityRole}
|
|
157
214
|
>
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
)}
|
|
172
|
-
<View style={IOStyles.flex}>{itemInfoTextComponent}</View>
|
|
173
|
-
{endElement && <View>{listItemInfoAction()}</View>}
|
|
215
|
+
<View
|
|
216
|
+
style={[
|
|
217
|
+
IOListItemStyles.listItemInner,
|
|
218
|
+
{
|
|
219
|
+
columnGap:
|
|
220
|
+
IOListItemVisualParams.iconMargin *
|
|
221
|
+
dynamicFontScale *
|
|
222
|
+
spacingScaleMultiplier
|
|
223
|
+
}
|
|
224
|
+
]}
|
|
225
|
+
>
|
|
226
|
+
<ListItemInfoContent />
|
|
227
|
+
</View>
|
|
174
228
|
</View>
|
|
175
|
-
|
|
176
|
-
|
|
229
|
+
);
|
|
230
|
+
}
|
|
177
231
|
};
|
|
178
232
|
|
|
179
233
|
export default ListItemInfo;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { PropsWithChildren } from "react";
|
|
2
|
+
import { ComponentProps, PropsWithChildren } from "react";
|
|
3
3
|
import { Pressable } from "react-native";
|
|
4
4
|
import Animated from "react-native-reanimated";
|
|
5
5
|
import { IOListItemStyles, IOListItemVisualParams } from "../../core";
|
|
@@ -8,7 +8,7 @@ import { useListItemAnimation } from "../../hooks";
|
|
|
8
8
|
|
|
9
9
|
export type PressableBaseProps = WithTestID<
|
|
10
10
|
Pick<
|
|
11
|
-
|
|
11
|
+
ComponentProps<typeof Pressable>,
|
|
12
12
|
| "onPress"
|
|
13
13
|
| "accessibilityLabel"
|
|
14
14
|
| "accessibilityHint"
|
|
@@ -26,6 +26,7 @@ export const PressableListItemBase = ({
|
|
|
26
26
|
}: PropsWithChildren<PressableBaseProps>) => {
|
|
27
27
|
const { onPressIn, onPressOut, scaleAnimatedStyle, backgroundAnimatedStyle } =
|
|
28
28
|
useListItemAnimation();
|
|
29
|
+
|
|
29
30
|
return (
|
|
30
31
|
<Pressable
|
|
31
32
|
onPress={onPress}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { PropsWithChildren } from "react";
|
|
3
|
-
import { Pressable } from "react-native";
|
|
2
|
+
import { PropsWithChildren, useCallback } from "react";
|
|
3
|
+
import { GestureResponderEvent, Pressable } from "react-native";
|
|
4
|
+
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
4
5
|
import Animated, { useReducedMotion } from "react-native-reanimated";
|
|
5
|
-
import { useScaleAnimation } from "../../hooks";
|
|
6
6
|
import {
|
|
7
7
|
IOColors,
|
|
8
8
|
IOModuleIDPSavedVSpacing,
|
|
9
9
|
IOModuleStyles,
|
|
10
10
|
useIOTheme
|
|
11
11
|
} from "../../core";
|
|
12
|
+
import { useScaleAnimation } from "../../hooks";
|
|
12
13
|
import { WithTestID } from "../../utils/types";
|
|
13
14
|
|
|
14
15
|
export type PressableModuleBaseProps = WithTestID<
|
|
@@ -39,9 +40,19 @@ export const PressableModuleBase = ({
|
|
|
39
40
|
If we remove it, they they won't be able to understand
|
|
40
41
|
if there's an ongoing interaction. */
|
|
41
42
|
|
|
43
|
+
const handleOnPress = useCallback(
|
|
44
|
+
(event: GestureResponderEvent) => {
|
|
45
|
+
if (onPress) {
|
|
46
|
+
ReactNativeHapticFeedback.trigger("impactLight");
|
|
47
|
+
onPress(event);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
[onPress]
|
|
51
|
+
);
|
|
52
|
+
|
|
42
53
|
return (
|
|
43
54
|
<Pressable
|
|
44
|
-
onPress={
|
|
55
|
+
onPress={handleOnPress}
|
|
45
56
|
testID={testID}
|
|
46
57
|
accessible={true}
|
|
47
58
|
onPressIn={onPressIn}
|
|
@@ -5,9 +5,13 @@ import Animated, {
|
|
|
5
5
|
useAnimatedStyle,
|
|
6
6
|
useReducedMotion
|
|
7
7
|
} from "react-native-reanimated";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
IOColors,
|
|
10
|
+
IONumberPadButtonStyles,
|
|
11
|
+
useIONewTypeface
|
|
12
|
+
} from "../../core";
|
|
9
13
|
import { useScaleAnimation } from "../../hooks";
|
|
10
|
-
import {
|
|
14
|
+
import { IOText } from "../typography";
|
|
11
15
|
|
|
12
16
|
type NumberButtonVariantType = "light" | "dark";
|
|
13
17
|
|
|
@@ -57,6 +61,7 @@ export const NumberButton = memo(
|
|
|
57
61
|
const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
|
|
58
62
|
useScaleAnimation("slight");
|
|
59
63
|
const reducedMotion = useReducedMotion();
|
|
64
|
+
const { newTypefaceEnabled } = useIONewTypeface();
|
|
60
65
|
|
|
61
66
|
// Interpolate animation values from `isPressed` values
|
|
62
67
|
const pressedAnimationStyle = useAnimatedStyle(() => ({
|
|
@@ -88,7 +93,18 @@ export const NumberButton = memo(
|
|
|
88
93
|
!reducedMotion && scaleAnimatedStyle
|
|
89
94
|
]}
|
|
90
95
|
>
|
|
91
|
-
<
|
|
96
|
+
<IOText
|
|
97
|
+
size={22}
|
|
98
|
+
font={newTypefaceEnabled ? "Titillio" : "TitilliumSansPro"}
|
|
99
|
+
weight="Semibold"
|
|
100
|
+
color={colorMap[variant].foreground}
|
|
101
|
+
style={{
|
|
102
|
+
// Additional prop for Android
|
|
103
|
+
textAlignVertical: "center"
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
{number}
|
|
107
|
+
</IOText>
|
|
92
108
|
</Animated.View>
|
|
93
109
|
</Pressable>
|
|
94
110
|
);
|