@pagopa/io-app-design-system 1.38.0 → 1.38.2

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/badge/Badge.js +78 -78
  2. package/lib/commonjs/components/badge/Badge.js.map +1 -1
  3. package/lib/commonjs/components/listitems/ListItemHeader.js +0 -1
  4. package/lib/commonjs/components/listitems/ListItemHeader.js.map +1 -1
  5. package/lib/commonjs/components/listitems/ListItemRadio.js +2 -1
  6. package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -1
  7. package/lib/commonjs/components/modules/ModuleAttachment.js +4 -5
  8. package/lib/commonjs/components/modules/ModuleAttachment.js.map +1 -1
  9. package/lib/commonjs/components/modules/ModuleCredential.js +1 -1
  10. package/lib/commonjs/components/modules/ModuleCredential.js.map +1 -1
  11. package/lib/commonjs/components/modules/ModuleNavigation.js +1 -1
  12. package/lib/commonjs/components/modules/ModuleNavigation.js.map +1 -1
  13. package/lib/commonjs/components/modules/ModulePaymentNotice.js +3 -4
  14. package/lib/commonjs/components/modules/ModulePaymentNotice.js.map +1 -1
  15. package/lib/commonjs/components/searchInput/SearchInput.js +1 -1
  16. package/lib/commonjs/components/typography/LabelSmall.js.map +1 -1
  17. package/lib/module/components/badge/Badge.js +78 -77
  18. package/lib/module/components/badge/Badge.js.map +1 -1
  19. package/lib/module/components/listitems/ListItemHeader.js +0 -1
  20. package/lib/module/components/listitems/ListItemHeader.js.map +1 -1
  21. package/lib/module/components/listitems/ListItemRadio.js +2 -1
  22. package/lib/module/components/listitems/ListItemRadio.js.map +1 -1
  23. package/lib/module/components/modules/ModuleAttachment.js +5 -6
  24. package/lib/module/components/modules/ModuleAttachment.js.map +1 -1
  25. package/lib/module/components/modules/ModuleCredential.js +1 -1
  26. package/lib/module/components/modules/ModuleCredential.js.map +1 -1
  27. package/lib/module/components/modules/ModuleNavigation.js +1 -1
  28. package/lib/module/components/modules/ModuleNavigation.js.map +1 -1
  29. package/lib/module/components/modules/ModulePaymentNotice.js +3 -4
  30. package/lib/module/components/modules/ModulePaymentNotice.js.map +1 -1
  31. package/lib/module/components/searchInput/SearchInput.js +1 -1
  32. package/lib/module/components/typography/LabelSmall.js.map +1 -1
  33. package/lib/typescript/components/badge/Badge.d.ts.map +1 -1
  34. package/lib/typescript/components/listitems/ListItemRadio.d.ts.map +1 -1
  35. package/lib/typescript/components/modules/ModuleAttachment.d.ts.map +1 -1
  36. package/lib/typescript/components/modules/ModulePaymentNotice.d.ts.map +1 -1
  37. package/lib/typescript/components/typography/LabelSmall.d.ts +2 -2
  38. package/lib/typescript/components/typography/LabelSmall.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/src/components/badge/Badge.tsx +90 -85
  41. package/src/components/listitems/ListItemHeader.tsx +1 -1
  42. package/src/components/listitems/ListItemRadio.tsx +4 -1
  43. package/src/components/modules/ModuleAttachment.tsx +10 -7
  44. package/src/components/modules/ModuleCredential.tsx +1 -1
  45. package/src/components/modules/ModuleNavigation.tsx +1 -1
  46. package/src/components/modules/ModulePaymentNotice.tsx +2 -1
  47. package/src/components/searchInput/SearchInput.tsx +1 -1
  48. package/src/components/typography/LabelSmall.tsx +2 -3
@@ -1,11 +1,12 @@
1
- import React, { useMemo } from "react";
1
+ import React from "react";
2
2
  import { Platform, StyleSheet, Text, View } from "react-native";
3
3
  import {
4
4
  IOBadgeHSpacing,
5
5
  IOBadgeRadius,
6
6
  IOBadgeVSpacing,
7
7
  IOColors,
8
- useIOExperimentalDesign
8
+ useIOExperimentalDesign,
9
+ useIOTheme
9
10
  } from "../../core";
10
11
  import { makeFontStyleObject } from "../../utils/fonts";
11
12
  import { WithTestID } from "../../utils/types";
@@ -31,90 +32,11 @@ type SolidVariantProps = {
31
32
  foreground: IOColors;
32
33
  };
33
34
 
34
- const mapVariants: Record<NonNullable<Badge["variant"]>, SolidVariantProps> = {
35
- default: {
36
- foreground: "grey-700",
37
- background: "grey-50"
38
- },
39
- info: {
40
- foreground: "info-850",
41
- background: "info-100"
42
- },
43
- warning: {
44
- foreground: "warning-850",
45
- background: "warning-100"
46
- },
47
- success: {
48
- foreground: "success-850",
49
- background: "success-100"
50
- },
51
- error: {
52
- foreground: "error-850",
53
- background: "error-100"
54
- },
55
- purple: {
56
- foreground: "hanPurple-850",
57
- background: "hanPurple-100"
58
- },
59
- lightBlue: {
60
- foreground: "blueIO-850",
61
- background: "blueIO-50"
62
- },
63
- blue: {
64
- foreground: "white",
65
- background: "blueIO-500"
66
- },
67
- turquoise: {
68
- foreground: "turquoise-850",
69
- background: "turquoise-50"
70
- },
71
- contrast: {
72
- foreground: "grey-700",
73
- background: "white"
74
- }
75
- };
76
-
77
35
  type OutlinedVariantProps = {
78
36
  foreground: IOColors;
79
37
  background?: never;
80
38
  };
81
39
 
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
-
118
40
  const styles = StyleSheet.create({
119
41
  badge: {
120
42
  flexDirection: "row",
@@ -151,10 +73,93 @@ const styles = StyleSheet.create({
151
73
  */
152
74
  export const Badge = ({ text, outline = false, variant, testID }: Badge) => {
153
75
  const { isExperimental } = useIOExperimentalDesign();
154
- const { background, foreground } = useMemo(
155
- () => (outline ? mapOutlineVariants : mapVariants)[variant],
156
- [outline, variant]
157
- );
76
+ const theme = useIOTheme();
77
+
78
+ const mapVariants: Record<
79
+ NonNullable<Badge["variant"]>,
80
+ SolidVariantProps
81
+ > = {
82
+ default: {
83
+ foreground: "grey-700",
84
+ background: "grey-50"
85
+ },
86
+ info: {
87
+ foreground: "info-850",
88
+ background: "info-100"
89
+ },
90
+ warning: {
91
+ foreground: "warning-850",
92
+ background: "warning-100"
93
+ },
94
+ success: {
95
+ foreground: "success-850",
96
+ background: "success-100"
97
+ },
98
+ error: {
99
+ foreground: "error-850",
100
+ background: "error-100"
101
+ },
102
+ purple: {
103
+ foreground: "hanPurple-850",
104
+ background: "hanPurple-100"
105
+ },
106
+ lightBlue: {
107
+ foreground: "blueIO-850",
108
+ background: "blueIO-50"
109
+ },
110
+ blue: {
111
+ foreground: "white",
112
+ background: theme["interactiveElem-default"]
113
+ },
114
+ turquoise: {
115
+ foreground: "turquoise-850",
116
+ background: "turquoise-50"
117
+ },
118
+ contrast: {
119
+ foreground: "grey-700",
120
+ background: "white"
121
+ }
122
+ };
123
+
124
+ const mapOutlineVariants: Record<
125
+ NonNullable<Badge["variant"]>,
126
+ OutlinedVariantProps
127
+ > = {
128
+ default: {
129
+ foreground: "grey-700"
130
+ },
131
+ info: {
132
+ foreground: "info-850"
133
+ },
134
+ warning: {
135
+ foreground: "warning-850"
136
+ },
137
+ success: {
138
+ foreground: "success-850"
139
+ },
140
+ error: {
141
+ foreground: "error-850"
142
+ },
143
+ purple: {
144
+ foreground: "hanPurple-850"
145
+ },
146
+ lightBlue: {
147
+ foreground: "blueIO-850"
148
+ },
149
+ blue: {
150
+ foreground: theme["interactiveElem-default"]
151
+ },
152
+ turquoise: {
153
+ foreground: "turquoise-850"
154
+ },
155
+ contrast: {
156
+ foreground: "grey-850"
157
+ }
158
+ };
159
+
160
+ const { background, foreground } = (
161
+ outline ? mapOutlineVariants : mapVariants
162
+ )[variant];
158
163
 
159
164
  return (
160
165
  <View
@@ -79,7 +79,7 @@ export const ListItemHeader = ({
79
79
  endElement !== undefined && endElement.type !== "badge"
80
80
  }
81
81
  >
82
- <H6 role="heading" weight="Regular" color={theme["textBody-tertiary"]}>
82
+ <H6 role="heading" color={theme["textBody-tertiary"]}>
83
83
  {label}
84
84
  </H6>
85
85
  </View>
@@ -274,7 +274,10 @@ export const ListItemRadio = ({
274
274
  </H6>
275
275
  </View>
276
276
  <HSpacer size={8} />
277
- <View pointerEvents="none">
277
+ <View
278
+ pointerEvents="none"
279
+ importantForAccessibility="no-hide-descendants"
280
+ >
278
281
  <AnimatedRadio checked={selected ?? toggleValue} />
279
282
  </View>
280
283
  </View>
@@ -27,7 +27,7 @@ import { Badge } from "../badge";
27
27
  import { Icon } from "../icons";
28
28
  import { LoadingSpinner } from "../loadingSpinner";
29
29
  import { VSpacer } from "../spacer";
30
- import { LabelSmall } from "../typography";
30
+ import { LabelSmallAlt } from "../typography";
31
31
 
32
32
  type PartialProps = WithTestID<{
33
33
  title: string;
@@ -88,7 +88,12 @@ const ModuleAttachmentContent = ({
88
88
  const activityIndicatorTestId = testID
89
89
  ? `${testID}_activityIndicator`
90
90
  : undefined;
91
- return <LoadingSpinner testID={activityIndicatorTestId} />;
91
+ return (
92
+ <LoadingSpinner
93
+ testID={activityIndicatorTestId}
94
+ color={theme["interactiveElem-default"]}
95
+ />
96
+ );
92
97
  }
93
98
 
94
99
  return (
@@ -103,14 +108,12 @@ const ModuleAttachmentContent = ({
103
108
  return (
104
109
  <>
105
110
  <View style={styles.innerContent}>
106
- <LabelSmall
111
+ <LabelSmallAlt
107
112
  numberOfLines={1}
108
- weight="SemiBold"
109
- font="ReadexPro"
110
- color="blueIO-500"
113
+ color={theme["interactiveElem-default"]}
111
114
  >
112
115
  {title}
113
- </LabelSmall>
116
+ </LabelSmallAlt>
114
117
  <VSpacer size={4} />
115
118
  <View style={{ width: 44 }}>
116
119
  <Badge text={format.toUpperCase()} variant="default" />
@@ -68,7 +68,7 @@ const ModuleCredential = (props: WithTestID<ModuleCredentialProps>) => {
68
68
  {(icon || image) && iconComponent}
69
69
  <View style={{ flexGrow: 1, flexShrink: 1, paddingRight: 8 }}>
70
70
  <LabelSmallAlt
71
- color="blueIO-500"
71
+ color={theme["interactiveElem-default"]}
72
72
  numberOfLines={2}
73
73
  lineBreakMode="middle"
74
74
  >
@@ -71,7 +71,7 @@ export const ModuleNavigation = (props: WithTestID<ModuleNavigationProps>) => {
71
71
  {(icon || image) && iconComponent}
72
72
  <View style={{ flexGrow: 1, flexShrink: 1, paddingRight: 8 }}>
73
73
  <LabelSmallAlt
74
- color="blueIO-500"
74
+ color={theme["interactiveElem-default"]}
75
75
  numberOfLines={2}
76
76
  lineBreakMode="middle"
77
77
  >
@@ -70,6 +70,7 @@ const ModulePaymentNoticeContent = ({
70
70
  <H6
71
71
  accessibilityLabel={getAccessibleAmountText(paymentNoticeAmount)}
72
72
  color={isExperimental ? "blueIO-500" : "blue"}
73
+ numberOfLines={1}
73
74
  >
74
75
  {paymentNoticeAmount}
75
76
  </H6>
@@ -107,7 +108,7 @@ const ModulePaymentNoticeContent = ({
107
108
  </LabelSmall>
108
109
  )}
109
110
  </View>
110
- <View style={[styles.rightSection, { flexShrink: 1 }]}>
111
+ <View style={styles.rightSection}>
111
112
  <AmountOrBadgeComponent />
112
113
  <Icon
113
114
  name="chevronRightListItem"
@@ -45,7 +45,7 @@ const iconMargin: IOSpacingScale = 8;
45
45
  const iconColor: IOColors = "grey-700";
46
46
  const iconSize: IOIconSizeScale = 16;
47
47
  const iconCloseSize: IOIconSizeScale = 24;
48
- const inputFontSizePlaceholder: number = 12;
48
+ const inputFontSizePlaceholder: number = 14;
49
49
  const cancelButtonMargin: IOSpacingScale = 16;
50
50
  const inputTransitionDuration: number = 250;
51
51
  const inputHeightIOS: number = 36;
@@ -3,7 +3,7 @@ import { View } from "react-native";
3
3
  import { IOColors, IOTheme, useIOExperimentalDesign } from "../../core";
4
4
  import { FontFamily, IOFontWeight } from "../../utils/fonts";
5
5
  import { useTypographyFactory } from "./Factory";
6
- import { ExternalTypographyProps, FontType, TypographyProps } from "./common";
6
+ import { ExternalTypographyProps, TypographyProps } from "./common";
7
7
 
8
8
  type PartialAllowedColors = Extract<
9
9
  IOColors,
@@ -24,8 +24,7 @@ type AllowedFontSize = { fontSize?: FontSize };
24
24
  type LabelSmallProps = ExternalTypographyProps<
25
25
  TypographyProps<AllowedWeight, AllowedColors>
26
26
  > &
27
- AllowedFontSize &
28
- FontType;
27
+ AllowedFontSize;
29
28
 
30
29
  const fontName: FontFamily = "TitilliumSansPro";
31
30
  const legacyFontName: FontFamily = "TitilliumWeb";