@pagopa/io-app-design-system 4.2.0 → 4.2.1

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 (48) hide show
  1. package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +1 -1
  2. package/lib/commonjs/components/listitems/ListItemAction.js +2 -1
  3. package/lib/commonjs/components/listitems/ListItemAction.js.map +1 -1
  4. package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js +11 -23
  5. package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js.map +1 -1
  6. package/lib/commonjs/components/listitems/ListItemTransaction.js +2 -3
  7. package/lib/commonjs/components/listitems/ListItemTransaction.js.map +1 -1
  8. package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +32 -74
  9. package/lib/commonjs/components/modules/ModuleCredential.js +35 -28
  10. package/lib/commonjs/components/modules/ModuleCredential.js.map +1 -1
  11. package/lib/commonjs/components/stack/Stack.js +4 -3
  12. package/lib/commonjs/components/stack/Stack.js.map +1 -1
  13. package/lib/commonjs/components/typography/H6.js +1 -1
  14. package/lib/commonjs/components/typography/__test__/__snapshots__/typography.test.tsx.snap +1 -1
  15. package/lib/commonjs/utils/fonts.js +1 -1
  16. package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +1 -1
  17. package/lib/module/components/listitems/ListItemAction.js +2 -1
  18. package/lib/module/components/listitems/ListItemAction.js.map +1 -1
  19. package/lib/module/components/listitems/ListItemRadioWithAmount.js +13 -25
  20. package/lib/module/components/listitems/ListItemRadioWithAmount.js.map +1 -1
  21. package/lib/module/components/listitems/ListItemTransaction.js +2 -3
  22. package/lib/module/components/listitems/ListItemTransaction.js.map +1 -1
  23. package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +32 -74
  24. package/lib/module/components/modules/ModuleCredential.js +36 -29
  25. package/lib/module/components/modules/ModuleCredential.js.map +1 -1
  26. package/lib/module/components/stack/Stack.js +4 -3
  27. package/lib/module/components/stack/Stack.js.map +1 -1
  28. package/lib/module/components/typography/H6.js +1 -1
  29. package/lib/module/components/typography/__test__/__snapshots__/typography.test.tsx.snap +1 -1
  30. package/lib/module/utils/fonts.js +1 -1
  31. package/lib/typescript/components/listitems/ListItemRadioWithAmount.d.ts.map +1 -1
  32. package/lib/typescript/components/listitems/ListItemTransaction.d.ts.map +1 -1
  33. package/lib/typescript/components/modules/ModuleCredential.d.ts +2 -2
  34. package/lib/typescript/components/modules/ModuleCredential.d.ts.map +1 -1
  35. package/lib/typescript/components/stack/Stack.d.ts +4 -3
  36. package/lib/typescript/components/stack/Stack.d.ts.map +1 -1
  37. package/lib/typescript/utils/fonts.d.ts +1 -1
  38. package/package.json +1 -1
  39. package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +1 -1
  40. package/src/components/listitems/ListItemAction.tsx +1 -1
  41. package/src/components/listitems/ListItemRadioWithAmount.tsx +14 -30
  42. package/src/components/listitems/ListItemTransaction.tsx +2 -6
  43. package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +32 -74
  44. package/src/components/modules/ModuleCredential.tsx +49 -39
  45. package/src/components/stack/Stack.tsx +11 -3
  46. package/src/components/typography/H6.tsx +1 -1
  47. package/src/components/typography/__test__/__snapshots__/typography.test.tsx.snap +1 -1
  48. package/src/utils/fonts.ts +1 -1
@@ -3,15 +3,13 @@ import {
3
3
  Image,
4
4
  ImageSourcePropType,
5
5
  ImageURISource,
6
- StyleSheet,
7
- View
6
+ StyleSheet
8
7
  } from "react-native";
9
8
  import Placeholder from "rn-placeholder";
10
9
  import {
11
10
  IOListItemVisualParams,
12
11
  IOSelectionListItemVisualParams,
13
12
  IOSpacer,
14
- IOStyles,
15
13
  IOVisualCostants,
16
14
  useIOTheme
17
15
  } from "../../core";
@@ -43,26 +41,28 @@ type BaseModuleProps = {
43
41
  };
44
42
 
45
43
  type ModuleCredentialProps =
46
- | LoadingModuleProps
47
- | (BaseModuleProps & ImageProps & PressableModuleBaseProps);
44
+ | BaseModuleProps & ImageProps & PressableModuleBaseProps;
48
45
 
49
- const ModuleCredential = (props: WithTestID<ModuleCredentialProps>) => {
50
- const theme = useIOTheme();
51
-
52
- if (props.isLoading) {
53
- return <ModuleCredentialSkeleton />;
54
- }
46
+ const ModuleCredential = (
47
+ props: WithTestID<LoadingModuleProps | ModuleCredentialProps>
48
+ ) =>
49
+ props.isLoading ? (
50
+ <ModuleCredentialSkeleton />
51
+ ) : (
52
+ <ModuleCredentialContent {...props} />
53
+ );
55
54
 
56
- const {
57
- testID,
58
- icon,
59
- image,
60
- label,
61
- onPress,
62
- badge,
63
- isFetching,
64
- ...pressableProps
65
- } = props;
55
+ const ModuleCredentialContent = ({
56
+ testID,
57
+ icon,
58
+ image,
59
+ label,
60
+ onPress,
61
+ badge,
62
+ isFetching,
63
+ ...pressableProps
64
+ }: WithTestID<ModuleCredentialProps>) => {
65
+ const theme = useIOTheme();
66
66
 
67
67
  const iconComponent = icon && (
68
68
  <Icon
@@ -80,6 +80,33 @@ const ModuleCredential = (props: WithTestID<ModuleCredentialProps>) => {
80
80
  />
81
81
  );
82
82
 
83
+ const endComponent = React.useMemo(() => {
84
+ if (isFetching) {
85
+ return (
86
+ <LoadingSpinner
87
+ testID={testID ? `${testID}_activityIndicator` : undefined}
88
+ color={theme["interactiveElem-default"]}
89
+ />
90
+ );
91
+ }
92
+ if (badge) {
93
+ return (
94
+ <Badge {...badge} testID={testID ? `${testID}_badge` : undefined} />
95
+ );
96
+ }
97
+ if (onPress) {
98
+ return (
99
+ <Icon
100
+ testID={testID ? `${testID}_icon` : undefined}
101
+ name="chevronRightListItem"
102
+ color={theme["interactiveElem-default"]}
103
+ size={IOListItemVisualParams.chevronSize}
104
+ />
105
+ );
106
+ }
107
+ return null;
108
+ }, [testID, theme, isFetching, badge, onPress]);
109
+
83
110
  const ModuleContent = () => (
84
111
  <HStack space={8} style={{ alignItems: "center" }}>
85
112
  <HStack
@@ -99,24 +126,7 @@ const ModuleCredential = (props: WithTestID<ModuleCredentialProps>) => {
99
126
  {label}
100
127
  </BodySmall>
101
128
  </HStack>
102
- <View style={IOStyles.row}>
103
- {badge ? (
104
- <Badge {...badge} testID={testID ? `${testID}_badge` : undefined} />
105
- ) : null}
106
- {isFetching ? (
107
- <LoadingSpinner
108
- testID={testID ? `${testID}_activityIndicator` : undefined}
109
- color={theme["interactiveElem-default"]}
110
- />
111
- ) : onPress ? (
112
- <Icon
113
- testID={testID ? `${testID}_icon` : undefined}
114
- name="chevronRightListItem"
115
- color={theme["interactiveElem-default"]}
116
- size={IOListItemVisualParams.chevronSize}
117
- />
118
- ) : null}
119
- </View>
129
+ {endComponent}
120
130
  </HStack>
121
131
  );
122
132
 
@@ -1,5 +1,5 @@
1
1
  import React, { PropsWithChildren } from "react";
2
- import { View, ViewStyle } from "react-native";
2
+ import { View, ViewProps, ViewStyle } from "react-native";
3
3
  import { IOSpacer } from "../../core";
4
4
 
5
5
  type AllowedStyleProps = Pick<
@@ -7,10 +7,16 @@ type AllowedStyleProps = Pick<
7
7
  "alignItems" | "flexShrink" | "flexGrow" | "flex" | "flexWrap" | "width"
8
8
  >;
9
9
 
10
+ type A11YRelatedProps = Pick<
11
+ ViewProps,
12
+ "pointerEvents" | "accessibilityElementsHidden" | "importantForAccessibility"
13
+ >;
14
+
10
15
  type Stack = PropsWithChildren<{
11
16
  space?: IOSpacer;
12
17
  style?: AllowedStyleProps;
13
- }>;
18
+ }> &
19
+ A11YRelatedProps;
14
20
 
15
21
  type BaseStack = Stack & {
16
22
  orientation: "vertical" | "horizontal";
@@ -25,9 +31,11 @@ const Stack = ({
25
31
  space,
26
32
  style,
27
33
  orientation = "vertical",
28
- children
34
+ children,
35
+ ...props
29
36
  }: BaseStack) => (
30
37
  <View
38
+ {...props}
31
39
  style={{
32
40
  display: "flex",
33
41
  flexDirection: orientation === "horizontal" ? "row" : "column",
@@ -11,7 +11,7 @@ export const h6LineHeight = 24;
11
11
  const fontName: IOFontFamily = "Titillio";
12
12
 
13
13
  // TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
14
- const legacyFontSize: IOFontSize = 18;
14
+ const legacyFontSize: IOFontSize = 17;
15
15
  const legacyFontName: IOFontFamily = "TitilliumSansPro";
16
16
 
17
17
  /**
@@ -553,7 +553,7 @@ exports[`Test Typography Components H6 Snapshot 1`] = `
553
553
  {
554
554
  "color": "#0E0F13",
555
555
  "fontFamily": "Titillium Sans Pro",
556
- "fontSize": 18,
556
+ "fontSize": 17,
557
557
  "fontStyle": "normal",
558
558
  "fontWeight": "600",
559
559
  "lineHeight": 24,
@@ -36,7 +36,7 @@ export type IOFontFamily = keyof typeof fonts;
36
36
  * Font Sizes
37
37
  */
38
38
  const fontSizes = [12, 14, 16, 20, 22, 26, 28, 32] as const;
39
- const fontSizesLegacy = [18, 28, 31, 35] as const;
39
+ const fontSizesLegacy = [17, 28, 31, 35] as const;
40
40
  const allFontSizes = [...new Set([...fontSizes, ...fontSizesLegacy])];
41
41
  export type IOFontSize = (typeof allFontSizes)[number];
42
42