@pagopa/io-app-design-system 2.1.2 → 3.0.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/common/LogoPaymentWithFallback.js +20 -11
- package/lib/commonjs/components/common/LogoPaymentWithFallback.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js +1 -3
- package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemTransaction.js +70 -91
- package/lib/commonjs/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/commonjs/components/listitems/PressableListItemsBase.js +3 -1
- package/lib/commonjs/components/listitems/PressableListItemsBase.js.map +1 -1
- package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +18 -38
- package/lib/commonjs/components/listitems/__test__/listitem.test.js +8 -4
- package/lib/commonjs/components/listitems/__test__/listitem.test.js.map +1 -1
- package/lib/commonjs/components/modules/ModuleIDP.js +2 -9
- package/lib/commonjs/components/modules/ModuleIDP.js.map +1 -1
- package/lib/commonjs/components/modules/ModulePaymentNotice.js +8 -6
- package/lib/commonjs/components/modules/ModulePaymentNotice.js.map +1 -1
- package/lib/commonjs/components/tag/Tag.js +4 -11
- package/lib/commonjs/components/tag/Tag.js.map +1 -1
- package/lib/commonjs/core/IODSExperimentalContextProvider.js +1 -2
- package/lib/commonjs/core/IODSExperimentalContextProvider.js.map +1 -1
- package/lib/commonjs/core/IOThemeContextProvider.js +1 -2
- package/lib/commonjs/core/IOThemeContextProvider.js.map +1 -1
- package/lib/commonjs/utils/accessibility.js +1 -14
- package/lib/commonjs/utils/accessibility.js.map +1 -1
- package/lib/commonjs/utils/image.js +23 -14
- package/lib/commonjs/utils/image.js.map +1 -1
- package/lib/commonjs/utils/object.js +10 -5
- package/lib/commonjs/utils/object.js.map +1 -1
- package/lib/module/components/common/LogoPaymentWithFallback.js +20 -11
- package/lib/module/components/common/LogoPaymentWithFallback.js.map +1 -1
- package/lib/module/components/listitems/ListItemRadioWithAmount.js +1 -3
- package/lib/module/components/listitems/ListItemRadioWithAmount.js.map +1 -1
- package/lib/module/components/listitems/ListItemTransaction.js +71 -90
- package/lib/module/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/module/components/listitems/PressableListItemsBase.js +4 -2
- package/lib/module/components/listitems/PressableListItemsBase.js.map +1 -1
- package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +18 -38
- package/lib/module/components/listitems/__test__/listitem.test.js +8 -4
- package/lib/module/components/listitems/__test__/listitem.test.js.map +1 -1
- package/lib/module/components/modules/ModuleIDP.js +3 -10
- package/lib/module/components/modules/ModuleIDP.js.map +1 -1
- package/lib/module/components/modules/ModulePaymentNotice.js +8 -6
- package/lib/module/components/modules/ModulePaymentNotice.js.map +1 -1
- package/lib/module/components/tag/Tag.js +4 -9
- package/lib/module/components/tag/Tag.js.map +1 -1
- package/lib/module/core/IODSExperimentalContextProvider.js +1 -2
- package/lib/module/core/IODSExperimentalContextProvider.js.map +1 -1
- package/lib/module/core/IOThemeContextProvider.js +1 -2
- package/lib/module/core/IOThemeContextProvider.js.map +1 -1
- package/lib/module/utils/accessibility.js +0 -9
- package/lib/module/utils/accessibility.js.map +1 -1
- package/lib/module/utils/image.js +23 -12
- package/lib/module/utils/image.js.map +1 -1
- package/lib/module/utils/object.js +10 -3
- package/lib/module/utils/object.js.map +1 -1
- package/lib/typescript/components/common/LogoPaymentWithFallback.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemRadioWithAmount.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemTransaction.d.ts +21 -13
- package/lib/typescript/components/listitems/ListItemTransaction.d.ts.map +1 -1
- package/lib/typescript/components/listitems/PressableListItemsBase.d.ts.map +1 -1
- package/lib/typescript/components/modules/ModuleIDP.d.ts.map +1 -1
- package/lib/typescript/components/modules/ModulePaymentNotice.d.ts +10 -4
- package/lib/typescript/components/modules/ModulePaymentNotice.d.ts.map +1 -1
- package/lib/typescript/components/tag/Tag.d.ts.map +1 -1
- package/lib/typescript/core/IODSExperimentalContextProvider.d.ts.map +1 -1
- package/lib/typescript/core/IOThemeContextProvider.d.ts.map +1 -1
- package/lib/typescript/utils/accessibility.d.ts +0 -5
- package/lib/typescript/utils/accessibility.d.ts.map +1 -1
- package/lib/typescript/utils/image.d.ts +2 -2
- package/lib/typescript/utils/image.d.ts.map +1 -1
- package/lib/typescript/utils/object.d.ts +1 -2
- package/lib/typescript/utils/object.d.ts.map +1 -1
- package/package.json +1 -4
- package/src/components/common/LogoPaymentWithFallback.tsx +15 -17
- package/src/components/listitems/ListItemRadioWithAmount.tsx +0 -1
- package/src/components/listitems/ListItemTransaction.tsx +88 -131
- package/src/components/listitems/PressableListItemsBase.tsx +6 -2
- package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +18 -38
- package/src/components/listitems/__test__/listitem.test.tsx +8 -4
- package/src/components/modules/ModuleIDP.tsx +4 -13
- package/src/components/modules/ModulePaymentNotice.tsx +14 -10
- package/src/components/tag/Tag.tsx +10 -19
- package/src/core/IODSExperimentalContextProvider.tsx +1 -2
- package/src/core/IOThemeContextProvider.tsx +1 -2
- package/src/utils/accessibility.ts +0 -17
- package/src/utils/image.ts +28 -28
- package/src/utils/object.ts +13 -12
- package/lib/commonjs/utils/dates.js +0 -20
- package/lib/commonjs/utils/dates.js.map +0 -1
- package/lib/module/utils/dates.js +0 -11
- package/lib/module/utils/dates.js.map +0 -1
- package/lib/typescript/utils/dates.d.ts +0 -9
- package/lib/typescript/utils/dates.d.ts.map +0 -1
- package/src/utils/dates.ts +0 -18
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { ImageURISource, StyleSheet, View } from "react-native";
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { ImageURISource, View } from "react-native";
|
|
5
3
|
import Placeholder from "rn-placeholder";
|
|
6
4
|
|
|
7
5
|
import {
|
|
@@ -14,8 +12,6 @@ import {
|
|
|
14
12
|
useIOExperimentalDesign,
|
|
15
13
|
useIOTheme
|
|
16
14
|
} from "../../core";
|
|
17
|
-
|
|
18
|
-
import { getAccessibleAmountText } from "../../utils/accessibility";
|
|
19
15
|
import { WithTestID } from "../../utils/types";
|
|
20
16
|
import { isImageUri } from "../../utils/url";
|
|
21
17
|
import { Avatar } from "../avatar/Avatar";
|
|
@@ -24,38 +20,26 @@ import { LogoPaymentWithFallback } from "../common/LogoPaymentWithFallback";
|
|
|
24
20
|
import { IOIconSizeScale, Icon } from "../icons";
|
|
25
21
|
import { IOLogoPaymentType } from "../logos";
|
|
26
22
|
import { VSpacer } from "../spacer";
|
|
23
|
+
import { HStack } from "../stack";
|
|
27
24
|
import { H6, LabelSmall } from "../typography";
|
|
28
25
|
import {
|
|
29
26
|
PressableBaseProps,
|
|
30
27
|
PressableListItemBase
|
|
31
28
|
} from "./PressableListItemsBase";
|
|
32
29
|
|
|
33
|
-
export type
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
| "cancelled"
|
|
38
|
-
| "refunded"
|
|
39
|
-
| "reversal";
|
|
40
|
-
|
|
41
|
-
export type ListItemTransactionStatusWithoutBadge = Extract<
|
|
42
|
-
ListItemTransactionStatus,
|
|
43
|
-
"success" | "refunded"
|
|
44
|
-
>;
|
|
45
|
-
|
|
46
|
-
export type ListItemTransactionStatusWithBadge = Exclude<
|
|
47
|
-
ListItemTransactionStatus,
|
|
48
|
-
"success" | "refunded"
|
|
49
|
-
>;
|
|
30
|
+
export type ListItemTransactionBadge = {
|
|
31
|
+
text: string;
|
|
32
|
+
variant: Badge["variant"];
|
|
33
|
+
};
|
|
50
34
|
|
|
51
35
|
export type ListItemTransactionLogo =
|
|
52
36
|
| IOLogoPaymentType
|
|
53
37
|
| ImageURISource
|
|
54
|
-
|
|
|
38
|
+
| ReactNode;
|
|
55
39
|
|
|
56
40
|
export type ListItemTransaction = WithTestID<
|
|
57
41
|
PressableBaseProps & {
|
|
58
|
-
|
|
42
|
+
showChevron?: boolean;
|
|
59
43
|
isLoading?: boolean;
|
|
60
44
|
/**
|
|
61
45
|
* A logo that will be displayed on the left of the list item.
|
|
@@ -73,29 +57,35 @@ export type ListItemTransaction = WithTestID<
|
|
|
73
57
|
accessible?: boolean;
|
|
74
58
|
} & (
|
|
75
59
|
| {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
60
|
+
transaction: {
|
|
61
|
+
amount: string;
|
|
62
|
+
amountAccessibilityLabel: string;
|
|
63
|
+
badge?: never;
|
|
64
|
+
refund?: boolean;
|
|
65
|
+
};
|
|
79
66
|
}
|
|
80
67
|
| {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
68
|
+
transaction: {
|
|
69
|
+
amount?: string;
|
|
70
|
+
amountAccessibilityLabel?: string;
|
|
71
|
+
badge: ListItemTransactionBadge;
|
|
72
|
+
refund?: never;
|
|
73
|
+
};
|
|
84
74
|
}
|
|
85
75
|
)
|
|
86
76
|
>;
|
|
87
77
|
|
|
88
|
-
type LeftComponentProps = {
|
|
89
|
-
logoIcon: ListItemTransactionLogo;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
78
|
const CARD_LOGO_SIZE: IOIconSizeScale = 24;
|
|
93
79
|
const MUNICIPALITY_LOGO_SIZE = 44;
|
|
94
80
|
// this is the <Avatar/>'s "small" size,
|
|
95
81
|
// since it is bigger than the card logos, we use
|
|
96
82
|
// it as a base size for homogeneous sizing via container size.
|
|
97
83
|
|
|
98
|
-
const
|
|
84
|
+
const StartComponent = ({
|
|
85
|
+
logoIcon
|
|
86
|
+
}: {
|
|
87
|
+
logoIcon: ListItemTransactionLogo;
|
|
88
|
+
}) => {
|
|
99
89
|
if (isImageUri(logoIcon)) {
|
|
100
90
|
return <Avatar logoUri={logoIcon} size="small" />;
|
|
101
91
|
}
|
|
@@ -112,28 +102,20 @@ const LeftComponent = ({ logoIcon }: LeftComponentProps) => {
|
|
|
112
102
|
|
|
113
103
|
export const ListItemTransaction = ({
|
|
114
104
|
accessibilityLabel,
|
|
115
|
-
|
|
105
|
+
showChevron = false,
|
|
116
106
|
isLoading = false,
|
|
117
107
|
paymentLogoIcon,
|
|
118
108
|
onPress,
|
|
119
109
|
subtitle,
|
|
120
110
|
testID,
|
|
121
111
|
title,
|
|
122
|
-
|
|
123
|
-
badgeText,
|
|
124
|
-
transactionStatus = "success",
|
|
112
|
+
transaction: { amount, amountAccessibilityLabel, badge, refund },
|
|
125
113
|
numberOfLines = 2,
|
|
126
114
|
accessible
|
|
127
115
|
}: ListItemTransaction) => {
|
|
128
116
|
const { isExperimental } = useIOExperimentalDesign();
|
|
129
117
|
const theme = useIOTheme();
|
|
130
118
|
|
|
131
|
-
const maybeBadgeText = pipe(
|
|
132
|
-
badgeText,
|
|
133
|
-
O.fromNullable,
|
|
134
|
-
O.getOrElse(() => "-")
|
|
135
|
-
);
|
|
136
|
-
|
|
137
119
|
if (isLoading) {
|
|
138
120
|
return <SkeletonComponent />;
|
|
139
121
|
}
|
|
@@ -142,56 +124,28 @@ export const ListItemTransaction = ({
|
|
|
142
124
|
? theme["interactiveElem-default"]
|
|
143
125
|
: "blue";
|
|
144
126
|
|
|
145
|
-
const
|
|
146
|
-
const
|
|
127
|
+
const amountColorDefault: IOColors = theme["textBody-default"];
|
|
128
|
+
const amountColorRefund: IOColors = theme.successText;
|
|
147
129
|
|
|
148
|
-
const
|
|
149
|
-
const TransactionAmountOrBadgeComponent = () => {
|
|
150
|
-
switch (transactionStatus) {
|
|
151
|
-
case "success":
|
|
152
|
-
return (
|
|
153
|
-
<H6
|
|
154
|
-
accessibilityLabel={getAccessibleAmountText(transactionAmount)}
|
|
155
|
-
color={hasChevronRight ? interactiveColor : amountColor}
|
|
156
|
-
numberOfLines={numberOfLines}
|
|
157
|
-
>
|
|
158
|
-
{transactionAmount || ""}
|
|
159
|
-
</H6>
|
|
160
|
-
);
|
|
161
|
-
case "refunded":
|
|
162
|
-
return (
|
|
163
|
-
<H6
|
|
164
|
-
accessibilityLabel={getAccessibleAmountText(transactionAmount)}
|
|
165
|
-
color={hasChevronRight ? interactiveColor : successColor}
|
|
166
|
-
numberOfLines={numberOfLines}
|
|
167
|
-
>
|
|
168
|
-
{transactionAmount || ""}
|
|
169
|
-
</H6>
|
|
170
|
-
);
|
|
171
|
-
case "failure":
|
|
172
|
-
case "cancelled":
|
|
173
|
-
return <Badge variant="error" text={maybeBadgeText} />;
|
|
174
|
-
case "reversal":
|
|
175
|
-
return <Badge variant="lightBlue" text={maybeBadgeText} />;
|
|
176
|
-
case "pending":
|
|
177
|
-
return <Badge variant="info" text={maybeBadgeText} />;
|
|
178
|
-
}
|
|
179
|
-
};
|
|
130
|
+
const amountColor = refund ? amountColorRefund : amountColorDefault;
|
|
180
131
|
|
|
181
|
-
|
|
182
|
-
|
|
132
|
+
const ListItemTransactionContent = () => (
|
|
133
|
+
<>
|
|
134
|
+
<HStack
|
|
135
|
+
space={IOListItemLogoMargin}
|
|
136
|
+
style={{ alignItems: "center", flexShrink: 1 }}
|
|
137
|
+
>
|
|
183
138
|
{paymentLogoIcon && (
|
|
184
139
|
<View
|
|
185
140
|
style={{
|
|
186
|
-
marginRight: IOListItemLogoMargin,
|
|
187
141
|
width: MUNICIPALITY_LOGO_SIZE,
|
|
188
142
|
alignItems: "center"
|
|
189
143
|
}}
|
|
190
144
|
>
|
|
191
|
-
<
|
|
145
|
+
<StartComponent logoIcon={paymentLogoIcon} />
|
|
192
146
|
</View>
|
|
193
147
|
)}
|
|
194
|
-
<View style={
|
|
148
|
+
<View style={{ flexShrink: 1 }}>
|
|
195
149
|
<LabelSmall
|
|
196
150
|
numberOfLines={numberOfLines}
|
|
197
151
|
color={theme["textBody-default"]}
|
|
@@ -203,47 +157,59 @@ export const ListItemTransaction = ({
|
|
|
203
157
|
{subtitle}
|
|
204
158
|
</LabelSmall>
|
|
205
159
|
</View>
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
160
|
+
</HStack>
|
|
161
|
+
<HStack style={{ alignItems: "center" }}>
|
|
162
|
+
{badge ? (
|
|
163
|
+
<Badge variant={badge?.variant} text={badge?.text} />
|
|
164
|
+
) : (
|
|
165
|
+
<H6
|
|
166
|
+
accessibilityLabel={amountAccessibilityLabel}
|
|
167
|
+
color={showChevron ? interactiveColor : amountColor}
|
|
168
|
+
numberOfLines={numberOfLines}
|
|
169
|
+
>
|
|
170
|
+
{amount}
|
|
171
|
+
</H6>
|
|
172
|
+
)}
|
|
173
|
+
{showChevron && (
|
|
174
|
+
<Icon
|
|
175
|
+
name="chevronRightListItem"
|
|
176
|
+
color={interactiveColor}
|
|
177
|
+
size={IOListItemVisualParams.chevronSize}
|
|
178
|
+
/>
|
|
179
|
+
)}
|
|
180
|
+
</HStack>
|
|
181
|
+
</>
|
|
182
|
+
);
|
|
219
183
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
184
|
+
if (onPress) {
|
|
185
|
+
return (
|
|
186
|
+
<PressableListItemBase
|
|
187
|
+
onPress={onPress}
|
|
188
|
+
testID={testID}
|
|
189
|
+
accessibilityLabel={accessibilityLabel}
|
|
190
|
+
>
|
|
191
|
+
<ListItemTransactionContent />
|
|
192
|
+
</PressableListItemBase>
|
|
193
|
+
);
|
|
194
|
+
} else {
|
|
195
|
+
return (
|
|
196
|
+
<View
|
|
197
|
+
style={IOListItemStyles.listItem}
|
|
198
|
+
testID={testID}
|
|
199
|
+
accessible={accessible}
|
|
200
|
+
accessibilityLabel={accessibilityLabel}
|
|
201
|
+
>
|
|
225
202
|
<View
|
|
226
|
-
style={
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
>
|
|
231
|
-
<View style={IOListItemStyles.listItemInner}>
|
|
232
|
-
<ListItemTransactionContent />
|
|
233
|
-
</View>
|
|
234
|
-
</View>
|
|
235
|
-
),
|
|
236
|
-
onPress => (
|
|
237
|
-
<PressableListItemBase
|
|
238
|
-
onPress={onPress}
|
|
239
|
-
testID={testID}
|
|
240
|
-
accessibilityLabel={accessibilityLabel}
|
|
203
|
+
style={[
|
|
204
|
+
IOListItemStyles.listItemInner,
|
|
205
|
+
{ columnGap: IOListItemVisualParams.iconMargin }
|
|
206
|
+
]}
|
|
241
207
|
>
|
|
242
208
|
<ListItemTransactionContent />
|
|
243
|
-
</
|
|
244
|
-
|
|
245
|
-
)
|
|
246
|
-
|
|
209
|
+
</View>
|
|
210
|
+
</View>
|
|
211
|
+
);
|
|
212
|
+
}
|
|
247
213
|
};
|
|
248
214
|
|
|
249
215
|
const SkeletonComponent = () => (
|
|
@@ -268,12 +234,3 @@ const SkeletonComponent = () => (
|
|
|
268
234
|
</View>
|
|
269
235
|
</View>
|
|
270
236
|
);
|
|
271
|
-
|
|
272
|
-
const Styles = StyleSheet.create({
|
|
273
|
-
rightSection: {
|
|
274
|
-
marginLeft: IOListItemVisualParams.iconMargin,
|
|
275
|
-
flexDirection: "row",
|
|
276
|
-
alignItems: "center",
|
|
277
|
-
height: "100%"
|
|
278
|
-
}
|
|
279
|
-
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Pressable } from "react-native";
|
|
3
3
|
import Animated from "react-native-reanimated";
|
|
4
|
-
import { IOListItemStyles } from "../../core";
|
|
4
|
+
import { IOListItemStyles, IOListItemVisualParams } from "../../core";
|
|
5
5
|
import { WithTestID } from "../../utils/types";
|
|
6
6
|
import { useListItemSpringAnimation } from "./hooks/useListItemSpringAnimation";
|
|
7
7
|
|
|
@@ -40,7 +40,11 @@ export const PressableListItemBase = ({
|
|
|
40
40
|
style={[IOListItemStyles.listItem, animatedBackgroundStyle]}
|
|
41
41
|
>
|
|
42
42
|
<Animated.View
|
|
43
|
-
style={[
|
|
43
|
+
style={[
|
|
44
|
+
IOListItemStyles.listItemInner,
|
|
45
|
+
{ columnGap: IOListItemVisualParams.iconMargin },
|
|
46
|
+
animatedScaleStyle
|
|
47
|
+
]}
|
|
44
48
|
>
|
|
45
49
|
{children}
|
|
46
50
|
</Animated.View>
|
|
@@ -187,11 +187,6 @@ exports[`Test List Item Components - Experimental Enabled ListItemIDP Snapshot
|
|
|
187
187
|
/>
|
|
188
188
|
<Image
|
|
189
189
|
accessibilityIgnoresInvertColors={true}
|
|
190
|
-
source={
|
|
191
|
-
{
|
|
192
|
-
"uri": "undefined",
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
190
|
style={
|
|
196
191
|
{
|
|
197
192
|
"height": 30,
|
|
@@ -925,6 +920,9 @@ exports[`Test List Item Components - Experimental Enabled ListItemRadioWithAmou
|
|
|
925
920
|
"flexDirection": "row",
|
|
926
921
|
"justifyContent": "space-between",
|
|
927
922
|
},
|
|
923
|
+
{
|
|
924
|
+
"columnGap": 12,
|
|
925
|
+
},
|
|
928
926
|
{
|
|
929
927
|
"transform": [
|
|
930
928
|
{
|
|
@@ -1074,13 +1072,6 @@ exports[`Test List Item Components - Experimental Enabled ListItemRadioWithAmou
|
|
|
1074
1072
|
}
|
|
1075
1073
|
}
|
|
1076
1074
|
>
|
|
1077
|
-
<View
|
|
1078
|
-
style={
|
|
1079
|
-
{
|
|
1080
|
-
"width": 8,
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
/>
|
|
1084
1075
|
<Text
|
|
1085
1076
|
allowFontScaling={true}
|
|
1086
1077
|
dynamicTypeRamp="headline"
|
|
@@ -1313,6 +1304,9 @@ exports[`Test List Item Components - Experimental Enabled ListItemRadioWithAmou
|
|
|
1313
1304
|
"flexDirection": "row",
|
|
1314
1305
|
"justifyContent": "space-between",
|
|
1315
1306
|
},
|
|
1307
|
+
{
|
|
1308
|
+
"columnGap": 12,
|
|
1309
|
+
},
|
|
1316
1310
|
{
|
|
1317
1311
|
"transform": [
|
|
1318
1312
|
{
|
|
@@ -1362,13 +1356,6 @@ exports[`Test List Item Components - Experimental Enabled ListItemRadioWithAmou
|
|
|
1362
1356
|
}
|
|
1363
1357
|
}
|
|
1364
1358
|
>
|
|
1365
|
-
<View
|
|
1366
|
-
style={
|
|
1367
|
-
{
|
|
1368
|
-
"width": 8,
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
/>
|
|
1372
1359
|
<Text
|
|
1373
1360
|
allowFontScaling={true}
|
|
1374
1361
|
dynamicTypeRamp="headline"
|
|
@@ -1683,6 +1670,9 @@ exports[`Test List Item Components - Experimental Enabled PressableListItemsBas
|
|
|
1683
1670
|
"flexDirection": "row",
|
|
1684
1671
|
"justifyContent": "space-between",
|
|
1685
1672
|
},
|
|
1673
|
+
{
|
|
1674
|
+
"columnGap": 12,
|
|
1675
|
+
},
|
|
1686
1676
|
{
|
|
1687
1677
|
"transform": [
|
|
1688
1678
|
{
|
|
@@ -1884,11 +1874,6 @@ exports[`Test List Item Components ListItemIDP Snapshot 1`] = `
|
|
|
1884
1874
|
/>
|
|
1885
1875
|
<Image
|
|
1886
1876
|
accessibilityIgnoresInvertColors={true}
|
|
1887
|
-
source={
|
|
1888
|
-
{
|
|
1889
|
-
"uri": "undefined",
|
|
1890
|
-
}
|
|
1891
|
-
}
|
|
1892
1877
|
style={
|
|
1893
1878
|
{
|
|
1894
1879
|
"height": 30,
|
|
@@ -2622,6 +2607,9 @@ exports[`Test List Item Components ListItemRadioWithAmount Snapshot 1`] = `
|
|
|
2622
2607
|
"flexDirection": "row",
|
|
2623
2608
|
"justifyContent": "space-between",
|
|
2624
2609
|
},
|
|
2610
|
+
{
|
|
2611
|
+
"columnGap": 12,
|
|
2612
|
+
},
|
|
2625
2613
|
{
|
|
2626
2614
|
"transform": [
|
|
2627
2615
|
{
|
|
@@ -2771,13 +2759,6 @@ exports[`Test List Item Components ListItemRadioWithAmount Snapshot 1`] = `
|
|
|
2771
2759
|
}
|
|
2772
2760
|
}
|
|
2773
2761
|
>
|
|
2774
|
-
<View
|
|
2775
|
-
style={
|
|
2776
|
-
{
|
|
2777
|
-
"width": 8,
|
|
2778
|
-
}
|
|
2779
|
-
}
|
|
2780
|
-
/>
|
|
2781
2762
|
<Text
|
|
2782
2763
|
allowFontScaling={false}
|
|
2783
2764
|
dynamicTypeRamp="headline"
|
|
@@ -3010,6 +2991,9 @@ exports[`Test List Item Components ListItemRadioWithAmount Snapshot 2`] = `
|
|
|
3010
2991
|
"flexDirection": "row",
|
|
3011
2992
|
"justifyContent": "space-between",
|
|
3012
2993
|
},
|
|
2994
|
+
{
|
|
2995
|
+
"columnGap": 12,
|
|
2996
|
+
},
|
|
3013
2997
|
{
|
|
3014
2998
|
"transform": [
|
|
3015
2999
|
{
|
|
@@ -3059,13 +3043,6 @@ exports[`Test List Item Components ListItemRadioWithAmount Snapshot 2`] = `
|
|
|
3059
3043
|
}
|
|
3060
3044
|
}
|
|
3061
3045
|
>
|
|
3062
|
-
<View
|
|
3063
|
-
style={
|
|
3064
|
-
{
|
|
3065
|
-
"width": 8,
|
|
3066
|
-
}
|
|
3067
|
-
}
|
|
3068
|
-
/>
|
|
3069
3046
|
<Text
|
|
3070
3047
|
allowFontScaling={false}
|
|
3071
3048
|
dynamicTypeRamp="headline"
|
|
@@ -3380,6 +3357,9 @@ exports[`Test List Item Components PressableListItemsBase Snapshot 1`] = `
|
|
|
3380
3357
|
"flexDirection": "row",
|
|
3381
3358
|
"justifyContent": "space-between",
|
|
3382
3359
|
},
|
|
3360
|
+
{
|
|
3361
|
+
"columnGap": 12,
|
|
3362
|
+
},
|
|
3383
3363
|
{
|
|
3384
3364
|
"transform": [
|
|
3385
3365
|
{
|
|
@@ -80,8 +80,10 @@ describe("Test List Item Components", () => {
|
|
|
80
80
|
<ListItemTransaction
|
|
81
81
|
title="TITLE"
|
|
82
82
|
subtitle="subtitle"
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
transaction={{
|
|
84
|
+
amount: "€ 1.000,00",
|
|
85
|
+
amountAccessibilityLabel: "€ 1.000,00"
|
|
86
|
+
}}
|
|
85
87
|
isLoading={true}
|
|
86
88
|
onPress={onButtonPress}
|
|
87
89
|
/>
|
|
@@ -180,8 +182,10 @@ describe("Test List Item Components - Experimental Enabled ", () => {
|
|
|
180
182
|
<ListItemTransaction
|
|
181
183
|
title="TITLE"
|
|
182
184
|
subtitle="subtitle"
|
|
183
|
-
|
|
184
|
-
|
|
185
|
+
transaction={{
|
|
186
|
+
amount: "€ 1.000,00",
|
|
187
|
+
amountAccessibilityLabel: "€ 1.000,00"
|
|
188
|
+
}}
|
|
185
189
|
isLoading={true}
|
|
186
190
|
onPress={onButtonPress}
|
|
187
191
|
/>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { Image, ImageSourcePropType,
|
|
2
|
+
import { Image, ImageSourcePropType, StyleSheet } from "react-native";
|
|
3
|
+
import { addCacheTimestampToUri } from "../../utils/image";
|
|
3
4
|
import {
|
|
4
5
|
IOListItemLogoMargin,
|
|
5
6
|
useIOExperimentalDesign,
|
|
6
7
|
useIOTheme
|
|
7
8
|
} from "../../core";
|
|
8
|
-
import { toAndroidCacheTimestamp } from "../../utils/dates";
|
|
9
9
|
import { IOText } from "../typography";
|
|
10
10
|
import {
|
|
11
11
|
PressableModuleBase,
|
|
@@ -28,12 +28,6 @@ const styles = StyleSheet.create({
|
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
// https://github.com/facebook/react-native/issues/12606
|
|
32
|
-
// Image cache forced refresh for Android by appending
|
|
33
|
-
// the `ts` query parameter as DDMMYYYY to simulate a 24h TTL.
|
|
34
|
-
const androidIdpLogoForcedRefreshed = () =>
|
|
35
|
-
Platform.OS === "android" ? `?ts=${toAndroidCacheTimestamp()}` : "";
|
|
36
|
-
|
|
37
31
|
export const ModuleIDP = ({
|
|
38
32
|
name,
|
|
39
33
|
localLogo,
|
|
@@ -47,11 +41,8 @@ export const ModuleIDP = ({
|
|
|
47
41
|
const { isExperimental } = useIOExperimentalDesign();
|
|
48
42
|
|
|
49
43
|
// eslint-disable-next-line no-console
|
|
50
|
-
const urlLogoIDP = localLogo
|
|
51
|
-
|
|
52
|
-
: {
|
|
53
|
-
uri: `${logo}${androidIdpLogoForcedRefreshed()}`
|
|
54
|
-
};
|
|
44
|
+
const urlLogoIDP = localLogo ? localLogo : addCacheTimestampToUri(logo);
|
|
45
|
+
|
|
55
46
|
return (
|
|
56
47
|
<PressableModuleBase
|
|
57
48
|
onPress={onPress}
|
|
@@ -2,7 +2,6 @@ import * as React from "react";
|
|
|
2
2
|
import { GestureResponderEvent, StyleSheet, View } from "react-native";
|
|
3
3
|
import Placeholder from "rn-placeholder";
|
|
4
4
|
import { IOListItemVisualParams, IOSpacer, useIOTheme } from "../../core";
|
|
5
|
-
import { getAccessibleAmountText } from "../../utils/accessibility";
|
|
6
5
|
import { WithTestID } from "../../utils/types";
|
|
7
6
|
import { Badge } from "../badge";
|
|
8
7
|
import { Icon } from "../icons";
|
|
@@ -29,13 +28,19 @@ export type ModulePaymentNoticeProps = WithTestID<
|
|
|
29
28
|
onPress: (event: GestureResponderEvent) => void;
|
|
30
29
|
} & (
|
|
31
30
|
| {
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
paymentNotice: {
|
|
32
|
+
status: Extract<PaymentNoticeStatus, "default">;
|
|
33
|
+
amount: string;
|
|
34
|
+
amountAccessibilityLabel: string;
|
|
35
|
+
};
|
|
34
36
|
badgeText?: never;
|
|
35
37
|
}
|
|
36
38
|
| {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
paymentNotice: {
|
|
40
|
+
status: Exclude<PaymentNoticeStatus, "default">;
|
|
41
|
+
amount?: string;
|
|
42
|
+
amountAccessibilityLabel?: string;
|
|
43
|
+
};
|
|
39
44
|
badgeText: string;
|
|
40
45
|
}
|
|
41
46
|
)
|
|
@@ -52,22 +57,21 @@ const styles = StyleSheet.create({
|
|
|
52
57
|
const ModulePaymentNoticeContent = ({
|
|
53
58
|
title,
|
|
54
59
|
subtitle,
|
|
55
|
-
|
|
56
|
-
paymentNoticeAmount,
|
|
60
|
+
paymentNotice: { status, amount, amountAccessibilityLabel },
|
|
57
61
|
badgeText = ""
|
|
58
62
|
}: Omit<ModulePaymentNoticeProps, "isLoading" | "onPress" | "testID">) => {
|
|
59
63
|
const theme = useIOTheme();
|
|
60
64
|
|
|
61
65
|
const AmountOrBadgeComponent = () => {
|
|
62
|
-
switch (
|
|
66
|
+
switch (status) {
|
|
63
67
|
case "default":
|
|
64
68
|
return (
|
|
65
69
|
<H6
|
|
66
|
-
accessibilityLabel={
|
|
70
|
+
accessibilityLabel={amountAccessibilityLabel}
|
|
67
71
|
color={theme["interactiveElem-default"]}
|
|
68
72
|
numberOfLines={1}
|
|
69
73
|
>
|
|
70
|
-
{
|
|
74
|
+
{amount}
|
|
71
75
|
</H6>
|
|
72
76
|
);
|
|
73
77
|
case "paid":
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as O from "fp-ts/lib/Option";
|
|
2
|
-
import { pipe } from "fp-ts/lib/function";
|
|
3
1
|
import React from "react";
|
|
4
2
|
import { Platform, StyleSheet, View } from "react-native";
|
|
5
3
|
import {
|
|
@@ -148,23 +146,16 @@ export const Tag = ({
|
|
|
148
146
|
|
|
149
147
|
return (
|
|
150
148
|
<View testID={testID} style={styles.tag}>
|
|
151
|
-
{
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
size={IOTagIconSize}
|
|
162
|
-
accessible={!!iconAccessibilityLabel}
|
|
163
|
-
accessibilityLabel={iconAccessibilityLabel}
|
|
164
|
-
/>
|
|
165
|
-
</View>
|
|
166
|
-
)
|
|
167
|
-
)
|
|
149
|
+
{variantProps && (
|
|
150
|
+
<View style={styles.iconWrapper}>
|
|
151
|
+
<Icon
|
|
152
|
+
name={variantProps.iconName}
|
|
153
|
+
color={variantProps.iconColor}
|
|
154
|
+
size={IOTagIconSize}
|
|
155
|
+
accessible={!!iconAccessibilityLabel}
|
|
156
|
+
accessibilityLabel={iconAccessibilityLabel}
|
|
157
|
+
/>
|
|
158
|
+
</View>
|
|
168
159
|
)}
|
|
169
160
|
{variantProps && text && <View style={styles.spacer} />}
|
|
170
161
|
{text && (
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { constVoid } from "fp-ts/function";
|
|
2
1
|
import React from "react";
|
|
3
2
|
|
|
4
3
|
type IOExperimentalContextType = {
|
|
@@ -11,7 +10,7 @@ type IOExperimentalContextType = {
|
|
|
11
10
|
export const IOExperimentalDesignContext =
|
|
12
11
|
React.createContext<IOExperimentalContextType>({
|
|
13
12
|
isExperimental: false,
|
|
14
|
-
setExperimental:
|
|
13
|
+
setExperimental: () => void 0
|
|
15
14
|
});
|
|
16
15
|
|
|
17
16
|
export const useIOExperimentalDesign = () =>
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { constVoid } from "fp-ts/function";
|
|
2
1
|
import React, { useMemo } from "react";
|
|
3
2
|
import { Appearance } from "react-native";
|
|
4
3
|
import {
|
|
@@ -24,7 +23,7 @@ export const IOThemeContext: React.Context<IOThemeContextType> =
|
|
|
24
23
|
themeType: Appearance.getColorScheme() === "dark" ? "dark" : "light",
|
|
25
24
|
theme:
|
|
26
25
|
Appearance.getColorScheme() === "dark" ? IOThemes.dark : IOThemes.light,
|
|
27
|
-
setTheme:
|
|
26
|
+
setTheme: () => void 0
|
|
28
27
|
});
|
|
29
28
|
|
|
30
29
|
export const useIOThemeContext = () => React.useContext(IOThemeContext);
|