@pagopa/io-app-design-system 1.43.0 → 1.45.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.
Files changed (110) hide show
  1. package/lib/commonjs/components/badge/Badge.js +4 -0
  2. package/lib/commonjs/components/badge/Badge.js.map +1 -1
  3. package/lib/commonjs/components/badge/__test__/__snapshots__/badge.test.tsx.snap +8 -0
  4. package/lib/commonjs/components/codeInput/CodeInput.js +6 -8
  5. package/lib/commonjs/components/codeInput/CodeInput.js.map +1 -1
  6. package/lib/commonjs/components/layout/HeaderSecondLevel.js +10 -6
  7. package/lib/commonjs/components/layout/HeaderSecondLevel.js.map +1 -1
  8. package/lib/commonjs/components/listitems/ListItemInfo.js +5 -7
  9. package/lib/commonjs/components/listitems/ListItemInfo.js.map +1 -1
  10. package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +0 -4
  11. package/lib/commonjs/components/modules/ModuleAttachment.js +17 -17
  12. package/lib/commonjs/components/modules/ModuleAttachment.js.map +1 -1
  13. package/lib/commonjs/components/modules/ModuleCheckout.js +35 -28
  14. package/lib/commonjs/components/modules/ModuleCheckout.js.map +1 -1
  15. package/lib/commonjs/components/modules/ModuleCredential.js +28 -22
  16. package/lib/commonjs/components/modules/ModuleCredential.js.map +1 -1
  17. package/lib/commonjs/components/modules/ModuleNavigation.js +30 -23
  18. package/lib/commonjs/components/modules/ModuleNavigation.js.map +1 -1
  19. package/lib/commonjs/components/modules/ModulePaymentNotice.js +17 -20
  20. package/lib/commonjs/components/modules/ModulePaymentNotice.js.map +1 -1
  21. package/lib/commonjs/components/modules/ModuleStatic.js +9 -2
  22. package/lib/commonjs/components/modules/ModuleStatic.js.map +1 -1
  23. package/lib/commonjs/components/numberpad/NumberPad.js +7 -8
  24. package/lib/commonjs/components/numberpad/NumberPad.js.map +1 -1
  25. package/lib/commonjs/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +976 -987
  26. package/lib/commonjs/components/stack/Stack.js +4 -4
  27. package/lib/commonjs/components/stack/Stack.js.map +1 -1
  28. package/lib/commonjs/components/textInput/TextInputBase.js +2 -1
  29. package/lib/commonjs/components/textInput/TextInputBase.js.map +1 -1
  30. package/lib/commonjs/components/textInput/TextInputValidation.js +20 -8
  31. package/lib/commonjs/components/textInput/TextInputValidation.js.map +1 -1
  32. package/lib/commonjs/components/toast/ToastProvider.js +7 -7
  33. package/lib/commonjs/components/toast/ToastProvider.js.map +1 -1
  34. package/lib/commonjs/core/IOAnimations.js +5 -0
  35. package/lib/commonjs/core/IOAnimations.js.map +1 -1
  36. package/lib/module/components/badge/Badge.js +4 -0
  37. package/lib/module/components/badge/Badge.js.map +1 -1
  38. package/lib/module/components/badge/__test__/__snapshots__/badge.test.tsx.snap +8 -0
  39. package/lib/module/components/codeInput/CodeInput.js +6 -8
  40. package/lib/module/components/codeInput/CodeInput.js.map +1 -1
  41. package/lib/module/components/layout/HeaderSecondLevel.js +13 -8
  42. package/lib/module/components/layout/HeaderSecondLevel.js.map +1 -1
  43. package/lib/module/components/listitems/ListItemInfo.js +6 -8
  44. package/lib/module/components/listitems/ListItemInfo.js.map +1 -1
  45. package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +0 -4
  46. package/lib/module/components/modules/ModuleAttachment.js +17 -17
  47. package/lib/module/components/modules/ModuleAttachment.js.map +1 -1
  48. package/lib/module/components/modules/ModuleCheckout.js +35 -28
  49. package/lib/module/components/modules/ModuleCheckout.js.map +1 -1
  50. package/lib/module/components/modules/ModuleCredential.js +28 -22
  51. package/lib/module/components/modules/ModuleCredential.js.map +1 -1
  52. package/lib/module/components/modules/ModuleNavigation.js +30 -23
  53. package/lib/module/components/modules/ModuleNavigation.js.map +1 -1
  54. package/lib/module/components/modules/ModulePaymentNotice.js +18 -21
  55. package/lib/module/components/modules/ModulePaymentNotice.js.map +1 -1
  56. package/lib/module/components/modules/ModuleStatic.js +9 -2
  57. package/lib/module/components/modules/ModuleStatic.js.map +1 -1
  58. package/lib/module/components/numberpad/NumberPad.js +8 -9
  59. package/lib/module/components/numberpad/NumberPad.js.map +1 -1
  60. package/lib/module/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +976 -987
  61. package/lib/module/components/stack/Stack.js +4 -4
  62. package/lib/module/components/stack/Stack.js.map +1 -1
  63. package/lib/module/components/textInput/TextInputBase.js +2 -1
  64. package/lib/module/components/textInput/TextInputBase.js.map +1 -1
  65. package/lib/module/components/textInput/TextInputValidation.js +20 -8
  66. package/lib/module/components/textInput/TextInputValidation.js.map +1 -1
  67. package/lib/module/components/toast/ToastProvider.js +7 -7
  68. package/lib/module/components/toast/ToastProvider.js.map +1 -1
  69. package/lib/module/core/IOAnimations.js +5 -0
  70. package/lib/module/core/IOAnimations.js.map +1 -1
  71. package/lib/typescript/components/badge/Badge.d.ts.map +1 -1
  72. package/lib/typescript/components/codeInput/CodeInput.d.ts.map +1 -1
  73. package/lib/typescript/components/layout/HeaderSecondLevel.d.ts +11 -4
  74. package/lib/typescript/components/layout/HeaderSecondLevel.d.ts.map +1 -1
  75. package/lib/typescript/components/listitems/ListItemInfo.d.ts.map +1 -1
  76. package/lib/typescript/components/modules/ModuleAttachment.d.ts.map +1 -1
  77. package/lib/typescript/components/modules/ModuleCredential.d.ts.map +1 -1
  78. package/lib/typescript/components/modules/ModuleNavigation.d.ts.map +1 -1
  79. package/lib/typescript/components/modules/ModulePaymentNotice.d.ts.map +1 -1
  80. package/lib/typescript/components/modules/ModuleStatic.d.ts.map +1 -1
  81. package/lib/typescript/components/numberpad/NumberPad.d.ts.map +1 -1
  82. package/lib/typescript/components/stack/Stack.d.ts +4 -3
  83. package/lib/typescript/components/stack/Stack.d.ts.map +1 -1
  84. package/lib/typescript/components/textInput/TextInputBase.d.ts +2 -1
  85. package/lib/typescript/components/textInput/TextInputBase.d.ts.map +1 -1
  86. package/lib/typescript/components/textInput/TextInputValidation.d.ts +13 -1
  87. package/lib/typescript/components/textInput/TextInputValidation.d.ts.map +1 -1
  88. package/lib/typescript/components/toast/ToastProvider.d.ts.map +1 -1
  89. package/lib/typescript/core/IOAnimations.d.ts +5 -0
  90. package/lib/typescript/core/IOAnimations.d.ts.map +1 -1
  91. package/package.json +1 -1
  92. package/src/components/badge/Badge.tsx +4 -0
  93. package/src/components/badge/__test__/__snapshots__/badge.test.tsx.snap +8 -0
  94. package/src/components/codeInput/CodeInput.tsx +8 -16
  95. package/src/components/layout/HeaderSecondLevel.tsx +51 -8
  96. package/src/components/listitems/ListItemInfo.tsx +8 -16
  97. package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +0 -4
  98. package/src/components/modules/ModuleAttachment.tsx +14 -15
  99. package/src/components/modules/ModuleCheckout.tsx +34 -46
  100. package/src/components/modules/ModuleCredential.tsx +36 -32
  101. package/src/components/modules/ModuleNavigation.tsx +45 -32
  102. package/src/components/modules/ModulePaymentNotice.tsx +14 -24
  103. package/src/components/modules/ModuleStatic.tsx +6 -3
  104. package/src/components/numberpad/NumberPad.tsx +20 -18
  105. package/src/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +976 -987
  106. package/src/components/stack/Stack.tsx +10 -5
  107. package/src/components/textInput/TextInputBase.tsx +3 -1
  108. package/src/components/textInput/TextInputValidation.tsx +37 -11
  109. package/src/components/toast/ToastProvider.tsx +8 -7
  110. package/src/core/IOAnimations.ts +5 -0
@@ -3,8 +3,8 @@ import { StyleSheet, View } from "react-native";
3
3
  import Animated from "react-native-reanimated";
4
4
  import { IOColors, IOStyles } from "../../core";
5
5
  import { triggerHaptic } from "../../functions";
6
- import { HSpacer } from "../spacer";
7
6
  import { useErrorShakeAnimation } from "../../utils/hooks/useErrorShakeAnimation";
7
+ import { HStack } from "../stack";
8
8
 
9
9
  type CodeInputProps = {
10
10
  value: string;
@@ -86,21 +86,13 @@ export const CodeInput = ({
86
86
 
87
87
  return (
88
88
  <Animated.View style={[IOStyles.row, styles.wrapper, animatedStyle]}>
89
- {[...Array(length)].map((_, i, arr) => (
90
- <React.Fragment key={i}>
91
- {value[i] ? (
92
- <>
93
- <FilletDot color={fillColor} />
94
- {i !== arr.length - 1 && <HSpacer size={DOT_SIZE} />}
95
- </>
96
- ) : (
97
- <>
98
- <EmptyDot />
99
- {i !== arr.length - 1 && <HSpacer size={DOT_SIZE} />}
100
- </>
101
- )}
102
- </React.Fragment>
103
- ))}
89
+ <HStack space={DOT_SIZE}>
90
+ {[...Array(length)].map((_, i) => (
91
+ <React.Fragment key={i}>
92
+ {value[i] ? <FilletDot color={fillColor} /> : <EmptyDot />}
93
+ </React.Fragment>
94
+ ))}
95
+ </HStack>
104
96
  </Animated.View>
105
97
  );
106
98
  };
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { ComponentProps } from "react";
2
+ import { ComponentProps, useEffect, useLayoutEffect } from "react";
3
3
  import {
4
4
  AccessibilityInfo,
5
5
  ColorValue,
@@ -9,15 +9,21 @@ import {
9
9
  findNodeHandle
10
10
  } from "react-native";
11
11
  import Animated, {
12
+ AnimatedRef,
13
+ SharedValue,
12
14
  interpolate,
13
15
  interpolateColor,
14
16
  useAnimatedStyle,
17
+ useDerivedValue,
18
+ useScrollViewOffset,
15
19
  useSharedValue,
20
+ withSpring,
16
21
  withTiming
17
22
  } from "react-native-reanimated";
18
23
  import { useSafeAreaInsets } from "react-native-safe-area-context";
19
24
  import {
20
25
  IOColors,
26
+ IOSpringValues,
21
27
  IOStyles,
22
28
  IOVisualCostants,
23
29
  alertEdgeToEdgeInsetTransitionConfig,
@@ -34,10 +40,20 @@ import { HSpacer } from "../spacer";
34
40
  import { ActionProp } from "./common";
35
41
 
36
42
  type ScrollValues = {
37
- contentOffsetY: Animated.SharedValue<number>;
43
+ contentOffsetY: SharedValue<number>;
38
44
  triggerOffset: number;
39
45
  };
40
46
 
47
+ type DiscreteTransitionProps =
48
+ | {
49
+ enableDiscreteTransition: true;
50
+ animatedRef: AnimatedRef<Animated.ScrollView>;
51
+ }
52
+ | {
53
+ enableDiscreteTransition?: false;
54
+ animatedRef?: never;
55
+ };
56
+
41
57
  type BackProps =
42
58
  | {
43
59
  goBack: () => void;
@@ -89,6 +105,7 @@ interface ThreeActions extends CommonProps {
89
105
  }
90
106
 
91
107
  export type HeaderSecondLevel = BackProps &
108
+ DiscreteTransitionProps &
92
109
  (Base | OneAction | TwoActions | ThreeActions);
93
110
 
94
111
  const titleHorizontalMargin: IOSpacingScale = 16;
@@ -135,11 +152,16 @@ export const HeaderSecondLevel = ({
135
152
  backgroundColor,
136
153
  transparent = false,
137
154
  ignoreSafeAreaMargin = false,
155
+ enableDiscreteTransition = false,
156
+ animatedRef,
138
157
  testID,
139
158
  firstAction,
140
159
  secondAction,
141
160
  thirdAction
142
161
  }: HeaderSecondLevel) => {
162
+ const scrollOffset = useScrollViewOffset(
163
+ animatedRef as AnimatedRef<Animated.ScrollView>
164
+ );
143
165
  const titleRef = React.createRef<View>();
144
166
 
145
167
  const { isExperimental } = useIOExperimentalDesign();
@@ -160,7 +182,10 @@ export const HeaderSecondLevel = ({
160
182
 
161
183
  const headerBgColorTransparentState = backgroundColor
162
184
  ? hexToRgba(backgroundColor, 0)
163
- : hexToRgba(IOColors[HEADER_DEFAULT_BG_COLOR], 0);
185
+ : transparent
186
+ ? hexToRgba(IOColors[HEADER_DEFAULT_BG_COLOR], 0)
187
+ : IOColors[HEADER_DEFAULT_BG_COLOR];
188
+
164
189
  const headerBgColorSolidState =
165
190
  backgroundColor ?? IOColors[HEADER_DEFAULT_BG_COLOR];
166
191
 
@@ -169,7 +194,7 @@ export const HeaderSecondLevel = ({
169
194
  : hexToRgba(IOColors["grey-100"], 0);
170
195
  const borderColorSolidState = backgroundColor ?? IOColors["grey-100"];
171
196
 
172
- React.useLayoutEffect(() => {
197
+ useLayoutEffect(() => {
173
198
  if (isTitleAccessible) {
174
199
  const reactNode = findNodeHandle(titleRef.current);
175
200
  if (reactNode !== null) {
@@ -178,7 +203,11 @@ export const HeaderSecondLevel = ({
178
203
  }
179
204
  });
180
205
 
181
- React.useEffect(() => {
206
+ const bgColorDiscreteTransition = useDerivedValue(() =>
207
+ withSpring(scrollOffset.value > 0 ? 1 : 0, IOSpringValues.header)
208
+ );
209
+
210
+ useEffect(() => {
182
211
  // eslint-disable-next-line functional/immutable-data
183
212
  paddingTop.value = withTiming(
184
213
  ignoreSafeAreaMargin ? 0 : insets.top,
@@ -191,14 +220,26 @@ export const HeaderSecondLevel = ({
191
220
  }));
192
221
 
193
222
  const headerWrapperAnimatedStyle = useAnimatedStyle(() => ({
194
- backgroundColor: scrollValues
223
+ backgroundColor: enableDiscreteTransition
224
+ ? interpolateColor(
225
+ bgColorDiscreteTransition.value,
226
+ [0, 1],
227
+ [headerBgColorTransparentState, headerBgColorSolidState]
228
+ )
229
+ : scrollValues
195
230
  ? interpolateColor(
196
231
  scrollValues.contentOffsetY.value,
197
232
  [0, scrollValues.triggerOffset],
198
233
  [headerBgColorTransparentState, headerBgColorSolidState]
199
234
  )
200
235
  : headerBgColorSolidState,
201
- borderColor: scrollValues
236
+ borderColor: enableDiscreteTransition
237
+ ? interpolateColor(
238
+ bgColorDiscreteTransition.value,
239
+ [0, 1],
240
+ [borderColorTransparentState, borderColorSolidState]
241
+ )
242
+ : scrollValues
202
243
  ? interpolateColor(
203
244
  scrollValues.contentOffsetY.value,
204
245
  [0, scrollValues.triggerOffset],
@@ -208,7 +249,9 @@ export const HeaderSecondLevel = ({
208
249
  }));
209
250
 
210
251
  const titleAnimatedStyle = useAnimatedStyle(() => ({
211
- opacity: scrollValues
252
+ opacity: enableDiscreteTransition
253
+ ? interpolate(bgColorDiscreteTransition.value, [0, 1], [0, 1])
254
+ : scrollValues
212
255
  ? interpolate(
213
256
  scrollValues.contentOffsetY.value,
214
257
  [0, scrollValues.triggerOffset],
@@ -1,5 +1,5 @@
1
1
  import React, { ComponentProps, useCallback, useMemo } from "react";
2
- import { View } from "react-native";
2
+ import { Platform, View } from "react-native";
3
3
  import {
4
4
  IOListItemStyles,
5
5
  IOListItemVisualParams,
@@ -81,17 +81,7 @@ export const ListItemInfo = ({
81
81
 
82
82
  const itemInfoTextComponent = useMemo(
83
83
  () => (
84
- <View
85
- accessible={endElement === undefined ? true : false}
86
- importantForAccessibility={
87
- endElement !== undefined && endElement.type !== "badge"
88
- ? "no-hide-descendants"
89
- : "yes"
90
- }
91
- accessibilityElementsHidden={
92
- endElement !== undefined && endElement.type !== "badge"
93
- }
94
- >
84
+ <View accessible={Platform.OS === "ios"}>
95
85
  <LabelSmall weight="Regular" color={theme["textBody-tertiary"]}>
96
86
  {label}
97
87
  </LabelSmall>
@@ -104,7 +94,7 @@ export const ListItemInfo = ({
104
94
  )}
105
95
  </View>
106
96
  ),
107
- [label, value, numberOfLines, theme, endElement]
97
+ [label, value, numberOfLines, theme]
108
98
  );
109
99
 
110
100
  const listItemInfoAction = useCallback(() => {
@@ -113,7 +103,9 @@ export const ListItemInfo = ({
113
103
 
114
104
  switch (type) {
115
105
  case "buttonLink":
116
- const buttonLinkAccessibilityLabel = `${listItemAccessibilityLabel}; ${componentProps.accessibilityLabel}`;
106
+ const buttonLinkAccessibilityLabel = `${
107
+ componentProps.accessibilityLabel ?? componentProps.label
108
+ }`;
117
109
 
118
110
  return (
119
111
  <ButtonLink
@@ -122,7 +114,7 @@ export const ListItemInfo = ({
122
114
  />
123
115
  );
124
116
  case "iconButton":
125
- const iconButtonAccessibilityLabel = `${listItemAccessibilityLabel}; ${componentProps.accessibilityLabel}`;
117
+ const iconButtonAccessibilityLabel = `${componentProps.accessibilityLabel}`;
126
118
  return (
127
119
  <IconButton
128
120
  {...componentProps}
@@ -136,7 +128,7 @@ export const ListItemInfo = ({
136
128
  }
137
129
  }
138
130
  return <></>;
139
- }, [endElement, listItemAccessibilityLabel]);
131
+ }, [endElement]);
140
132
 
141
133
  return (
142
134
  <View
@@ -234,9 +234,7 @@ exports[`Test List Item Components - Experimental Enabled ListItemInfo Snapshot
234
234
  }
235
235
  >
236
236
  <View
237
- accessibilityElementsHidden={false}
238
237
  accessible={true}
239
- importantForAccessibility="yes"
240
238
  >
241
239
  <Text
242
240
  allowFontScaling={true}
@@ -2065,9 +2063,7 @@ exports[`Test List Item Components ListItemInfo Snapshot 1`] = `
2065
2063
  }
2066
2064
  >
2067
2065
  <View
2068
- accessibilityElementsHidden={false}
2069
2066
  accessible={true}
2070
- importantForAccessibility="yes"
2071
2067
  >
2072
2068
  <Text
2073
2069
  allowFontScaling={false}
@@ -1,12 +1,12 @@
1
1
  import React, { useCallback } from "react";
2
- import { GestureResponderEvent, PressableProps, View } from "react-native";
2
+ import { GestureResponderEvent, PressableProps } from "react-native";
3
3
  import Placeholder from "rn-placeholder";
4
4
  import { IOListItemVisualParams, useIOTheme } from "../../core";
5
5
  import { WithTestID } from "../../utils/types";
6
6
  import { Badge } from "../badge";
7
7
  import { Icon } from "../icons";
8
8
  import { LoadingSpinner } from "../loadingSpinner";
9
- import { VSpacer } from "../spacer";
9
+ import { HStack, VStack } from "../stack";
10
10
  import { LabelSmallAlt } from "../typography";
11
11
  import { ModuleStatic } from "./ModuleStatic";
12
12
  import { PressableModuleBase } from "./PressableModuleBase";
@@ -61,21 +61,21 @@ const ModuleAttachmentContent = ({
61
61
  };
62
62
 
63
63
  return (
64
- <>
65
- <View style={{ alignItems: "flex-start", flexShrink: 1 }}>
64
+ <HStack space={8} style={{ alignItems: "center" }}>
65
+ <VStack
66
+ space={4}
67
+ style={{ alignItems: "flex-start", flexShrink: 1, flexGrow: 1 }}
68
+ >
66
69
  <LabelSmallAlt
67
70
  numberOfLines={2}
68
71
  color={theme["interactiveElem-default"]}
69
72
  >
70
73
  {title}
71
74
  </LabelSmallAlt>
72
- <VSpacer size={4} />
73
75
  <Badge text={format.toUpperCase()} variant="default" />
74
- </View>
75
- <View style={{ marginLeft: IOListItemVisualParams.iconMargin }}>
76
- <IconOrActivityIndicatorComponent />
77
- </View>
78
- </>
76
+ </VStack>
77
+ <IconOrActivityIndicatorComponent />
78
+ </HStack>
79
79
  );
80
80
  };
81
81
 
@@ -151,11 +151,10 @@ export const ModuleAttachment = ({
151
151
  const ModuleAttachmentSkeleton = () => (
152
152
  <ModuleStatic
153
153
  startBlock={
154
- <View>
155
- <Placeholder.Box animate="fade" radius={8} width={107} height={16} />
156
- <VSpacer size={4} />
157
- <Placeholder.Box animate="fade" radius={16} width={44} height={20} />
158
- </View>
154
+ <VStack space={4}>
155
+ <Placeholder.Box animate="fade" radius={8} width={114} height={16} />
156
+ <Placeholder.Box animate="fade" radius={16} width={42} height={20} />
157
+ </VStack>
159
158
  }
160
159
  />
161
160
  );
@@ -14,7 +14,7 @@ import {
14
14
  } from "../../core";
15
15
  import { ButtonLink } from "../buttons";
16
16
  import { IOLogoPaymentType, LogoPayment } from "../logos";
17
- import { HSpacer, VSpacer } from "../spacer";
17
+ import { HStack, VStack } from "../stack";
18
18
  import { H6, LabelSmall } from "../typography";
19
19
  import { ModuleStatic } from "./ModuleStatic";
20
20
  import { PressableModuleBase } from "./PressableModuleBase";
@@ -42,33 +42,32 @@ export type ModuleCheckoutProps = LoadingProps | BaseProps;
42
42
  export const ModuleCheckout = (props: ModuleCheckoutProps) => {
43
43
  const theme = useIOTheme();
44
44
 
45
+ const imageMargin: IOSpacingScale = 12;
46
+
45
47
  if (props.isLoading) {
46
48
  return <ModuleCheckoutSkeleton />;
47
49
  }
48
50
 
49
51
  const { paymentLogo, image, title, subtitle, ctaText, onPress } = props;
50
52
 
51
- const imageComponent = (
52
- <>
53
- {paymentLogo && (
54
- <View style={styles.imageWrapper}>
55
- <LogoPayment name={paymentLogo} />
56
- </View>
57
- )}
58
- {image && (
59
- <Image
60
- source={image}
61
- style={[styles.imageWrapper, styles.image]}
62
- accessibilityIgnoresInvertColors={true}
63
- />
64
- )}
65
- </>
53
+ const paymentLogoComponent = paymentLogo && (
54
+ <LogoPayment name={paymentLogo} />
55
+ );
56
+
57
+ const imageComponent = image && (
58
+ <Image
59
+ source={image}
60
+ style={styles.image}
61
+ accessibilityIgnoresInvertColors={true}
62
+ />
66
63
  );
67
64
 
68
65
  const ModuleBaseContent = () => (
69
- <>
70
- {imageComponent}
71
- <View style={styles.content}>
66
+ <HStack space={imageMargin} style={{ alignItems: "center", flexShrink: 1 }}>
67
+ {/* Graphical elements */}
68
+ {paymentLogoComponent ?? imageComponent}
69
+
70
+ <View style={{ flexGrow: 1, flexShrink: 1 }}>
72
71
  <H6 color={theme["textBody-default"]}>{title}</H6>
73
72
  {subtitle && (
74
73
  <LabelSmall weight="Regular" color={theme["textBody-tertiary"]}>
@@ -76,20 +75,21 @@ export const ModuleCheckout = (props: ModuleCheckoutProps) => {
76
75
  </LabelSmall>
77
76
  )}
78
77
  </View>
79
- </>
78
+ </HStack>
80
79
  );
81
80
 
82
81
  return ctaText ? (
83
82
  <PressableModuleBase onPress={onPress}>
84
- <ModuleBaseContent />
85
- <HSpacer size={4} />
86
- <View
87
- pointerEvents="none"
88
- accessibilityElementsHidden
89
- importantForAccessibility="no-hide-descendants"
90
- >
91
- <ButtonLink label={ctaText} onPress={() => null} />
92
- </View>
83
+ <HStack space={4} style={{ alignItems: "center" }}>
84
+ <ModuleBaseContent />
85
+ <View
86
+ pointerEvents="none"
87
+ accessibilityElementsHidden
88
+ importantForAccessibility="no-hide-descendants"
89
+ >
90
+ <ButtonLink label={ctaText} onPress={() => null} />
91
+ </View>
92
+ </HStack>
93
93
  </PressableModuleBase>
94
94
  ) : (
95
95
  <ModuleStatic>
@@ -101,16 +101,13 @@ export const ModuleCheckout = (props: ModuleCheckoutProps) => {
101
101
  const ModuleCheckoutSkeleton = () => (
102
102
  <ModuleStatic
103
103
  startBlock={
104
- <React.Fragment>
105
- {/* Rewrite it using HStack and VStack */}
104
+ <HStack space={8} style={{ alignItems: "center" }}>
106
105
  <Placeholder.Box animate="fade" radius={8} height={24} width={24} />
107
- <HSpacer size={8} />
108
- <View>
106
+ <VStack space={8}>
109
107
  <Placeholder.Box animate="fade" radius={8} height={20} width={170} />
110
- <VSpacer size={8} />
111
- <Placeholder.Box animate="fade" radius={8} height={16} width={116} />
112
- </View>
113
- </React.Fragment>
108
+ <Placeholder.Box animate="fade" radius={8} height={16} width={110} />
109
+ </VStack>
110
+ </HStack>
114
111
  }
115
112
  endBlock={
116
113
  <Placeholder.Box animate="fade" width={64} height={16} radius={8} />
@@ -118,19 +115,10 @@ const ModuleCheckoutSkeleton = () => (
118
115
  />
119
116
  );
120
117
 
121
- const imageMarginRight: IOSpacingScale = 12;
122
-
123
118
  const styles = StyleSheet.create({
124
- imageWrapper: {
125
- marginRight: imageMarginRight
126
- },
127
119
  image: {
128
120
  width: IOSelectionListItemVisualParams.iconSize,
129
121
  height: IOSelectionListItemVisualParams.iconSize,
130
122
  resizeMode: "contain"
131
- },
132
- content: {
133
- flexGrow: 1,
134
- flexShrink: 1
135
123
  }
136
124
  });
@@ -10,6 +10,7 @@ import Placeholder from "rn-placeholder";
10
10
  import {
11
11
  IOListItemVisualParams,
12
12
  IOSelectionListItemVisualParams,
13
+ IOSpacer,
13
14
  IOStyles,
14
15
  IOVisualCostants,
15
16
  useIOTheme
@@ -18,6 +19,7 @@ import { WithTestID } from "../../utils/types";
18
19
  import { Badge } from "../badge";
19
20
  import { IOIcons, Icon } from "../icons";
20
21
  import { LoadingSpinner } from "../loadingSpinner";
22
+ import { HStack } from "../stack/Stack";
21
23
  import { LabelSmallAlt } from "../typography";
22
24
  import { ModuleStatic } from "./ModuleStatic";
23
25
  import {
@@ -62,28 +64,40 @@ const ModuleCredential = (props: WithTestID<ModuleCredentialProps>) => {
62
64
  ...pressableProps
63
65
  } = props;
64
66
 
67
+ const iconComponent = icon && (
68
+ <Icon
69
+ name={icon}
70
+ size={IOSelectionListItemVisualParams.iconSize}
71
+ color="grey-300"
72
+ />
73
+ );
74
+
75
+ const imageComponent = image && (
76
+ <Image
77
+ source={image}
78
+ style={styles.image}
79
+ accessibilityIgnoresInvertColors={true}
80
+ />
81
+ );
82
+
65
83
  const ModuleContent = () => (
66
- <>
67
- {icon ? (
68
- <View style={styles.icon}>
69
- <Icon name={icon} size={24} color="grey-300" />
70
- </View>
71
- ) : image ? (
72
- <Image
73
- source={image}
74
- style={styles.image}
75
- accessibilityIgnoresInvertColors={true}
76
- />
77
- ) : null}
78
- <View style={styles.label}>
84
+ <HStack space={8} style={{ alignItems: "center" }}>
85
+ <HStack
86
+ space={IOVisualCostants.iconMargin as IOSpacer}
87
+ style={{ flexGrow: 1, flexShrink: 1, alignItems: "center" }}
88
+ >
89
+ {/* Graphical assets */}
90
+ {iconComponent ?? imageComponent}
91
+
79
92
  <LabelSmallAlt
80
93
  color={theme["interactiveElem-default"]}
81
94
  numberOfLines={2}
82
95
  lineBreakMode="middle"
96
+ style={{ flexShrink: 1 }}
83
97
  >
84
98
  {label}
85
99
  </LabelSmallAlt>
86
- </View>
100
+ </HStack>
87
101
  <View style={IOStyles.row}>
88
102
  {badge ? (
89
103
  <Badge {...badge} testID={testID ? `${testID}_badge` : undefined} />
@@ -102,7 +116,7 @@ const ModuleCredential = (props: WithTestID<ModuleCredentialProps>) => {
102
116
  />
103
117
  ) : null}
104
118
  </View>
105
- </>
119
+ </HStack>
106
120
  );
107
121
 
108
122
  return onPress ? (
@@ -119,18 +133,13 @@ const ModuleCredential = (props: WithTestID<ModuleCredentialProps>) => {
119
133
  const ModuleCredentialSkeleton = () => (
120
134
  <ModuleStatic
121
135
  startBlock={
122
- <>
123
- {/* Rewrite it using HStack and VStack, when 0.72 will be used in the main app:
124
- <HStack alignItems="center" space={IOVisualCostants.iconMargin as IOSpacer}>
125
- <Placeholder.Box animate="fade" width={24} height={24} radius={8} />
126
- <Placeholder.Box animate="fade" width={96} height={16} radius={8} />
127
- </HStack>
128
- */}
129
- <View style={{ marginRight: IOVisualCostants.iconMargin }}>
130
- <Placeholder.Box animate="fade" width={24} height={24} radius={8} />
131
- </View>
136
+ <HStack
137
+ style={{ alignItems: "center" }}
138
+ space={IOVisualCostants.iconMargin as IOSpacer}
139
+ >
140
+ <Placeholder.Box animate="fade" width={24} height={24} radius={8} />
132
141
  <Placeholder.Box animate="fade" width={96} height={16} radius={8} />
133
- </>
142
+ </HStack>
134
143
  }
135
144
  endBlock={
136
145
  <Placeholder.Box animate="fade" width={64} height={24} radius={16} />
@@ -142,13 +151,8 @@ const styles = StyleSheet.create({
142
151
  image: {
143
152
  width: IOSelectionListItemVisualParams.iconSize,
144
153
  height: IOSelectionListItemVisualParams.iconSize,
145
- marginRight: IOVisualCostants.iconMargin,
146
154
  resizeMode: "contain"
147
- },
148
- icon: {
149
- marginRight: IOVisualCostants.iconMargin
150
- },
151
- label: { flexGrow: 1, flexShrink: 1, paddingRight: 8 }
155
+ }
152
156
  });
153
157
 
154
158
  export { ModuleCredential };