@pagopa/io-app-design-system 1.14.0 → 1.15.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 (114) hide show
  1. package/lib/commonjs/components/avatar/Avatar.js +22 -6
  2. package/lib/commonjs/components/avatar/Avatar.js.map +1 -1
  3. package/lib/commonjs/components/avatar/__test__/__snapshots__/avatar.test.tsx.snap +17 -4
  4. package/lib/commonjs/components/avatar/__test__/avatar.test.js +3 -8
  5. package/lib/commonjs/components/avatar/__test__/avatar.test.js.map +1 -1
  6. package/lib/commonjs/components/avatar/index.js +0 -11
  7. package/lib/commonjs/components/avatar/index.js.map +1 -1
  8. package/lib/commonjs/components/badge/Badge.js +46 -5
  9. package/lib/commonjs/components/badge/Badge.js.map +1 -1
  10. package/lib/commonjs/components/icons/svg/IconInstitution.js +3 -3
  11. package/lib/commonjs/components/icons/svg/IconInstitution.js.map +1 -1
  12. package/lib/commonjs/components/icons/svg/originals/IconInstitution.svg +2 -7
  13. package/lib/commonjs/components/listitems/ListItemTransaction.js +1 -1
  14. package/lib/commonjs/components/listitems/ListItemTransaction.js.map +1 -1
  15. package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +1 -1
  16. package/lib/commonjs/components/modules/ModuleIDP.js +6 -49
  17. package/lib/commonjs/components/modules/ModuleIDP.js.map +1 -1
  18. package/lib/commonjs/components/modules/ModulePaymentNotice.js +15 -51
  19. package/lib/commonjs/components/modules/ModulePaymentNotice.js.map +1 -1
  20. package/lib/commonjs/components/modules/PressableModuleBase.js +44 -0
  21. package/lib/commonjs/components/modules/PressableModuleBase.js.map +1 -0
  22. package/lib/commonjs/components/modules/hooks/useModuleSpringAnimation.js +41 -0
  23. package/lib/commonjs/components/modules/hooks/useModuleSpringAnimation.js.map +1 -0
  24. package/lib/commonjs/components/modules/index.js +11 -0
  25. package/lib/commonjs/components/modules/index.js.map +1 -1
  26. package/lib/commonjs/components/textInput/TextInputBase.js.map +1 -1
  27. package/lib/commonjs/core/IOColors.js +1 -0
  28. package/lib/commonjs/core/IOColors.js.map +1 -1
  29. package/lib/commonjs/core/IOStyles.js +18 -2
  30. package/lib/commonjs/core/IOStyles.js.map +1 -1
  31. package/lib/commonjs/stories/ModuleIDP.stories.js +45 -0
  32. package/lib/commonjs/stories/ModuleIDP.stories.js.map +1 -0
  33. package/lib/module/components/avatar/Avatar.js +24 -8
  34. package/lib/module/components/avatar/Avatar.js.map +1 -1
  35. package/lib/module/components/avatar/__test__/__snapshots__/avatar.test.tsx.snap +17 -4
  36. package/lib/module/components/avatar/__test__/avatar.test.js +3 -8
  37. package/lib/module/components/avatar/__test__/avatar.test.js.map +1 -1
  38. package/lib/module/components/avatar/index.js +0 -1
  39. package/lib/module/components/avatar/index.js.map +1 -1
  40. package/lib/module/components/badge/Badge.js +44 -4
  41. package/lib/module/components/badge/Badge.js.map +1 -1
  42. package/lib/module/components/icons/svg/IconInstitution.js +3 -3
  43. package/lib/module/components/icons/svg/IconInstitution.js.map +1 -1
  44. package/lib/module/components/icons/svg/originals/IconInstitution.svg +2 -7
  45. package/lib/module/components/listitems/ListItemTransaction.js +1 -1
  46. package/lib/module/components/listitems/ListItemTransaction.js.map +1 -1
  47. package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +1 -1
  48. package/lib/module/components/modules/ModuleIDP.js +8 -52
  49. package/lib/module/components/modules/ModuleIDP.js.map +1 -1
  50. package/lib/module/components/modules/ModulePaymentNotice.js +17 -54
  51. package/lib/module/components/modules/ModulePaymentNotice.js.map +1 -1
  52. package/lib/module/components/modules/PressableModuleBase.js +34 -0
  53. package/lib/module/components/modules/PressableModuleBase.js.map +1 -0
  54. package/lib/module/components/modules/hooks/useModuleSpringAnimation.js +34 -0
  55. package/lib/module/components/modules/hooks/useModuleSpringAnimation.js.map +1 -0
  56. package/lib/module/components/modules/index.js +1 -0
  57. package/lib/module/components/modules/index.js.map +1 -1
  58. package/lib/module/components/textInput/TextInputBase.js.map +1 -1
  59. package/lib/module/core/IOColors.js +1 -0
  60. package/lib/module/core/IOColors.js.map +1 -1
  61. package/lib/module/core/IOStyles.js +15 -0
  62. package/lib/module/core/IOStyles.js.map +1 -1
  63. package/lib/module/stories/ModuleIDP.stories.js +37 -0
  64. package/lib/module/stories/ModuleIDP.stories.js.map +1 -0
  65. package/lib/typescript/components/avatar/Avatar.d.ts +2 -2
  66. package/lib/typescript/components/avatar/Avatar.d.ts.map +1 -1
  67. package/lib/typescript/components/avatar/index.d.ts +0 -1
  68. package/lib/typescript/components/avatar/index.d.ts.map +1 -1
  69. package/lib/typescript/components/badge/Badge.d.ts +2 -1
  70. package/lib/typescript/components/badge/Badge.d.ts.map +1 -1
  71. package/lib/typescript/components/modules/ModuleIDP.d.ts +5 -7
  72. package/lib/typescript/components/modules/ModuleIDP.d.ts.map +1 -1
  73. package/lib/typescript/components/modules/ModulePaymentNotice.d.ts +1 -1
  74. package/lib/typescript/components/modules/ModulePaymentNotice.d.ts.map +1 -1
  75. package/lib/typescript/components/modules/PressableModuleBase.d.ts +10 -0
  76. package/lib/typescript/components/modules/PressableModuleBase.d.ts.map +1 -0
  77. package/lib/typescript/components/modules/hooks/useModuleSpringAnimation.d.ts +10 -0
  78. package/lib/typescript/components/modules/hooks/useModuleSpringAnimation.d.ts.map +1 -0
  79. package/lib/typescript/components/modules/index.d.ts +1 -0
  80. package/lib/typescript/components/modules/index.d.ts.map +1 -1
  81. package/lib/typescript/components/textInput/TextInputBase.d.ts +1 -1
  82. package/lib/typescript/components/textInput/TextInputBase.d.ts.map +1 -1
  83. package/lib/typescript/core/IOColors.d.ts +1 -0
  84. package/lib/typescript/core/IOColors.d.ts.map +1 -1
  85. package/lib/typescript/core/IOStyles.d.ts +13 -0
  86. package/lib/typescript/core/IOStyles.d.ts.map +1 -1
  87. package/lib/typescript/stories/ModuleIDP.stories.d.ts +24 -0
  88. package/lib/typescript/stories/ModuleIDP.stories.d.ts.map +1 -0
  89. package/package.json +1 -1
  90. package/src/components/avatar/Avatar.tsx +63 -24
  91. package/src/components/avatar/__test__/__snapshots__/avatar.test.tsx.snap +17 -4
  92. package/src/components/avatar/__test__/avatar.test.tsx +1 -8
  93. package/src/components/avatar/index.tsx +0 -1
  94. package/src/components/badge/Badge.tsx +63 -7
  95. package/src/components/icons/svg/IconInstitution.tsx +2 -2
  96. package/src/components/icons/svg/originals/IconInstitution.svg +2 -7
  97. package/src/components/listitems/ListItemTransaction.tsx +1 -1
  98. package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +1 -1
  99. package/src/components/modules/ModuleIDP.tsx +16 -86
  100. package/src/components/modules/ModulePaymentNotice.tsx +14 -77
  101. package/src/components/modules/PressableModuleBase.tsx +45 -0
  102. package/src/components/modules/hooks/useModuleSpringAnimation.ts +49 -0
  103. package/src/components/modules/index.tsx +1 -0
  104. package/src/components/textInput/TextInputBase.tsx +1 -0
  105. package/src/core/IOColors.ts +2 -0
  106. package/src/core/IOStyles.ts +22 -1
  107. package/src/stories/ModuleIDP.stories.tsx +44 -0
  108. package/lib/commonjs/components/avatar/MultiImage.js +0 -47
  109. package/lib/commonjs/components/avatar/MultiImage.js.map +0 -1
  110. package/lib/module/components/avatar/MultiImage.js +0 -39
  111. package/lib/module/components/avatar/MultiImage.js.map +0 -1
  112. package/lib/typescript/components/avatar/MultiImage.d.ts +0 -22
  113. package/lib/typescript/components/avatar/MultiImage.d.ts.map +0 -1
  114. package/src/components/avatar/MultiImage.tsx +0 -57
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-app-design-system",
3
- "version": "1.14.0",
3
+ "version": "1.15.0",
4
4
  "description": "The library defining the core components of the design system of @pagopa/io-app",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -1,29 +1,40 @@
1
1
  // A component to provide organization logo
2
2
  import * as React from "react";
3
- import { StyleSheet, View } from "react-native";
4
- import { IOVisualCostants, IOColors, hexToRgba } from "../../core";
5
- import { MultiImage } from "./MultiImage";
3
+ import { Image, ImageURISource, StyleSheet, View } from "react-native";
4
+ import { Icon } from "../../components/icons";
5
+ import {
6
+ IOColors,
7
+ IOSpacingScale,
8
+ IOThemeContext,
9
+ IOVisualCostants,
10
+ hexToRgba
11
+ } from "../../core";
12
+ import { addCacheTimestampToUri } from "../../utils/image";
6
13
 
7
14
  type Avatar = {
8
15
  shape: "circle" | "square";
9
16
  size: "small" | "medium";
10
- logoUri: React.ComponentProps<typeof MultiImage>["source"];
17
+ logoUri?: ImageURISource;
11
18
  };
12
19
 
13
20
  const avatarBorderLightMode = hexToRgba(IOColors.black, 0.1);
14
21
  const internalSpaceDefaultSize: number = 6;
15
22
  const internalSpaceLargeSize: number = 9;
16
23
  const radiusDefaultSize: number = 8;
24
+ const internalSpacePlaceholderDefaultSize: IOSpacingScale = 12;
25
+ const internalSpacePlaceholderLargeSize: IOSpacingScale = 16;
17
26
 
18
27
  const dimensionsMap = {
19
28
  small: {
20
29
  size: IOVisualCostants.avatarSizeSmall,
21
30
  internalSpace: internalSpaceDefaultSize,
31
+ internalSpacePlaceholder: internalSpacePlaceholderDefaultSize,
22
32
  radius: radiusDefaultSize
23
33
  },
24
34
  medium: {
25
35
  size: IOVisualCostants.avatarSizeMedium,
26
36
  internalSpace: internalSpaceLargeSize,
37
+ internalSpacePlaceholder: internalSpacePlaceholderLargeSize,
27
38
  radius: radiusDefaultSize
28
39
  }
29
40
  };
@@ -36,8 +47,7 @@ const styles = StyleSheet.create({
36
47
  overflow: "hidden",
37
48
  resizeMode: "contain",
38
49
  borderColor: avatarBorderLightMode,
39
- borderWidth: 1,
40
- backgroundColor: IOColors.white
50
+ borderWidth: 1
41
51
  },
42
52
  avatarImage: {
43
53
  height: "100%",
@@ -45,21 +55,50 @@ const styles = StyleSheet.create({
45
55
  }
46
56
  });
47
57
 
48
- export const Avatar = ({ logoUri, shape, size }: Avatar) => (
49
- <View
50
- style={[
51
- styles.avatarWrapper,
52
- {
53
- height: dimensionsMap[size].size,
54
- width: dimensionsMap[size].size,
55
- borderRadius:
56
- shape === "circle"
57
- ? getAvatarCircleShape(size)
58
- : dimensionsMap[size].radius,
59
- padding: dimensionsMap[size].internalSpace
60
- }
61
- ]}
62
- >
63
- <MultiImage style={styles.avatarImage} source={logoUri} />
64
- </View>
65
- );
58
+ export const Avatar = ({ logoUri, shape, size }: Avatar) => {
59
+ const theme = React.useContext(IOThemeContext);
60
+
61
+ const [imageSource, setImageSource] = React.useState(
62
+ !logoUri ? undefined : addCacheTimestampToUri(logoUri)
63
+ );
64
+
65
+ const isPlaceholder = !imageSource;
66
+
67
+ const onError = () => {
68
+ setImageSource(undefined);
69
+ };
70
+
71
+ return (
72
+ <View
73
+ style={[
74
+ styles.avatarWrapper,
75
+ {
76
+ height: dimensionsMap[size].size,
77
+ width: dimensionsMap[size].size,
78
+ borderRadius:
79
+ shape === "circle"
80
+ ? getAvatarCircleShape(size)
81
+ : dimensionsMap[size].radius,
82
+ backgroundColor: isPlaceholder ? IOColors["grey-50"] : IOColors.white,
83
+ padding: isPlaceholder
84
+ ? dimensionsMap[size].internalSpacePlaceholder
85
+ : dimensionsMap[size].internalSpace
86
+ }
87
+ ]}
88
+ >
89
+ {isPlaceholder ? (
90
+ <Icon
91
+ name="institution"
92
+ color={theme["icon-decorative"]}
93
+ size={"100%"}
94
+ />
95
+ ) : (
96
+ <Image
97
+ source={imageSource}
98
+ style={styles.avatarImage}
99
+ onError={onError}
100
+ />
101
+ )}
102
+ </View>
103
+ );
104
+ };
@@ -5,13 +5,13 @@ exports[`Test Avatar Components Avatar Snapshot 1`] = `
5
5
  style={
6
6
  [
7
7
  {
8
- "backgroundColor": "#FFFFFF",
9
8
  "borderColor": "rgba(14,15,19,0.1)",
10
9
  "borderWidth": 1,
11
10
  "overflow": "hidden",
12
11
  "resizeMode": "contain",
13
12
  },
14
13
  {
14
+ "backgroundColor": "#FFFFFF",
15
15
  "borderRadius": 22,
16
16
  "height": 44,
17
17
  "padding": 6,
@@ -19,7 +19,20 @@ exports[`Test Avatar Components Avatar Snapshot 1`] = `
19
19
  },
20
20
  ]
21
21
  }
22
- />
22
+ >
23
+ <Image
24
+ onError={[Function]}
25
+ source={
26
+ {
27
+ "uri": "",
28
+ }
29
+ }
30
+ style={
31
+ {
32
+ "height": "100%",
33
+ "width": "100%",
34
+ }
35
+ }
36
+ />
37
+ </View>
23
38
  `;
24
-
25
- exports[`Test Avatar Components MultiImage Snapshot 1`] = `null`;
@@ -1,19 +1,12 @@
1
1
  import React from "react";
2
2
  import * as TestRenderer from "react-test-renderer";
3
3
  import { Avatar } from "../Avatar";
4
- import { MultiImage } from "../MultiImage";
5
4
 
6
5
  describe("Test Avatar Components", () => {
7
6
  it("Avatar Snapshot", () => {
8
7
  const avatar = TestRenderer.create(
9
- <Avatar shape={"circle"} size={"small"} logoUri={[]}></Avatar>
8
+ <Avatar shape={"circle"} size={"small"} logoUri={{ uri: "" }}></Avatar>
10
9
  ).toJSON();
11
10
  expect(avatar).toMatchSnapshot();
12
11
  });
13
- it("MultiImage Snapshot", () => {
14
- const multiImage = TestRenderer.create(
15
- <MultiImage source={[]}></MultiImage>
16
- ).toJSON();
17
- expect(multiImage).toMatchSnapshot();
18
- });
19
12
  });
@@ -1,2 +1 @@
1
1
  export * from "./Avatar";
2
- export * from "./MultiImage";
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, { useMemo } from "react";
2
2
  import { Platform, StyleSheet, Text, View } from "react-native";
3
3
  import {
4
4
  IOBadgeHSpacing,
@@ -11,6 +11,7 @@ import { makeFontStyleObject } from "../../utils/fonts";
11
11
  import { WithTestID } from "../../utils/types";
12
12
 
13
13
  export type Badge = WithTestID<{
14
+ outline?: boolean;
14
15
  text: string;
15
16
  variant:
16
17
  | "default"
@@ -25,12 +26,12 @@ export type Badge = WithTestID<{
25
26
  | "contrast";
26
27
  }>;
27
28
 
28
- type VariantProps = {
29
- foreground: IOColors;
29
+ type SolidVariantProps = {
30
30
  background: IOColors;
31
+ foreground: IOColors;
31
32
  };
32
33
 
33
- const mapVariants: Record<NonNullable<Badge["variant"]>, VariantProps> = {
34
+ const mapVariants: Record<NonNullable<Badge["variant"]>, SolidVariantProps> = {
34
35
  default: {
35
36
  foreground: "grey-700",
36
37
  background: "grey-50"
@@ -73,6 +74,47 @@ const mapVariants: Record<NonNullable<Badge["variant"]>, VariantProps> = {
73
74
  }
74
75
  };
75
76
 
77
+ type OutlinedVariantProps = {
78
+ foreground: IOColors;
79
+ background?: never;
80
+ };
81
+
82
+ const mapOutlineVariants: Record<
83
+ NonNullable<Badge["variant"]>,
84
+ OutlinedVariantProps
85
+ > = {
86
+ default: {
87
+ foreground: "grey-700"
88
+ },
89
+ info: {
90
+ foreground: "info-850"
91
+ },
92
+ warning: {
93
+ foreground: "warning-850"
94
+ },
95
+ success: {
96
+ foreground: "success-850"
97
+ },
98
+ error: {
99
+ foreground: "error-850"
100
+ },
101
+ purple: {
102
+ foreground: "hanPurple-850"
103
+ },
104
+ lightBlue: {
105
+ foreground: "blueIO-850"
106
+ },
107
+ blue: {
108
+ foreground: "blueIO-500"
109
+ },
110
+ turquoise: {
111
+ foreground: "turquoise-850"
112
+ },
113
+ contrast: {
114
+ foreground: "grey-850"
115
+ }
116
+ };
117
+
76
118
  const styles = StyleSheet.create({
77
119
  badge: {
78
120
  flexDirection: "row",
@@ -106,14 +148,26 @@ const styles = StyleSheet.create({
106
148
  /**
107
149
  * Official badge component
108
150
  */
109
- export const Badge = ({ text, variant, testID }: Badge) => {
151
+ export const Badge = ({ text, outline = false, variant, testID }: Badge) => {
110
152
  const { isExperimental } = useIOExperimentalDesign();
153
+ const { background, foreground } = useMemo(
154
+ () => (outline ? mapOutlineVariants : mapVariants)[variant],
155
+ [outline, variant]
156
+ );
157
+
111
158
  return (
112
159
  <View
113
160
  testID={testID}
114
161
  style={[
115
162
  styles.badge,
116
- { backgroundColor: IOColors[mapVariants[variant].background] }
163
+ outline
164
+ ? {
165
+ borderWidth: 1,
166
+ borderColor: IOColors[foreground]
167
+ }
168
+ : {
169
+ backgroundColor: background ? IOColors[background] : undefined
170
+ }
117
171
  ]}
118
172
  >
119
173
  <Text
@@ -122,7 +176,9 @@ export const Badge = ({ text, variant, testID }: Badge) => {
122
176
  style={[
123
177
  styles.label,
124
178
  isExperimental ? styles.labelFont : styles.legacyLabelFont,
125
- { color: IOColors[mapVariants[variant].foreground] }
179
+ {
180
+ color: IOColors[foreground]
181
+ }
126
182
  ]}
127
183
  >
128
184
  {text}
@@ -5,10 +5,10 @@ import { SVGIconProps } from "../Icon";
5
5
  const IconInstitution = ({ size, style, ...props }: SVGIconProps) => (
6
6
  <Svg width={size} height={size} viewBox="0 0 24 24" style={style} {...props}>
7
7
  <Path
8
+ fill="currentColor"
8
9
  fillRule="evenodd"
10
+ d="M10.402 2.685a2.997 2.997 0 0 1 3.219 0l7.918 5.04a.999.999 0 0 1 .463.842l-.023 1.423H1.999l.022-1.423c0-.342.174-.66.463-.843l7.918-5.039ZM14.693.999A4.995 4.995 0 0 0 9.33 1L1.41 6.04A2.997 2.997 0 0 0 .024 8.566L0 10.989a1 1 0 0 0 .999 1h1v9.99h-1a.999.999 0 1 0 0 1.998H22.978a1 1 0 0 0 0-1.998h-.999v-9.99h1a1 1 0 0 0 .998-1L24 8.567a2.997 2.997 0 0 0-1.388-2.529L14.693 1ZM5.994 21.98H3.996v-9.99h1.998v9.99Zm9.99-9.99v9.99H7.993v-9.99h7.993Zm3.997 9.99h-1.998v-9.99h1.998v9.99ZM13.51 6.471a1.499 1.499 0 1 1-2.997 0 1.499 1.499 0 0 1 2.997 0Z"
9
11
  clipRule="evenodd"
10
- d="M10.4023 2.68517c.9818-.62476 2.2365-.62476 3.2182 0l7.9187 5.03918a.999.999 0 0 1 .4627.84286l-.0229 1.42337H1.99809l.02288-1.42337a.99903.99903 0 0 1 .46269-.84286l7.91864-5.03918Zm4.291-1.68572c-1.6363-1.04126-3.7274-1.04126-5.36368 0L1.41093 6.03864C.54641 6.58878.02288 7.54248.02288 8.56721L0 10.9896c0 .5518.44729.9991.99905.9991h.99904v9.9905H.99905c-.55176 0-.99905.4473-.99905.999 0 .5518.44729.9991.99905.9991H22.9781c.5517 0 .999-.4473.999-.9991 0-.5517-.4473-.999-.999-.999h-.9991v-9.9905h.9991c.5517 0 .999-.4473.999-.9991L24 8.56721c0-1.02473-.5235-1.97843-1.388-2.52858L14.6933.99945ZM5.99428 21.9792H3.99619v-9.9905h1.99809v9.9905Zm9.99042-9.9905v9.9905H7.99237v-9.9905h7.99233Zm3.9962 9.9905h-1.9981v-9.9905h1.9981v9.9905ZM13.51 6.47125c0 .82764-.6709 1.49857-1.4986 1.49857-.8276 0-1.4985-.67093-1.4985-1.49857 0-.82764.6709-1.49858 1.4985-1.49858.8277 0 1.4986.67094 1.4986 1.49858Z"
11
- fill="currentColor"
12
12
  />
13
13
  </Svg>
14
14
  );
@@ -1,8 +1,3 @@
1
- <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
- <path
3
- fill-rule="evenodd"
4
- clip-rule="evenodd"
5
- d="M10.4023 2.68517c.9818-.62476 2.2365-.62476 3.2182 0l7.9187 5.03918a.999.999 0 0 1 .4627.84286l-.0229 1.42337H1.99809l.02288-1.42337a.99903.99903 0 0 1 .46269-.84286l7.91864-5.03918Zm4.291-1.68572c-1.6363-1.04126-3.7274-1.04126-5.36368 0L1.41093 6.03864C.54641 6.58878.02288 7.54248.02288 8.56721L0 10.9896c0 .5518.44729.9991.99905.9991h.99904v9.9905H.99905c-.55176 0-.99905.4473-.99905.999 0 .5518.44729.9991.99905.9991H22.9781c.5517 0 .999-.4473.999-.9991 0-.5517-.4473-.999-.999-.999h-.9991v-9.9905h.9991c.5517 0 .999-.4473.999-.9991L24 8.56721c0-1.02473-.5235-1.97843-1.388-2.52858L14.6933.99945ZM5.99428 21.9792H3.99619v-9.9905h1.99809v9.9905Zm9.99042-9.9905v9.9905H7.99237v-9.9905h7.99233Zm3.9962 9.9905h-1.9981v-9.9905h1.9981v9.9905ZM13.51 6.47125c0 .82764-.6709 1.49857-1.4986 1.49857-.8276 0-1.4985-.67093-1.4985-1.49857 0-.82764.6709-1.49858 1.4985-1.49858.8277 0 1.4986.67094 1.4986 1.49858Z"
6
- fill="#0E0F13"
7
- />
1
+ <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M10.4023 2.68497C11.3841 2.06021 12.6388 2.06021 13.6205 2.68497L21.5392 7.72414C21.8274 7.90752 22.0019 8.22542 22.0019 8.56699L21.979 9.99037H1.99809L2.02097 8.56699C2.02097 8.22542 2.19548 7.90752 2.48366 7.72414L10.4023 2.68497ZM14.6933 0.999255C13.057 -0.0420089 10.9659 -0.0420063 9.32962 0.999256L1.41093 6.03842C0.54641 6.58857 0.0228809 7.54227 0.0228809 8.56699L0 10.9894C0 11.5412 0.447288 11.9885 0.999047 11.9885H1.99809V21.979H0.999047C0.447288 21.979 0 22.4262 0 22.978C0 23.5298 0.447288 23.9771 0.999047 23.9771H2.99714H6.99333H16.9838H20.98H22.9781C23.5298 23.9771 23.9771 23.5298 23.9771 22.978C23.9771 22.4262 23.5298 21.979 22.9781 21.979H21.979V11.9885H22.9781C23.5298 11.9885 23.9771 11.5412 23.9771 10.9894L24 8.56699C24 7.54227 23.4765 6.58857 22.612 6.03842L14.6933 0.999255ZM5.99428 21.979H3.99619V11.9885H5.99428V21.979ZM15.9847 11.9885V21.979H7.99237V11.9885H15.9847ZM19.9809 21.979H17.9828V11.9885H19.9809V21.979ZM13.51 6.47104C13.51 7.29868 12.8391 7.96961 12.0114 7.96961C11.1838 7.96961 10.5129 7.29868 10.5129 6.47104C10.5129 5.6434 11.1838 4.97247 12.0114 4.97247C12.8391 4.97247 13.51 5.6434 13.51 6.47104Z" fill="#2B2E38"/>
8
3
  </svg>
@@ -91,7 +91,7 @@ const MUNICIPALITY_LOGO_SIZE = 44;
91
91
 
92
92
  const LeftComponent = ({ logoIcon }: LeftComponentProps) => {
93
93
  if (isImageUri(logoIcon)) {
94
- return <Avatar logoUri={[logoIcon]} size="small" shape="circle" />;
94
+ return <Avatar logoUri={logoIcon} size="small" shape="circle" />;
95
95
  }
96
96
  if (React.isValidElement(logoIcon)) {
97
97
  return <>{logoIcon}</>;
@@ -146,7 +146,7 @@ exports[`Test List Item Components ListItemIDP Snapshot 1`] = `
146
146
  "paddingHorizontal": 16,
147
147
  "paddingVertical": 16,
148
148
  },
149
- undefined,
149
+ false,
150
150
  {
151
151
  "transform": [
152
152
  {
@@ -1,57 +1,30 @@
1
1
  import * as React from "react";
2
- import { useCallback } from "react";
3
2
  import {
4
- GestureResponderEvent,
5
3
  Image,
6
4
  ImageSourcePropType,
7
5
  Platform,
8
- Pressable,
9
6
  StyleSheet,
10
7
  Text
11
8
  } from "react-native";
12
- import Animated, {
13
- Extrapolate,
14
- interpolate,
15
- useAnimatedStyle,
16
- useDerivedValue,
17
- useSharedValue,
18
- withSpring
19
- } from "react-native-reanimated";
20
9
  import {
21
10
  IOColors,
22
- IOModuleIDPHSpacing,
23
- IOModuleIDPRadius,
24
- IOModuleIDPSavedVSpacing,
25
- IOModuleIDPVSpacing,
26
11
  IOListItemLogoMargin,
27
- IOScaleValues,
28
- IOSpringValues,
29
12
  useIOExperimentalDesign
30
13
  } from "../../core";
31
14
  import { toAndroidCacheTimestamp } from "../../utils/dates";
32
15
  import { makeFontStyleObject } from "../../utils/fonts";
33
- import { WithTestID } from "../../utils/types";
16
+ import {
17
+ PressableModuleBase,
18
+ PressableModuleBaseProps
19
+ } from "./PressableModuleBase";
34
20
 
35
- type ModuleIDP = WithTestID<{
21
+ interface ModuleIDP extends PressableModuleBaseProps {
36
22
  name: string;
37
23
  localLogo: ImageSourcePropType;
38
24
  logo: ImageSourcePropType;
39
- saved?: boolean;
40
- onPress: (event: GestureResponderEvent) => void;
41
- }>;
25
+ }
42
26
 
43
27
  const styles = StyleSheet.create({
44
- button: {
45
- borderWidth: 1,
46
- borderColor: IOColors["grey-100"],
47
- borderRadius: IOModuleIDPRadius,
48
- backgroundColor: IOColors.white,
49
- flexDirection: "row",
50
- justifyContent: "space-between",
51
- alignItems: "center",
52
- paddingVertical: IOModuleIDPVSpacing,
53
- paddingHorizontal: IOModuleIDPHSpacing
54
- },
55
28
  idpName: {
56
29
  color: IOColors["grey-700"],
57
30
  fontSize: 12,
@@ -84,41 +57,11 @@ export const ModuleIDP = ({
84
57
  name,
85
58
  localLogo,
86
59
  logo,
87
- saved,
60
+ withLooseSpacing = false,
88
61
  onPress,
89
62
  testID
90
63
  }: ModuleIDP) => {
91
- const isPressed = useSharedValue(0);
92
64
  const { isExperimental } = useIOExperimentalDesign();
93
- // Scaling transformation applied when the button is pressed
94
- const animationScaleValue = IOScaleValues?.magnifiedButton?.pressedState;
95
-
96
- const scaleTraversed = useDerivedValue(() =>
97
- withSpring(isPressed.value, IOSpringValues.button)
98
- );
99
-
100
- // Interpolate animation values from `isPressed` values
101
- const animatedStyle = useAnimatedStyle(() => {
102
- const scale = interpolate(
103
- scaleTraversed.value,
104
- [0, 1],
105
- [1, animationScaleValue],
106
- Extrapolate.CLAMP
107
- );
108
-
109
- return {
110
- transform: [{ scale }]
111
- };
112
- });
113
-
114
- const handlePressIn = useCallback(() => {
115
- // eslint-disable-next-line functional/immutable-data
116
- isPressed.value = 1;
117
- }, [isPressed]);
118
- const handlePressOut = useCallback(() => {
119
- // eslint-disable-next-line functional/immutable-data
120
- isPressed.value = 0;
121
- }, [isPressed]);
122
65
 
123
66
  // eslint-disable-next-line no-console
124
67
  const urlLogoIDP = localLogo
@@ -127,34 +70,21 @@ export const ModuleIDP = ({
127
70
  uri: `${logo}${androidIdpLogoForcedRefreshed()}`
128
71
  };
129
72
  return (
130
- <Pressable
73
+ <PressableModuleBase
131
74
  onPress={onPress}
132
- onPressIn={handlePressIn}
133
- onPressOut={handlePressOut}
134
- onTouchEnd={handlePressOut}
135
- accessible={true}
136
- accessibilityRole={"button"}
137
- accessibilityLabel={name}
138
75
  testID={testID}
76
+ withLooseSpacing={withLooseSpacing}
139
77
  >
140
- <Animated.View
78
+ <Text
141
79
  style={[
142
- styles.button,
143
- saved && { paddingVertical: IOModuleIDPSavedVSpacing },
144
- animatedStyle
80
+ styles.idpName,
81
+ isExperimental ? styles.idpNameFont : styles.idpLegacyNameFont
145
82
  ]}
146
83
  >
147
- <Text
148
- style={[
149
- styles.idpName,
150
- isExperimental ? styles.idpNameFont : styles.idpLegacyNameFont
151
- ]}
152
- >
153
- {name}
154
- </Text>
155
- <Image source={urlLogoIDP} style={styles.idpLogo} />
156
- </Animated.View>
157
- </Pressable>
84
+ {name}
85
+ </Text>
86
+ <Image source={urlLogoIDP} style={styles.idpLogo} />
87
+ </PressableModuleBase>
158
88
  );
159
89
  };
160
90
 
@@ -1,19 +1,5 @@
1
1
  import * as React from "react";
2
- import { useCallback } from "react";
3
- import {
4
- GestureResponderEvent,
5
- Pressable,
6
- StyleSheet,
7
- View
8
- } from "react-native";
9
- import Animated, {
10
- Extrapolate,
11
- interpolate,
12
- useAnimatedStyle,
13
- useDerivedValue,
14
- useSharedValue,
15
- withSpring
16
- } from "react-native-reanimated";
2
+ import { GestureResponderEvent, StyleSheet, View } from "react-native";
17
3
  import Placeholder from "rn-placeholder";
18
4
  import { WithTestID } from "../../utils/types";
19
5
  import { getAccessibleAmountText } from "../../utils/accessibility";
@@ -21,14 +7,13 @@ import { H6, LabelSmall } from "../typography";
21
7
  import { Badge } from "../badge";
22
8
  import { Icon } from "../icons";
23
9
  import {
24
- IOColors,
25
10
  IOListItemVisualParams,
26
- IOScaleValues,
27
- IOSpringValues,
11
+ IOModuleStyles,
28
12
  IOStyles,
29
13
  useIOExperimentalDesign
30
14
  } from "../../core";
31
15
  import { VSpacer } from "../spacer";
16
+ import { PressableModuleBase } from "./PressableModuleBase";
32
17
 
33
18
  export type PaymentNoticeStatus =
34
19
  | "default"
@@ -36,7 +21,8 @@ export type PaymentNoticeStatus =
36
21
  | "error"
37
22
  | "expired"
38
23
  | "revoked"
39
- | "canceled";
24
+ | "canceled"
25
+ | "in-progress";
40
26
 
41
27
  export type ModulePaymentNoticeProps = WithTestID<
42
28
  {
@@ -60,19 +46,6 @@ export type ModulePaymentNoticeProps = WithTestID<
60
46
  >;
61
47
 
62
48
  const styles = StyleSheet.create({
63
- button: {
64
- flex: 1,
65
- flexDirection: "row",
66
- alignItems: "center",
67
- justifyContent: "space-between",
68
- paddingHorizontal: 16,
69
- paddingVertical: 16,
70
- borderRadius: 8,
71
- borderColor: IOColors.bluegreyLight,
72
- backgroundColor: IOColors.white,
73
- borderStyle: "solid",
74
- borderWidth: 1
75
- },
76
49
  rightSection: {
77
50
  marginLeft: IOListItemVisualParams.iconMargin,
78
51
  flexDirection: "row",
@@ -111,12 +84,14 @@ const ModulePaymentNoticeContent = ({
111
84
  return <Badge variant="default" text={badgeText} />;
112
85
  case "canceled":
113
86
  return <Badge variant="default" text={badgeText} />;
87
+ case "in-progress":
88
+ return <Badge variant="info" text={badgeText} />;
114
89
  }
115
90
  };
116
91
 
117
92
  return (
118
93
  <>
119
- <View style={{ flexGrow: 1, flexShrink: 1 }}>
94
+ <View style={{ flexGrow: 1, flexShrink: 1, paddingEnd: 8 }}>
120
95
  {title && (
121
96
  <LabelSmall numberOfLines={1} weight="Regular" color="bluegrey">
122
97
  {title}
@@ -126,6 +101,7 @@ const ModulePaymentNoticeContent = ({
126
101
  weight="SemiBold"
127
102
  font={isExperimental ? "ReadexPro" : "TitilliumWeb"}
128
103
  color={isExperimental ? "blueIO-500" : "bluegrey"}
104
+ numberOfLines={2}
129
105
  >
130
106
  {subtitle}
131
107
  </LabelSmall>
@@ -161,62 +137,23 @@ export const ModulePaymentNotice = ({
161
137
  onPress,
162
138
  ...rest
163
139
  }: ModulePaymentNoticeProps) => {
164
- const isPressed: Animated.SharedValue<number> = useSharedValue(0);
165
-
166
- // Scaling transformation applied when the button is pressed
167
- const animationScaleValue = IOScaleValues?.magnifiedButton?.pressedState;
168
-
169
- const scaleTraversed = useDerivedValue(() =>
170
- withSpring(isPressed.value, IOSpringValues.button)
171
- );
172
-
173
- // Interpolate animation values from `isPressed` values
174
- const animatedStyle = useAnimatedStyle(() => {
175
- const scale = interpolate(
176
- scaleTraversed.value,
177
- [0, 1],
178
- [1, animationScaleValue],
179
- Extrapolate.CLAMP
180
- );
181
-
182
- return {
183
- transform: [{ scale }]
184
- };
185
- });
186
-
187
- const onPressIn = useCallback(() => {
188
- // eslint-disable-next-line functional/immutable-data
189
- isPressed.value = 1;
190
- }, [isPressed]);
191
-
192
- const onPressOut = useCallback(() => {
193
- // eslint-disable-next-line functional/immutable-data
194
- isPressed.value = 0;
195
- }, [isPressed]);
196
-
197
140
  if (isLoading) {
198
141
  return <SkeletonComponent />;
199
142
  }
200
143
 
201
144
  return (
202
- <Pressable
203
- testID={testID}
145
+ <PressableModuleBase
204
146
  onPress={onPress}
205
- onPressIn={onPressIn}
206
- onPressOut={onPressOut}
207
- accessible={true}
208
- accessibilityRole={"button"}
209
147
  accessibilityLabel={accessibilityLabel}
148
+ testID={testID}
210
149
  >
211
- <Animated.View style={[styles.button, animatedStyle]}>
212
- <ModulePaymentNoticeContent {...rest} />
213
- </Animated.View>
214
- </Pressable>
150
+ <ModulePaymentNoticeContent {...rest} />
151
+ </PressableModuleBase>
215
152
  );
216
153
  };
217
154
 
218
155
  const SkeletonComponent = () => (
219
- <View style={styles.button} accessible={false}>
156
+ <View style={IOModuleStyles.button} accessible={false}>
220
157
  <View style={IOStyles.flex}>
221
158
  <Placeholder.Box animate="fade" radius={8} width={179} height={16} />
222
159
  <VSpacer size={4} />