@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
@@ -10,13 +10,14 @@ import Placeholder from "rn-placeholder";
10
10
  import {
11
11
  IOListItemVisualParams,
12
12
  IOSelectionListItemVisualParams,
13
+ IOSpacer,
13
14
  IOVisualCostants,
14
15
  useIOTheme
15
16
  } from "../../core";
16
17
  import { WithTestID } from "../../utils/types";
17
18
  import { Badge } from "../badge";
18
19
  import { IOIcons, Icon } from "../icons";
19
- import { VSpacer } from "../spacer";
20
+ import { HStack, VStack } from "../stack";
20
21
  import { Chip, LabelSmallAlt } from "../typography";
21
22
  import { ModuleStatic } from "./ModuleStatic";
22
23
  import {
@@ -52,33 +53,45 @@ export const ModuleNavigation = (props: WithTestID<ModuleNavigationProps>) => {
52
53
  const { icon, image, title, subtitle, onPress, badge, ...pressableProps } =
53
54
  props;
54
55
 
55
- const iconComponent = (
56
- <View style={{ marginRight: IOVisualCostants.iconMargin }}>
57
- {icon && <Icon name={icon} size={24} color="grey-300" />}
58
- {image && (
59
- <Image
60
- source={image}
61
- style={styles.image}
62
- accessibilityIgnoresInvertColors={true}
63
- />
64
- )}
65
- </View>
56
+ const iconComponent = icon && (
57
+ <Icon
58
+ name={icon}
59
+ size={IOSelectionListItemVisualParams.iconSize}
60
+ color="grey-300"
61
+ />
62
+ );
63
+
64
+ const imageComponent = image && (
65
+ <Image
66
+ source={image}
67
+ style={styles.image}
68
+ accessibilityIgnoresInvertColors={true}
69
+ />
66
70
  );
67
71
 
68
72
  return (
69
73
  <PressableModuleBase {...pressableProps} onPress={onPress}>
70
- {(icon || image) && iconComponent}
71
- <View style={{ flexGrow: 1, flexShrink: 1, paddingRight: 8 }}>
72
- <LabelSmallAlt
73
- color={theme["interactiveElem-default"]}
74
- numberOfLines={2}
75
- lineBreakMode="middle"
74
+ <HStack space={8} style={{ alignItems: "center" }}>
75
+ <HStack
76
+ space={IOVisualCostants.iconMargin as IOSpacer}
77
+ style={{ alignItems: "center", flexGrow: 1, flexShrink: 1 }}
76
78
  >
77
- {title}
78
- </LabelSmallAlt>
79
- {subtitle && <Chip color={theme["textBody-tertiary"]}>{subtitle}</Chip>}
80
- </View>
81
- <View>
79
+ {iconComponent ?? imageComponent}
80
+
81
+ <View style={{ flexShrink: 1 }}>
82
+ <LabelSmallAlt
83
+ color={theme["interactiveElem-default"]}
84
+ numberOfLines={2}
85
+ lineBreakMode="middle"
86
+ style={{ flexShrink: 1 }}
87
+ >
88
+ {title}
89
+ </LabelSmallAlt>
90
+ {subtitle && (
91
+ <Chip color={theme["textBody-tertiary"]}>{subtitle}</Chip>
92
+ )}
93
+ </View>
94
+ </HStack>
82
95
  {badge ? (
83
96
  <Badge {...badge} />
84
97
  ) : onPress ? (
@@ -88,7 +101,7 @@ export const ModuleNavigation = (props: WithTestID<ModuleNavigationProps>) => {
88
101
  size={IOListItemVisualParams.chevronSize}
89
102
  />
90
103
  ) : null}
91
- </View>
104
+ </HStack>
92
105
  </PressableModuleBase>
93
106
  );
94
107
  };
@@ -96,16 +109,16 @@ export const ModuleNavigation = (props: WithTestID<ModuleNavigationProps>) => {
96
109
  const ModuleNavigationSkeleton = () => (
97
110
  <ModuleStatic
98
111
  startBlock={
99
- <>
100
- <View style={{ marginRight: IOVisualCostants.iconMargin }}>
101
- <Placeholder.Box animate="fade" width={24} height={24} radius={8} />
102
- </View>
103
- <View style={{ paddingRight: 8 }}>
112
+ <HStack
113
+ style={{ alignItems: "center" }}
114
+ space={IOVisualCostants.iconMargin as IOSpacer}
115
+ >
116
+ <Placeholder.Box animate="fade" width={24} height={24} radius={8} />
117
+ <VStack space={4}>
104
118
  <Placeholder.Box animate="fade" width={96} height={16} radius={8} />
105
- <VSpacer size={4} />
106
119
  <Placeholder.Box animate="fade" width={160} height={12} radius={8} />
107
- </View>
108
- </>
120
+ </VStack>
121
+ </HStack>
109
122
  }
110
123
  endBlock={
111
124
  <Placeholder.Box animate="fade" width={64} height={24} radius={16} />
@@ -1,16 +1,12 @@
1
1
  import * as React from "react";
2
2
  import { GestureResponderEvent, StyleSheet, View } from "react-native";
3
3
  import Placeholder from "rn-placeholder";
4
- import {
5
- IOListItemVisualParams,
6
- useIOExperimentalDesign,
7
- useIOTheme
8
- } from "../../core";
4
+ import { IOListItemVisualParams, IOSpacer, useIOTheme } from "../../core";
9
5
  import { getAccessibleAmountText } from "../../utils/accessibility";
10
6
  import { WithTestID } from "../../utils/types";
11
7
  import { Badge } from "../badge";
12
8
  import { Icon } from "../icons";
13
- import { VSpacer } from "../spacer";
9
+ import { HStack, VStack } from "../stack";
14
10
  import { H6, LabelSmall, LabelSmallAlt } from "../typography";
15
11
  import { ModuleStatic } from "./ModuleStatic";
16
12
  import { PressableModuleBase } from "./PressableModuleBase";
@@ -46,8 +42,7 @@ export type ModulePaymentNoticeProps = WithTestID<
46
42
  >;
47
43
 
48
44
  const styles = StyleSheet.create({
49
- rightSection: {
50
- marginLeft: IOListItemVisualParams.iconMargin,
45
+ endBlock: {
51
46
  flexDirection: "row",
52
47
  alignItems: "center",
53
48
  justifyContent: "flex-end"
@@ -62,7 +57,6 @@ const ModulePaymentNoticeContent = ({
62
57
  badgeText = ""
63
58
  }: Omit<ModulePaymentNoticeProps, "isLoading" | "onPress" | "testID">) => {
64
59
  const theme = useIOTheme();
65
- const { isExperimental } = useIOExperimentalDesign();
66
60
 
67
61
  const AmountOrBadgeComponent = () => {
68
62
  switch (paymentNoticeStatus) {
@@ -70,7 +64,7 @@ const ModulePaymentNoticeContent = ({
70
64
  return (
71
65
  <H6
72
66
  accessibilityLabel={getAccessibleAmountText(paymentNoticeAmount)}
73
- color={isExperimental ? "blueIO-500" : "blue"}
67
+ color={theme["interactiveElem-default"]}
74
68
  numberOfLines={1}
75
69
  >
76
70
  {paymentNoticeAmount}
@@ -92,8 +86,8 @@ const ModulePaymentNoticeContent = ({
92
86
  };
93
87
 
94
88
  return (
95
- <>
96
- <View style={{ flexGrow: 1, flexShrink: 1, paddingEnd: 8 }}>
89
+ <HStack space={IOListItemVisualParams.iconMargin as IOSpacer}>
90
+ <View style={{ flexGrow: 1, flexShrink: 1 }}>
97
91
  {title && (
98
92
  <LabelSmall
99
93
  numberOfLines={1}
@@ -112,15 +106,15 @@ const ModulePaymentNoticeContent = ({
112
106
  </LabelSmallAlt>
113
107
  )}
114
108
  </View>
115
- <View style={styles.rightSection}>
109
+ <View style={styles.endBlock}>
116
110
  <AmountOrBadgeComponent />
117
111
  <Icon
118
112
  name="chevronRightListItem"
119
- color={isExperimental ? "blueIO-500" : "blue"}
113
+ color={theme["interactiveElem-default"]}
120
114
  size={IOListItemVisualParams.chevronSize}
121
115
  />
122
116
  </View>
123
- </>
117
+ </HStack>
124
118
  );
125
119
  };
126
120
 
@@ -161,17 +155,13 @@ export const ModulePaymentNotice = ({
161
155
  const ModulePaymentNoticeSkeleton = () => (
162
156
  <ModuleStatic
163
157
  startBlock={
164
- <React.Fragment>
165
- {/* Rewrite it using HStack and VStack */}
166
- <View>
167
- <Placeholder.Box animate="fade" radius={8} width={121} height={13} />
168
- <VSpacer size={8} />
169
- <Placeholder.Box animate="fade" radius={8} width={179} height={16} />
170
- </View>
171
- </React.Fragment>
158
+ <VStack space={4}>
159
+ <Placeholder.Box animate="fade" radius={8} width={120} height={12} />
160
+ <Placeholder.Box animate="fade" radius={8} width={180} height={16} />
161
+ </VStack>
172
162
  }
173
163
  endBlock={
174
- <Placeholder.Box animate="fade" radius={16} width={62} height={24} />
164
+ <Placeholder.Box animate="fade" radius={16} width={64} height={24} />
175
165
  }
176
166
  />
177
167
  );
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { PressableProps, View } from "react-native";
3
3
  import { IOColors, IOModuleStyles, useIOTheme } from "../../core";
4
+ import { HStack } from "../stack";
4
5
 
5
6
  type ModuleStaticProps =
6
7
  | ModuleStaticSingleBlockProps
@@ -42,12 +43,14 @@ export const ModuleStatic = ({
42
43
  accessible={false}
43
44
  >
44
45
  {startBlock && (
45
- <React.Fragment>
46
- <View style={{ flexDirection: "row", alignItems: "center" }}>
46
+ <HStack space={8} style={{ alignItems: "center" }}>
47
+ <View
48
+ style={{ flexDirection: "row", alignItems: "center", flexGrow: 1 }}
49
+ >
47
50
  {startBlock}
48
51
  </View>
49
52
  {endBlock}
50
- </React.Fragment>
53
+ </HStack>
51
54
  )}
52
55
 
53
56
  {children}
@@ -1,10 +1,10 @@
1
- import React, { ComponentProps, Fragment, useCallback, useMemo } from "react";
1
+ import React, { ComponentProps, useCallback, useMemo } from "react";
2
2
  import { StyleSheet, View } from "react-native";
3
- import { BiometricsValidType, Optional } from "../../utils/types";
4
3
  import { IONumberPadButtonStyles, IOStyles } from "../../core";
5
- import { VSpacer } from "../spacer";
4
+ import { BiometricsValidType, Optional } from "../../utils/types";
6
5
  import { IconButton } from "../buttons";
7
6
  import { IOIconSizeScale, IOIcons } from "../icons";
7
+ import { VStack } from "../stack";
8
8
  import { NumberButton } from "./NumberButton";
9
9
 
10
10
  type BiometricAuthProps =
@@ -138,21 +138,23 @@ export const NumberPad = ({
138
138
  );
139
139
 
140
140
  // eslint-disable-next-line arrow-body-style
141
- const numberPad = useMemo(() => {
142
- return [
143
- [1, 2, 3],
144
- [4, 5, 6],
145
- [7, 8, 9],
146
- [biometricType, 0, "delete"]
147
- ].map((row, i, self) => (
148
- <Fragment key={i}>
149
- <View style={[IOStyles.rowSpaceBetween, styles.numberPad]}>
150
- {renderButtonsRow(row)}
151
- </View>
152
- {i < self.length - 1 && <VSpacer />}
153
- </Fragment>
154
- ));
155
- }, [biometricType, renderButtonsRow]);
141
+ const numberPad = useMemo(
142
+ () => (
143
+ <VStack space={16}>
144
+ {[
145
+ [1, 2, 3],
146
+ [4, 5, 6],
147
+ [7, 8, 9],
148
+ [biometricType, 0, "delete"]
149
+ ].map((row, i) => (
150
+ <View key={i} style={[IOStyles.rowSpaceBetween, styles.numberPad]}>
151
+ {renderButtonsRow(row)}
152
+ </View>
153
+ ))}
154
+ </VStack>
155
+ ),
156
+ [biometricType, renderButtonsRow]
157
+ );
156
158
 
157
159
  return <View style={IOStyles.horizontalContentPadding}>{numberPad}</View>;
158
160
  };