@pagopa/io-app-design-system 1.33.0 → 1.35.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 (260) hide show
  1. package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +2 -0
  2. package/lib/commonjs/components/buttons/ButtonLink.js +4 -1
  3. package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
  4. package/lib/commonjs/components/buttons/ButtonOutline.js +4 -1
  5. package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
  6. package/lib/commonjs/components/buttons/ButtonSolid.js +8 -5
  7. package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
  8. package/lib/commonjs/components/buttons/IconButton.js +4 -1
  9. package/lib/commonjs/components/buttons/IconButton.js.map +1 -1
  10. package/lib/commonjs/components/buttons/IconButtonContained.js +3 -0
  11. package/lib/commonjs/components/buttons/IconButtonContained.js.map +1 -1
  12. package/lib/commonjs/components/buttons/IconButtonSolid.js +3 -0
  13. package/lib/commonjs/components/buttons/IconButtonSolid.js.map +1 -1
  14. package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +2 -0
  15. package/lib/commonjs/components/icons/svg/IconCategCulture.js +1 -7
  16. package/lib/commonjs/components/icons/svg/IconCategCulture.js.map +1 -1
  17. package/lib/commonjs/components/icons/svg/IconCategFinance.js +3 -4
  18. package/lib/commonjs/components/icons/svg/IconCategFinance.js.map +1 -1
  19. package/lib/commonjs/components/icons/svg/IconCategHome.js +3 -4
  20. package/lib/commonjs/components/icons/svg/IconCategHome.js.map +1 -1
  21. package/lib/commonjs/components/icons/svg/IconCategJobOffers.js +3 -1
  22. package/lib/commonjs/components/icons/svg/IconCategJobOffers.js.map +1 -1
  23. package/lib/commonjs/components/icons/svg/IconCategLearning.js +3 -1
  24. package/lib/commonjs/components/icons/svg/IconCategLearning.js.map +1 -1
  25. package/lib/commonjs/components/icons/svg/IconCategMobility.js +3 -1
  26. package/lib/commonjs/components/icons/svg/IconCategMobility.js.map +1 -1
  27. package/lib/commonjs/components/icons/svg/IconCategSport.js +1 -1
  28. package/lib/commonjs/components/icons/svg/IconCategSport.js.map +1 -1
  29. package/lib/commonjs/components/icons/svg/IconCategTelco.js +3 -9
  30. package/lib/commonjs/components/icons/svg/IconCategTelco.js.map +1 -1
  31. package/lib/commonjs/components/icons/svg/IconCategTravel.js +1 -6
  32. package/lib/commonjs/components/icons/svg/IconCategTravel.js.map +1 -1
  33. package/lib/commonjs/components/icons/svg/IconCategWellness.js +3 -4
  34. package/lib/commonjs/components/icons/svg/IconCategWellness.js.map +1 -1
  35. package/lib/commonjs/components/icons/svg/originals/IconCategCulture.svg +1 -14
  36. package/lib/commonjs/components/icons/svg/originals/IconCategFinance.svg +1 -10
  37. package/lib/commonjs/components/icons/svg/originals/IconCategHome.svg +1 -10
  38. package/lib/commonjs/components/icons/svg/originals/IconCategJobOffers.svg +1 -6
  39. package/lib/commonjs/components/icons/svg/originals/IconCategLearning.svg +1 -6
  40. package/lib/commonjs/components/icons/svg/originals/IconCategMobility.svg +1 -6
  41. package/lib/commonjs/components/icons/svg/originals/IconCategSport.svg +1 -8
  42. package/lib/commonjs/components/icons/svg/originals/IconCategTelco.svg +1 -13
  43. package/lib/commonjs/components/icons/svg/originals/IconCategTravel.svg +1 -12
  44. package/lib/commonjs/components/icons/svg/originals/IconCategWellness.svg +1 -10
  45. package/lib/commonjs/components/index.js +42 -31
  46. package/lib/commonjs/components/index.js.map +1 -1
  47. package/lib/commonjs/components/listitems/ListItemAction.js +1 -1
  48. package/lib/commonjs/components/listitems/ListItemCheckbox.js +7 -4
  49. package/lib/commonjs/components/listitems/ListItemCheckbox.js.map +1 -1
  50. package/lib/commonjs/components/listitems/ListItemNav.js +5 -0
  51. package/lib/commonjs/components/listitems/ListItemNav.js.map +1 -1
  52. package/lib/commonjs/components/listitems/ListItemRadio.js +4 -3
  53. package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -1
  54. package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js +23 -9
  55. package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js.map +1 -1
  56. package/lib/commonjs/components/listitems/ListItemSwitch.js +5 -1
  57. package/lib/commonjs/components/listitems/ListItemSwitch.js.map +1 -1
  58. package/lib/commonjs/components/listitems/PressableListItemsBase.js +7 -6
  59. package/lib/commonjs/components/listitems/PressableListItemsBase.js.map +1 -1
  60. package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +12 -12
  61. package/lib/commonjs/components/modules/ModuleAttachment.js +6 -3
  62. package/lib/commonjs/components/modules/ModuleAttachment.js.map +1 -1
  63. package/lib/commonjs/components/modules/ModuleCheckout.js +37 -36
  64. package/lib/commonjs/components/modules/ModuleCheckout.js.map +1 -1
  65. package/lib/commonjs/components/modules/ModuleCredential.js.map +1 -1
  66. package/lib/commonjs/components/modules/PressableModuleBase.js +5 -3
  67. package/lib/commonjs/components/modules/PressableModuleBase.js.map +1 -1
  68. package/lib/commonjs/components/radio/RadioButtonLabel.js +10 -9
  69. package/lib/commonjs/components/radio/RadioButtonLabel.js.map +1 -1
  70. package/lib/commonjs/components/radio/RadioGroup.js +7 -2
  71. package/lib/commonjs/components/radio/RadioGroup.js.map +1 -1
  72. package/lib/commonjs/components/spacer/Spacer.js.map +1 -1
  73. package/lib/commonjs/components/stack/Stack.js +47 -0
  74. package/lib/commonjs/components/stack/Stack.js.map +1 -0
  75. package/lib/commonjs/components/stack/index.js +17 -0
  76. package/lib/commonjs/components/stack/index.js.map +1 -0
  77. package/lib/commonjs/components/tabs/TabItem.js +59 -7
  78. package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
  79. package/lib/commonjs/components/tabs/TabNavigation.js +2 -7
  80. package/lib/commonjs/components/tabs/TabNavigation.js.map +1 -1
  81. package/lib/commonjs/core/IOColors.js +7 -7
  82. package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +2 -0
  83. package/lib/module/components/buttons/ButtonLink.js +4 -1
  84. package/lib/module/components/buttons/ButtonLink.js.map +1 -1
  85. package/lib/module/components/buttons/ButtonOutline.js +4 -1
  86. package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
  87. package/lib/module/components/buttons/ButtonSolid.js +8 -5
  88. package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
  89. package/lib/module/components/buttons/IconButton.js +4 -1
  90. package/lib/module/components/buttons/IconButton.js.map +1 -1
  91. package/lib/module/components/buttons/IconButtonContained.js +3 -0
  92. package/lib/module/components/buttons/IconButtonContained.js.map +1 -1
  93. package/lib/module/components/buttons/IconButtonSolid.js +3 -0
  94. package/lib/module/components/buttons/IconButtonSolid.js.map +1 -1
  95. package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +2 -0
  96. package/lib/module/components/icons/svg/IconCategCulture.js +1 -7
  97. package/lib/module/components/icons/svg/IconCategCulture.js.map +1 -1
  98. package/lib/module/components/icons/svg/IconCategFinance.js +3 -4
  99. package/lib/module/components/icons/svg/IconCategFinance.js.map +1 -1
  100. package/lib/module/components/icons/svg/IconCategHome.js +3 -4
  101. package/lib/module/components/icons/svg/IconCategHome.js.map +1 -1
  102. package/lib/module/components/icons/svg/IconCategJobOffers.js +3 -1
  103. package/lib/module/components/icons/svg/IconCategJobOffers.js.map +1 -1
  104. package/lib/module/components/icons/svg/IconCategLearning.js +3 -1
  105. package/lib/module/components/icons/svg/IconCategLearning.js.map +1 -1
  106. package/lib/module/components/icons/svg/IconCategMobility.js +3 -1
  107. package/lib/module/components/icons/svg/IconCategMobility.js.map +1 -1
  108. package/lib/module/components/icons/svg/IconCategSport.js +1 -1
  109. package/lib/module/components/icons/svg/IconCategSport.js.map +1 -1
  110. package/lib/module/components/icons/svg/IconCategTelco.js +3 -9
  111. package/lib/module/components/icons/svg/IconCategTelco.js.map +1 -1
  112. package/lib/module/components/icons/svg/IconCategTravel.js +1 -6
  113. package/lib/module/components/icons/svg/IconCategTravel.js.map +1 -1
  114. package/lib/module/components/icons/svg/IconCategWellness.js +3 -4
  115. package/lib/module/components/icons/svg/IconCategWellness.js.map +1 -1
  116. package/lib/module/components/icons/svg/originals/IconCategCulture.svg +1 -14
  117. package/lib/module/components/icons/svg/originals/IconCategFinance.svg +1 -10
  118. package/lib/module/components/icons/svg/originals/IconCategHome.svg +1 -10
  119. package/lib/module/components/icons/svg/originals/IconCategJobOffers.svg +1 -6
  120. package/lib/module/components/icons/svg/originals/IconCategLearning.svg +1 -6
  121. package/lib/module/components/icons/svg/originals/IconCategMobility.svg +1 -6
  122. package/lib/module/components/icons/svg/originals/IconCategSport.svg +1 -8
  123. package/lib/module/components/icons/svg/originals/IconCategTelco.svg +1 -13
  124. package/lib/module/components/icons/svg/originals/IconCategTravel.svg +1 -12
  125. package/lib/module/components/icons/svg/originals/IconCategWellness.svg +1 -10
  126. package/lib/module/components/index.js +5 -4
  127. package/lib/module/components/index.js.map +1 -1
  128. package/lib/module/components/listitems/ListItemAction.js +1 -1
  129. package/lib/module/components/listitems/ListItemCheckbox.js +7 -4
  130. package/lib/module/components/listitems/ListItemCheckbox.js.map +1 -1
  131. package/lib/module/components/listitems/ListItemNav.js +5 -0
  132. package/lib/module/components/listitems/ListItemNav.js.map +1 -1
  133. package/lib/module/components/listitems/ListItemRadio.js +4 -3
  134. package/lib/module/components/listitems/ListItemRadio.js.map +1 -1
  135. package/lib/module/components/listitems/ListItemRadioWithAmount.js +23 -9
  136. package/lib/module/components/listitems/ListItemRadioWithAmount.js.map +1 -1
  137. package/lib/module/components/listitems/ListItemSwitch.js +5 -1
  138. package/lib/module/components/listitems/ListItemSwitch.js.map +1 -1
  139. package/lib/module/components/listitems/PressableListItemsBase.js +7 -6
  140. package/lib/module/components/listitems/PressableListItemsBase.js.map +1 -1
  141. package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +12 -12
  142. package/lib/module/components/modules/ModuleAttachment.js +6 -3
  143. package/lib/module/components/modules/ModuleAttachment.js.map +1 -1
  144. package/lib/module/components/modules/ModuleCheckout.js +39 -40
  145. package/lib/module/components/modules/ModuleCheckout.js.map +1 -1
  146. package/lib/module/components/modules/ModuleCredential.js.map +1 -1
  147. package/lib/module/components/modules/PressableModuleBase.js +5 -3
  148. package/lib/module/components/modules/PressableModuleBase.js.map +1 -1
  149. package/lib/module/components/radio/RadioButtonLabel.js +10 -9
  150. package/lib/module/components/radio/RadioButtonLabel.js.map +1 -1
  151. package/lib/module/components/radio/RadioGroup.js +7 -2
  152. package/lib/module/components/radio/RadioGroup.js.map +1 -1
  153. package/lib/module/components/spacer/Spacer.js.map +1 -1
  154. package/lib/module/components/stack/Stack.js +39 -0
  155. package/lib/module/components/stack/Stack.js.map +1 -0
  156. package/lib/module/components/stack/index.js +2 -0
  157. package/lib/module/components/stack/index.js.map +1 -0
  158. package/lib/module/components/tabs/TabItem.js +60 -7
  159. package/lib/module/components/tabs/TabItem.js.map +1 -1
  160. package/lib/module/components/tabs/TabNavigation.js +2 -7
  161. package/lib/module/components/tabs/TabNavigation.js.map +1 -1
  162. package/lib/module/core/IOColors.js +7 -7
  163. package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
  164. package/lib/typescript/components/buttons/ButtonOutline.d.ts +4 -10
  165. package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
  166. package/lib/typescript/components/buttons/ButtonSolid.d.ts +4 -16
  167. package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
  168. package/lib/typescript/components/buttons/IconButton.d.ts.map +1 -1
  169. package/lib/typescript/components/buttons/IconButtonContained.d.ts +1 -1
  170. package/lib/typescript/components/buttons/IconButtonContained.d.ts.map +1 -1
  171. package/lib/typescript/components/buttons/IconButtonSolid.d.ts.map +1 -1
  172. package/lib/typescript/components/icons/svg/IconCategCulture.d.ts.map +1 -1
  173. package/lib/typescript/components/icons/svg/IconCategFinance.d.ts.map +1 -1
  174. package/lib/typescript/components/icons/svg/IconCategHome.d.ts.map +1 -1
  175. package/lib/typescript/components/icons/svg/IconCategJobOffers.d.ts.map +1 -1
  176. package/lib/typescript/components/icons/svg/IconCategLearning.d.ts.map +1 -1
  177. package/lib/typescript/components/icons/svg/IconCategMobility.d.ts.map +1 -1
  178. package/lib/typescript/components/icons/svg/IconCategTelco.d.ts +2 -2
  179. package/lib/typescript/components/icons/svg/IconCategTelco.d.ts.map +1 -1
  180. package/lib/typescript/components/icons/svg/IconCategTravel.d.ts.map +1 -1
  181. package/lib/typescript/components/icons/svg/IconCategWellness.d.ts.map +1 -1
  182. package/lib/typescript/components/index.d.ts +5 -4
  183. package/lib/typescript/components/index.d.ts.map +1 -1
  184. package/lib/typescript/components/listitems/ListItemCheckbox.d.ts +2 -2
  185. package/lib/typescript/components/listitems/ListItemCheckbox.d.ts.map +1 -1
  186. package/lib/typescript/components/listitems/ListItemNav.d.ts +4 -5
  187. package/lib/typescript/components/listitems/ListItemNav.d.ts.map +1 -1
  188. package/lib/typescript/components/listitems/ListItemRadio.d.ts +2 -2
  189. package/lib/typescript/components/listitems/ListItemRadio.d.ts.map +1 -1
  190. package/lib/typescript/components/listitems/ListItemRadioWithAmount.d.ts +4 -2
  191. package/lib/typescript/components/listitems/ListItemRadioWithAmount.d.ts.map +1 -1
  192. package/lib/typescript/components/listitems/ListItemSwitch.d.ts.map +1 -1
  193. package/lib/typescript/components/listitems/PressableListItemsBase.d.ts +3 -5
  194. package/lib/typescript/components/listitems/PressableListItemsBase.d.ts.map +1 -1
  195. package/lib/typescript/components/modules/ModuleCheckout.d.ts +19 -11
  196. package/lib/typescript/components/modules/ModuleCheckout.d.ts.map +1 -1
  197. package/lib/typescript/components/modules/ModuleCredential.d.ts +1 -1
  198. package/lib/typescript/components/modules/ModuleCredential.d.ts.map +1 -1
  199. package/lib/typescript/components/modules/PressableModuleBase.d.ts +4 -5
  200. package/lib/typescript/components/modules/PressableModuleBase.d.ts.map +1 -1
  201. package/lib/typescript/components/radio/RadioButtonLabel.d.ts +2 -2
  202. package/lib/typescript/components/radio/RadioButtonLabel.d.ts.map +1 -1
  203. package/lib/typescript/components/radio/RadioGroup.d.ts.map +1 -1
  204. package/lib/typescript/components/stack/Stack.d.ts +18 -0
  205. package/lib/typescript/components/stack/Stack.d.ts.map +1 -0
  206. package/lib/typescript/components/stack/index.d.ts +2 -0
  207. package/lib/typescript/components/stack/index.d.ts.map +1 -0
  208. package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -1
  209. package/lib/typescript/components/tabs/TabNavigation.d.ts +1 -1
  210. package/lib/typescript/components/tabs/TabNavigation.d.ts.map +1 -1
  211. package/package.json +1 -1
  212. package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +2 -0
  213. package/src/components/buttons/ButtonLink.tsx +2 -1
  214. package/src/components/buttons/ButtonOutline.tsx +18 -15
  215. package/src/components/buttons/ButtonSolid.tsx +35 -32
  216. package/src/components/buttons/IconButton.tsx +1 -0
  217. package/src/components/buttons/IconButtonContained.tsx +2 -1
  218. package/src/components/buttons/IconButtonSolid.tsx +1 -0
  219. package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +2 -0
  220. package/src/components/icons/svg/IconCategCulture.tsx +1 -9
  221. package/src/components/icons/svg/IconCategFinance.tsx +3 -5
  222. package/src/components/icons/svg/IconCategHome.tsx +3 -5
  223. package/src/components/icons/svg/IconCategJobOffers.tsx +3 -1
  224. package/src/components/icons/svg/IconCategLearning.tsx +3 -1
  225. package/src/components/icons/svg/IconCategMobility.tsx +3 -1
  226. package/src/components/icons/svg/IconCategSport.tsx +1 -1
  227. package/src/components/icons/svg/IconCategTelco.tsx +3 -8
  228. package/src/components/icons/svg/IconCategTravel.tsx +1 -7
  229. package/src/components/icons/svg/IconCategWellness.tsx +3 -5
  230. package/src/components/icons/svg/originals/IconCategCulture.svg +1 -14
  231. package/src/components/icons/svg/originals/IconCategFinance.svg +1 -10
  232. package/src/components/icons/svg/originals/IconCategHome.svg +1 -10
  233. package/src/components/icons/svg/originals/IconCategJobOffers.svg +1 -6
  234. package/src/components/icons/svg/originals/IconCategLearning.svg +1 -6
  235. package/src/components/icons/svg/originals/IconCategMobility.svg +1 -6
  236. package/src/components/icons/svg/originals/IconCategSport.svg +1 -8
  237. package/src/components/icons/svg/originals/IconCategTelco.svg +1 -13
  238. package/src/components/icons/svg/originals/IconCategTravel.svg +1 -12
  239. package/src/components/icons/svg/originals/IconCategWellness.svg +1 -10
  240. package/src/components/index.tsx +5 -4
  241. package/src/components/listitems/ListItemAction.tsx +1 -1
  242. package/src/components/listitems/ListItemCheckbox.tsx +12 -6
  243. package/src/components/listitems/ListItemNav.tsx +17 -11
  244. package/src/components/listitems/ListItemRadio.tsx +7 -5
  245. package/src/components/listitems/ListItemRadioWithAmount.tsx +28 -13
  246. package/src/components/listitems/ListItemSwitch.tsx +1 -0
  247. package/src/components/listitems/PressableListItemsBase.tsx +16 -8
  248. package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +12 -12
  249. package/src/components/modules/ModuleAttachment.tsx +4 -3
  250. package/src/components/modules/ModuleCheckout.tsx +65 -50
  251. package/src/components/modules/ModuleCredential.tsx +1 -1
  252. package/src/components/modules/PressableModuleBase.tsx +16 -10
  253. package/src/components/radio/RadioButtonLabel.tsx +16 -11
  254. package/src/components/radio/RadioGroup.tsx +18 -8
  255. package/src/components/spacer/Spacer.tsx +1 -1
  256. package/src/components/stack/Stack.tsx +41 -0
  257. package/src/components/stack/index.tsx +1 -0
  258. package/src/components/tabs/TabItem.tsx +93 -10
  259. package/src/components/tabs/TabNavigation.tsx +2 -10
  260. package/src/core/IOColors.ts +7 -7
@@ -36,12 +36,10 @@ type Props = {
36
36
 
37
37
  const DISABLED_OPACITY = 0.5;
38
38
 
39
- // disabled: the component is no longer touchable
40
- // onPress:
41
- type OwnProps = Props &
39
+ type ListItemCheckboxProps = Props &
42
40
  Pick<
43
41
  React.ComponentProps<typeof Pressable>,
44
- "onPress" | "accessibilityLabel" | "disabled"
42
+ "onPress" | "accessibilityLabel" | "accessibilityHint" | "disabled"
45
43
  >;
46
44
 
47
45
  /**
@@ -57,9 +55,10 @@ export const ListItemCheckbox = ({
57
55
  icon,
58
56
  selected,
59
57
  accessibilityLabel,
58
+ accessibilityHint,
60
59
  disabled,
61
60
  onValueChange
62
- }: OwnProps) => {
61
+ }: ListItemCheckboxProps) => {
63
62
  const [toggleValue, setToggleValue] = useState(selected ?? false);
64
63
  // Animations
65
64
  const isPressed: Animated.SharedValue<number> = useSharedValue(0);
@@ -74,6 +73,12 @@ export const ListItemCheckbox = ({
74
73
  // Theme
75
74
  const theme = useIOTheme();
76
75
 
76
+ // Accessibility
77
+ // Comma = Small pause when announcing content
78
+ const fallbackAccessibilityLabel = description
79
+ ? `${value}, ${description}`
80
+ : value;
81
+
77
82
  const mapBackgroundStates: Record<string, string> = {
78
83
  default: hexToRgba(IOColors[theme["listItem-pressed"]], 0),
79
84
  pressed: IOColors[theme["listItem-pressed"]]
@@ -130,7 +135,8 @@ export const ListItemCheckbox = ({
130
135
  onTouchEnd={handlePressOut}
131
136
  testID="ListItemCheckbox"
132
137
  accessible={true}
133
- accessibilityLabel={accessibilityLabel}
138
+ accessibilityLabel={accessibilityLabel || fallbackAccessibilityLabel}
139
+ accessibilityHint={accessibilityHint}
134
140
  accessibilityRole="checkbox"
135
141
  accessibilityState={{
136
142
  checked: selected ?? toggleValue,
@@ -1,4 +1,4 @@
1
- import React, { useCallback } from "react";
1
+ import React, { ComponentProps, useCallback } from "react";
2
2
  import {
3
3
  GestureResponderEvent,
4
4
  Image,
@@ -44,16 +44,19 @@ type ListItemTopElementProps =
44
44
  dateValue: string;
45
45
  };
46
46
 
47
- type ListItemNavPartialProps = WithTestID<{
48
- value: string | React.ReactNode;
49
- description?: string | React.ReactNode;
50
- loading?: boolean;
51
- onPress: (event: GestureResponderEvent) => void;
52
- // Accessibility
53
- accessibilityLabel: string;
54
- hideChevron?: boolean;
55
- topElement?: ListItemTopElementProps;
56
- }>;
47
+ type ListItemNavPartialProps = WithTestID<
48
+ {
49
+ value: string | React.ReactNode;
50
+ description?: string | React.ReactNode;
51
+ loading?: boolean;
52
+ onPress: (event: GestureResponderEvent) => void;
53
+ hideChevron?: boolean;
54
+ topElement?: ListItemTopElementProps;
55
+ } & Pick<
56
+ ComponentProps<typeof Pressable>,
57
+ "accessibilityLabel" | "accessibilityHint"
58
+ >
59
+ >;
57
60
 
58
61
  export type ListItemNavGraphicProps =
59
62
  | { icon?: never; iconColor?: never; paymentLogoUri: string }
@@ -77,6 +80,7 @@ export const ListItemNav = ({
77
80
  iconColor = "grey-450",
78
81
  paymentLogoUri,
79
82
  accessibilityLabel,
83
+ accessibilityHint,
80
84
  testID,
81
85
  hideChevron = false,
82
86
  topElement,
@@ -197,7 +201,9 @@ export const ListItemNav = ({
197
201
  onPressIn={handlePressIn}
198
202
  onPressOut={handlePressOut}
199
203
  accessible={true}
204
+ accessibilityState={{ busy: loading }}
200
205
  accessibilityLabel={accessibilityLabel}
206
+ accessibilityHint={accessibilityHint}
201
207
  accessibilityRole="button"
202
208
  testID={testID}
203
209
  >
@@ -57,12 +57,10 @@ type Props = WithTestID<{
57
57
 
58
58
  const DISABLED_OPACITY = 0.5;
59
59
 
60
- // disabled: the component is no longer touchable
61
- // onPress:
62
- type OwnProps = Props &
60
+ type ListItemRadioProps = Props &
63
61
  Pick<
64
62
  React.ComponentProps<typeof Pressable>,
65
- "onPress" | "accessibilityLabel" | "disabled"
63
+ "onPress" | "accessibilityLabel" | "accessibilityHint" | "disabled"
66
64
  >;
67
65
 
68
66
  const styles = StyleSheet.create({
@@ -87,9 +85,11 @@ export const ListItemRadio = ({
87
85
  selected,
88
86
  disabled,
89
87
  onValueChange,
88
+ accessibilityLabel,
89
+ accessibilityHint,
90
90
  loadingProps,
91
91
  testID
92
- }: OwnProps) => {
92
+ }: ListItemRadioProps) => {
93
93
  const [toggleValue, setToggleValue] = useState(selected ?? false);
94
94
  // Animations
95
95
  const isPressed: Animated.SharedValue<number> = useSharedValue(0);
@@ -217,6 +217,8 @@ export const ListItemRadio = ({
217
217
  checked: selected ?? toggleValue,
218
218
  disabled: !!disabled
219
219
  }}
220
+ accessibilityLabel={accessibilityLabel}
221
+ accessibilityHint={accessibilityHint}
220
222
  onPress={toggleRadioItem}
221
223
  onPressIn={handlePressIn}
222
224
  onPressOut={handlePressOut}
@@ -14,24 +14,32 @@ export type ListItemRadioWithAmountProps = {
14
14
  selected?: boolean;
15
15
  label: string;
16
16
  formattedAmountString: string;
17
+ accessibilityLabel?: string;
17
18
  } & (
18
19
  | {
19
20
  isSuggested?: false;
21
+ suggestReason?: never;
20
22
  }
21
23
  | {
22
- isSuggested: true;
24
+ isSuggested?: true;
23
25
  suggestReason: string;
24
26
  }
25
27
  );
26
- export const ListItemRadioWithAmount = (
27
- props: ListItemRadioWithAmountProps
28
- ) => {
29
- const [toggleValue, setToggleValue] = React.useState(props.selected ?? false);
28
+ export const ListItemRadioWithAmount = ({
29
+ onValueChange,
30
+ selected,
31
+ label,
32
+ accessibilityLabel,
33
+ isSuggested = false,
34
+ suggestReason,
35
+ formattedAmountString
36
+ }: ListItemRadioWithAmountProps) => {
37
+ const [toggleValue, setToggleValue] = React.useState(selected ?? false);
30
38
  const pressHandler = () => {
31
39
  RNReactNativeHapticFeedback.trigger("impactLight");
32
40
  setToggleValue(val => !val);
33
- if (props.onValueChange !== undefined) {
34
- props.onValueChange(!toggleValue);
41
+ if (onValueChange !== undefined) {
42
+ onValueChange(!toggleValue);
35
43
  }
36
44
  };
37
45
  const theme = useIOTheme();
@@ -39,19 +47,26 @@ export const ListItemRadioWithAmount = (
39
47
  const suggestColor: IOColors = "hanPurple-500";
40
48
 
41
49
  return (
42
- <PressableListItemBase onPress={pressHandler}>
50
+ <PressableListItemBase
51
+ onPress={pressHandler}
52
+ accessibilityRole="radio"
53
+ accessibilityLabel={accessibilityLabel}
54
+ accessibilityState={{
55
+ checked: selected ?? toggleValue
56
+ }}
57
+ >
43
58
  <View style={{ flexShrink: 1 }}>
44
59
  <LabelSmallAlt numberOfLines={1} color={theme["textBody-default"]}>
45
- {props.label} con nome molto molto lungo
60
+ {label} con nome molto molto lungo
46
61
  </LabelSmallAlt>
47
- {props.isSuggested && (
62
+ {isSuggested && (
48
63
  <>
49
64
  <VSpacer size={4} />
50
65
  <View style={styles.rowCenter}>
51
66
  <Icon name="sparkles" size={16} color={suggestColor} />
52
67
  <HSpacer size={4} />
53
68
  <LabelSmall weight="Regular" color={suggestColor}>
54
- {props.suggestReason}
69
+ {suggestReason}
55
70
  </LabelSmall>
56
71
  </View>
57
72
  </>
@@ -60,10 +75,10 @@ export const ListItemRadioWithAmount = (
60
75
  <View pointerEvents="none" style={{ flexDirection: "row" }}>
61
76
  <HSpacer size={8} />
62
77
  <H6 color={theme["interactiveElem-default"]}>
63
- {props.formattedAmountString}
78
+ {formattedAmountString}
64
79
  </H6>
65
80
  <HSpacer size={8} />
66
- <AnimatedRadio checked={props.selected ?? toggleValue} />
81
+ <AnimatedRadio checked={selected ?? toggleValue} />
67
82
  </View>
68
83
  </PressableListItemBase>
69
84
  );
@@ -98,6 +98,7 @@ export const ListItemSwitch = React.memo(
98
98
  : "no-hide-descendants"
99
99
  }
100
100
  })}
101
+ accessibilityState={{ disabled }}
101
102
  >
102
103
  {icon && (
103
104
  <View
@@ -5,15 +5,23 @@ import { IOListItemStyles } from "../../core";
5
5
  import { WithTestID } from "../../utils/types";
6
6
  import { useListItemSpringAnimation } from "./hooks/useListItemSpringAnimation";
7
7
 
8
- export type PressableBaseProps = WithTestID<{
9
- accessibilityLabel?: string;
10
- onPress?: () => void;
11
- }>;
8
+ export type PressableBaseProps = WithTestID<
9
+ Pick<
10
+ React.ComponentProps<typeof Pressable>,
11
+ | "onPress"
12
+ | "accessibilityLabel"
13
+ | "accessibilityHint"
14
+ | "accessibilityState"
15
+ | "accessibilityRole"
16
+ >
17
+ >;
18
+
12
19
  export const PressableListItemBase = ({
13
20
  onPress,
14
21
  testID,
15
- accessibilityLabel,
16
- children
22
+ children,
23
+ accessibilityRole,
24
+ ...props
17
25
  }: React.PropsWithChildren<PressableBaseProps>) => {
18
26
  const { onPressIn, onPressOut, animatedScaleStyle, animatedBackgroundStyle } =
19
27
  useListItemSpringAnimation();
@@ -22,11 +30,11 @@ export const PressableListItemBase = ({
22
30
  onPress={onPress}
23
31
  testID={testID}
24
32
  accessible={true}
25
- accessibilityLabel={accessibilityLabel}
26
33
  onPressIn={onPressIn}
27
34
  onPressOut={onPressOut}
28
35
  onTouchEnd={onPressOut}
29
- accessibilityRole="button"
36
+ accessibilityRole={accessibilityRole || "button"}
37
+ {...props}
30
38
  >
31
39
  <Animated.View
32
40
  style={[IOListItemStyles.listItem, animatedBackgroundStyle]}
@@ -777,7 +777,7 @@ exports[`Test List Item Components - Experimental Enabled ListItemNavAlert Snap
777
777
  "borderWidth": 0,
778
778
  },
779
779
  {
780
- "color": "#FE6666",
780
+ "color": "#D13333",
781
781
  },
782
782
  {
783
783
  "flex": 0,
@@ -786,7 +786,7 @@ exports[`Test List Item Components - Experimental Enabled ListItemNavAlert Snap
786
786
  },
787
787
  ]
788
788
  }
789
- tintColor="#FE6666"
789
+ tintColor="#D13333"
790
790
  vbHeight={24}
791
791
  vbWidth={24}
792
792
  width={24}
@@ -931,11 +931,11 @@ exports[`Test List Item Components - Experimental Enabled ListItemNavAlert Snap
931
931
 
932
932
  exports[`Test List Item Components - Experimental Enabled ListItemRadioWithAmount Snapshot 1`] = `
933
933
  <View
934
- accessibilityRole="button"
934
+ accessibilityRole="radio"
935
935
  accessibilityState={
936
936
  {
937
937
  "busy": undefined,
938
- "checked": undefined,
938
+ "checked": true,
939
939
  "disabled": undefined,
940
940
  "expanded": undefined,
941
941
  "selected": undefined,
@@ -1348,11 +1348,11 @@ exports[`Test List Item Components - Experimental Enabled ListItemRadioWithAmou
1348
1348
 
1349
1349
  exports[`Test List Item Components - Experimental Enabled ListItemRadioWithAmount Snapshot 2`] = `
1350
1350
  <View
1351
- accessibilityRole="button"
1351
+ accessibilityRole="radio"
1352
1352
  accessibilityState={
1353
1353
  {
1354
1354
  "busy": undefined,
1355
- "checked": undefined,
1355
+ "checked": false,
1356
1356
  "disabled": undefined,
1357
1357
  "expanded": undefined,
1358
1358
  "selected": undefined,
@@ -2582,7 +2582,7 @@ exports[`Test List Item Components ListItemNavAlert Snapshot 1`] = `
2582
2582
  "borderWidth": 0,
2583
2583
  },
2584
2584
  {
2585
- "color": "#FE6666",
2585
+ "color": "#D13333",
2586
2586
  },
2587
2587
  {
2588
2588
  "flex": 0,
@@ -2591,7 +2591,7 @@ exports[`Test List Item Components ListItemNavAlert Snapshot 1`] = `
2591
2591
  },
2592
2592
  ]
2593
2593
  }
2594
- tintColor="#FE6666"
2594
+ tintColor="#D13333"
2595
2595
  vbHeight={24}
2596
2596
  vbWidth={24}
2597
2597
  width={24}
@@ -2736,11 +2736,11 @@ exports[`Test List Item Components ListItemNavAlert Snapshot 1`] = `
2736
2736
 
2737
2737
  exports[`Test List Item Components ListItemRadioWithAmount Snapshot 1`] = `
2738
2738
  <View
2739
- accessibilityRole="button"
2739
+ accessibilityRole="radio"
2740
2740
  accessibilityState={
2741
2741
  {
2742
2742
  "busy": undefined,
2743
- "checked": undefined,
2743
+ "checked": true,
2744
2744
  "disabled": undefined,
2745
2745
  "expanded": undefined,
2746
2746
  "selected": undefined,
@@ -3153,11 +3153,11 @@ exports[`Test List Item Components ListItemRadioWithAmount Snapshot 1`] = `
3153
3153
 
3154
3154
  exports[`Test List Item Components ListItemRadioWithAmount Snapshot 2`] = `
3155
3155
  <View
3156
- accessibilityRole="button"
3156
+ accessibilityRole="radio"
3157
3157
  accessibilityState={
3158
3158
  {
3159
3159
  "busy": undefined,
3160
- "checked": undefined,
3160
+ "checked": false,
3161
3161
  "disabled": undefined,
3162
3162
  "expanded": undefined,
3163
3163
  "selected": undefined,
@@ -23,11 +23,11 @@ import {
23
23
  useIOTheme
24
24
  } from "../../core";
25
25
  import { WithTestID } from "../../utils/types";
26
- import { Icon } from "../icons";
27
- import { LabelSmall } from "../typography";
28
- import { VSpacer } from "../spacer";
29
26
  import { Badge } from "../badge";
27
+ import { Icon } from "../icons";
30
28
  import { LoadingSpinner } from "../loadingSpinner";
29
+ import { VSpacer } from "../spacer";
30
+ import { LabelSmall } from "../typography";
31
31
 
32
32
  type PartialProps = WithTestID<{
33
33
  title: string;
@@ -243,6 +243,7 @@ const SkeletonComponent = ({
243
243
  <View
244
244
  style={styles.button}
245
245
  accessible={true}
246
+ accessibilityState={{ busy: true }}
246
247
  accessibilityLabel={loadingAccessibilityLabel}
247
248
  >
248
249
  <View style={styles.innerContent}>
@@ -1,8 +1,15 @@
1
1
  import * as React from "react";
2
- import { StyleSheet, View } from "react-native";
2
+ import {
3
+ Image,
4
+ ImageSourcePropType,
5
+ ImageURISource,
6
+ StyleSheet,
7
+ View
8
+ } from "react-native";
3
9
  import Placeholder from "rn-placeholder";
4
10
  import {
5
11
  IOModuleStyles,
12
+ IOSelectionListItemVisualParams,
6
13
  IOSpacingScale,
7
14
  IOStyles,
8
15
  useIOTheme
@@ -13,54 +20,57 @@ import { HSpacer, VSpacer } from "../spacer";
13
20
  import { H6, LabelSmall } from "../typography";
14
21
  import { PressableModuleBase } from "./PressableModuleBase";
15
22
 
16
- // ---------------- types ----------------
17
-
18
- type ModuleCheckoutPartialProps =
19
- | {
20
- isLoading?: false;
21
- paymentLogo?: IOLogoPaymentType;
22
- title: string;
23
- subtitle?: string;
24
- onPress: () => void;
25
- }
26
- | {
27
- isLoading: true;
28
- paymentLogo?: never;
29
- title?: never;
30
- subtitle?: never;
31
- onPress?: never;
32
- };
33
-
34
- export type ModuleCheckoutProps = ModuleCheckoutPartialProps & {
23
+ type LoadingProps = {
24
+ isLoading: true;
35
25
  ctaText?: string;
36
26
  };
37
27
 
38
- type CtaOnlyProps = { text?: string };
28
+ type ImageProps =
29
+ | { paymentLogo: IOLogoPaymentType; image?: never }
30
+ | { paymentLogo?: never; image: ImageURISource | ImageSourcePropType }
31
+ | { paymentLogo?: never; image?: never };
39
32
 
40
- // ---------------- component ----------------
33
+ type BaseProps = {
34
+ isLoading?: false;
35
+ paymentLogo?: IOLogoPaymentType;
36
+ title: string;
37
+ subtitle?: string;
38
+ ctaText?: string;
39
+ onPress: () => void;
40
+ } & ImageProps;
41
+
42
+ export type ModuleCheckoutProps = LoadingProps | BaseProps;
41
43
 
42
44
  export const ModuleCheckout = (props: ModuleCheckoutProps) => {
43
45
  const theme = useIOTheme();
44
46
 
45
47
  if (props.isLoading) {
46
- return <LoadingVersion text={props.ctaText} />;
48
+ return <LoadingVersion {...props} />;
47
49
  }
48
50
 
49
- const paymentLogoEndMargin: IOSpacingScale = 12;
51
+ const { paymentLogo, image } = props;
50
52
 
51
- const ModuleBaseContent = () => (
52
- <View style={styles.rowCenter}>
53
- {/*
54
- we don't want to let the `space-between`
55
- handle spacing for the logo/text section,
56
- so we use a row and a marginEnd on the logo
57
- */}
58
- {props.paymentLogo && (
59
- <View style={{ marginEnd: paymentLogoEndMargin }}>
60
- <LogoPayment name={props.paymentLogo} />
53
+ const imageComponent = (
54
+ <>
55
+ {paymentLogo && (
56
+ <View style={styles.imageWrapper}>
57
+ <LogoPayment name={paymentLogo} />
61
58
  </View>
62
59
  )}
63
- <View style={IOStyles.flex}>
60
+ {image && (
61
+ <Image
62
+ source={image}
63
+ style={[styles.imageWrapper, styles.image]}
64
+ accessibilityIgnoresInvertColors={true}
65
+ />
66
+ )}
67
+ </>
68
+ );
69
+
70
+ const ModuleBaseContent = () => (
71
+ <>
72
+ {imageComponent}
73
+ <View style={styles.content}>
64
74
  <H6>{props.title}</H6>
65
75
  {props.subtitle && (
66
76
  <LabelSmall weight="Regular" color={theme["textBody-tertiary"]}>
@@ -68,14 +78,14 @@ export const ModuleCheckout = (props: ModuleCheckoutProps) => {
68
78
  </LabelSmall>
69
79
  )}
70
80
  </View>
71
- </View>
81
+ </>
72
82
  );
73
83
 
74
84
  if (props.ctaText) {
75
85
  return (
76
86
  <PressableModuleBase onPress={props.onPress}>
77
87
  <ModuleBaseContent />
78
- {props.ctaText && <CTA text={props.ctaText} />}
88
+ {props.ctaText && <ModuleAction ctaText={props.ctaText} />}
79
89
  </PressableModuleBase>
80
90
  );
81
91
  }
@@ -87,21 +97,19 @@ export const ModuleCheckout = (props: ModuleCheckoutProps) => {
87
97
  );
88
98
  };
89
99
 
90
- // ---------------- sub-components----------------
91
-
92
- const CTA = ({ text }: CtaOnlyProps) => (
100
+ const ModuleAction = ({ ctaText }: Pick<ModuleCheckoutProps, "ctaText">) => (
93
101
  <View pointerEvents="none">
94
102
  <ButtonLink
95
- label={text ?? ""}
96
- accessibilityLabel={text}
103
+ label={ctaText ?? ""}
104
+ accessibilityLabel={ctaText}
97
105
  onPress={() => null}
98
106
  />
99
107
  </View>
100
108
  );
101
109
 
102
- const LoadingVersion = ({ text }: CtaOnlyProps) => (
110
+ const LoadingVersion = ({ ctaText }: LoadingProps) => (
103
111
  <View style={IOModuleStyles.button}>
104
- <View style={styles.rowCenter}>
112
+ <View style={[IOStyles.row, IOStyles.alignCenter]}>
105
113
  <Placeholder.Box animate="fade" radius={8} height={24} width={24} />
106
114
  <HSpacer size={8} />
107
115
  <View>
@@ -110,16 +118,23 @@ const LoadingVersion = ({ text }: CtaOnlyProps) => (
110
118
  <Placeholder.Box animate="fade" radius={8} height={16} width={116} />
111
119
  </View>
112
120
  </View>
113
- <CTA text={text} />
121
+ <ModuleAction ctaText={ctaText} />
114
122
  </View>
115
123
  );
116
124
 
117
- // ---------------- styles ----------------
125
+ const imageMarginRight: IOSpacingScale = 12;
118
126
 
119
127
  const styles = StyleSheet.create({
120
- rowCenter: {
121
- flexDirection: "row",
122
- alignItems: "center",
123
- flex: 1
128
+ imageWrapper: {
129
+ marginRight: imageMarginRight
130
+ },
131
+ image: {
132
+ width: IOSelectionListItemVisualParams.iconSize,
133
+ height: IOSelectionListItemVisualParams.iconSize,
134
+ resizeMode: "contain"
135
+ },
136
+ content: {
137
+ flexGrow: 1,
138
+ flexShrink: 1
124
139
  }
125
140
  });
@@ -7,7 +7,6 @@ import {
7
7
  View
8
8
  } from "react-native";
9
9
  import Placeholder from "rn-placeholder";
10
- import { WithTestID } from "src/utils/types";
11
10
  import {
12
11
  IOListItemVisualParams,
13
12
  IOModuleStyles,
@@ -15,6 +14,7 @@ import {
15
14
  IOStyles,
16
15
  useIOTheme
17
16
  } from "../../core";
17
+ import { WithTestID } from "../../utils/types";
18
18
  import { Badge } from "../badge";
19
19
  import { IOIcons, Icon } from "../icons";
20
20
  import { HSpacer } from "../spacer";
@@ -1,23 +1,28 @@
1
1
  import * as React from "react";
2
- import { GestureResponderEvent, Pressable } from "react-native";
2
+ import { PropsWithChildren } from "react";
3
+ import { Pressable } from "react-native";
3
4
  import Animated from "react-native-reanimated";
4
5
  import { IOModuleIDPSavedVSpacing, IOModuleStyles } from "../../core";
5
6
  import { WithTestID } from "../../utils/types";
6
7
  import { useModuleSpringAnimation } from "./hooks/useModuleSpringAnimation";
7
8
 
8
- export type PressableModuleBaseProps = WithTestID<{
9
- accessibilityLabel?: string;
10
- onPress?: (event: GestureResponderEvent) => void;
11
- withLooseSpacing?: boolean;
12
- }>;
9
+ export type PressableModuleBaseProps = WithTestID<
10
+ {
11
+ withLooseSpacing?: boolean;
12
+ } & Pick<
13
+ React.ComponentProps<typeof Pressable>,
14
+ "onPress" | "accessibilityLabel" | "accessibilityHint"
15
+ >
16
+ >;
13
17
 
14
18
  export const PressableModuleBase = ({
15
19
  onPress,
16
- testID,
17
- accessibilityLabel,
18
20
  withLooseSpacing = false,
21
+ accessibilityLabel,
22
+ accessibilityHint,
23
+ testID,
19
24
  children
20
- }: React.PropsWithChildren<PressableModuleBaseProps>) => {
25
+ }: PropsWithChildren<PressableModuleBaseProps>) => {
21
26
  const { handlePressIn, handlePressOut, animatedStyle } =
22
27
  useModuleSpringAnimation();
23
28
  return (
@@ -25,10 +30,11 @@ export const PressableModuleBase = ({
25
30
  onPress={onPress}
26
31
  testID={testID}
27
32
  accessible={true}
28
- accessibilityLabel={accessibilityLabel}
29
33
  onPressIn={handlePressIn}
30
34
  onPressOut={handlePressOut}
31
35
  onTouchEnd={handlePressOut}
36
+ accessibilityLabel={accessibilityLabel}
37
+ accessibilityHint={accessibilityHint}
32
38
  accessibilityRole="button"
33
39
  >
34
40
  <Animated.View