@pagopa/io-app-design-system 1.3.2 → 1.5.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 (306) hide show
  1. package/README.md +11 -0
  2. package/lib/commonjs/components/accordion/AccordionItem.js +137 -0
  3. package/lib/commonjs/components/accordion/AccordionItem.js.map +1 -0
  4. package/lib/commonjs/components/accordion/index.js +4 -4
  5. package/lib/commonjs/components/accordion/index.js.map +1 -1
  6. package/lib/commonjs/components/alert/Alert.js +1 -1
  7. package/lib/commonjs/components/alert/Alert.js.map +1 -1
  8. package/lib/commonjs/components/banner/Banner.js +1 -1
  9. package/lib/commonjs/components/banner/Banner.js.map +1 -1
  10. package/lib/commonjs/components/buttons/ButtonExtendedOutline.js +1 -1
  11. package/lib/commonjs/components/buttons/ButtonExtendedOutline.js.map +1 -1
  12. package/lib/commonjs/components/buttons/ButtonLink.js +6 -6
  13. package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
  14. package/lib/commonjs/components/buttons/ButtonOutline.js +10 -10
  15. package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
  16. package/lib/commonjs/components/buttons/ButtonSolid.js +5 -5
  17. package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
  18. package/lib/commonjs/components/buttons/IconButton.js +4 -4
  19. package/lib/commonjs/components/buttons/IconButton.js.map +1 -1
  20. package/lib/commonjs/components/buttons/IconButtonContained.js +4 -4
  21. package/lib/commonjs/components/buttons/IconButtonContained.js.map +1 -1
  22. package/lib/commonjs/components/buttons/IconButtonSolid.js +5 -5
  23. package/lib/commonjs/components/buttons/IconButtonSolid.js.map +1 -1
  24. package/lib/commonjs/components/common/LogoPaymentWithFallback.js +49 -0
  25. package/lib/commonjs/components/common/LogoPaymentWithFallback.js.map +1 -0
  26. package/lib/commonjs/components/index.js +22 -0
  27. package/lib/commonjs/components/index.js.map +1 -1
  28. package/lib/commonjs/components/layout/BlockButtons.js +82 -0
  29. package/lib/commonjs/components/layout/BlockButtons.js.map +1 -0
  30. package/lib/commonjs/components/layout/FooterWithButtons.js +41 -0
  31. package/lib/commonjs/components/layout/FooterWithButtons.js.map +1 -0
  32. package/lib/commonjs/components/layout/index.js +11 -0
  33. package/lib/commonjs/components/layout/index.js.map +1 -1
  34. package/lib/commonjs/components/listitems/ListItemAction.js +1 -1
  35. package/lib/commonjs/components/listitems/ListItemAction.js.map +1 -1
  36. package/lib/commonjs/components/listitems/ListItemCheckbox.js +1 -1
  37. package/lib/commonjs/components/listitems/ListItemCheckbox.js.map +1 -1
  38. package/lib/commonjs/components/listitems/ListItemIDP.js +1 -1
  39. package/lib/commonjs/components/listitems/ListItemIDP.js.map +1 -1
  40. package/lib/commonjs/components/listitems/ListItemInfoCopy.js +1 -1
  41. package/lib/commonjs/components/listitems/ListItemInfoCopy.js.map +1 -1
  42. package/lib/commonjs/components/listitems/ListItemNav.js +1 -1
  43. package/lib/commonjs/components/listitems/ListItemNav.js.map +1 -1
  44. package/lib/commonjs/components/listitems/ListItemNavAlert.js +1 -1
  45. package/lib/commonjs/components/listitems/ListItemNavAlert.js.map +1 -1
  46. package/lib/commonjs/components/listitems/ListItemRadio.js +1 -1
  47. package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -1
  48. package/lib/commonjs/components/listitems/ListItemTransaction.js +47 -29
  49. package/lib/commonjs/components/listitems/ListItemTransaction.js.map +1 -1
  50. package/lib/commonjs/components/listitems/hooks/useListItemSpringAnimation.js +1 -1
  51. package/lib/commonjs/components/listitems/hooks/useListItemSpringAnimation.js.map +1 -1
  52. package/lib/commonjs/components/tabs/TabItem.js +1 -1
  53. package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
  54. package/lib/commonjs/components/tabs/TabNavigation.js +2 -2
  55. package/lib/commonjs/components/tabs/TabNavigation.js.map +1 -1
  56. package/lib/commonjs/components/{accordion/IOAccordion.js → textInput/TextInput.js} +5 -27
  57. package/lib/commonjs/components/textInput/TextInput.js.map +1 -0
  58. package/lib/commonjs/components/textInput/TextInputBase.js +233 -0
  59. package/lib/commonjs/components/textInput/TextInputBase.js.map +1 -0
  60. package/lib/commonjs/components/textInput/TextInputPassword.js +36 -0
  61. package/lib/commonjs/components/textInput/TextInputPassword.js.map +1 -0
  62. package/lib/commonjs/components/textInput/TextInputValidation.js +57 -0
  63. package/lib/commonjs/components/textInput/TextInputValidation.js.map +1 -0
  64. package/lib/commonjs/components/textInput/index.js +39 -0
  65. package/lib/commonjs/components/textInput/index.js.map +1 -0
  66. package/lib/commonjs/core/IOAnimations.js +5 -0
  67. package/lib/commonjs/core/IOAnimations.js.map +1 -1
  68. package/lib/commonjs/core/IOShapes.js +3 -1
  69. package/lib/commonjs/core/IOShapes.js.map +1 -1
  70. package/lib/commonjs/stories/ButtonDS.stories.js +34 -0
  71. package/lib/commonjs/stories/ButtonDS.stories.js.map +1 -0
  72. package/lib/commonjs/stories/H1.stories.js +33 -0
  73. package/lib/commonjs/stories/H1.stories.js.map +1 -0
  74. package/lib/commonjs/stories/H2.stories.js +33 -0
  75. package/lib/commonjs/stories/H2.stories.js.map +1 -0
  76. package/lib/commonjs/stories/H3.stories.js +33 -0
  77. package/lib/commonjs/stories/H3.stories.js.map +1 -0
  78. package/lib/commonjs/stories/H4.stories.js +33 -0
  79. package/lib/commonjs/stories/H4.stories.js.map +1 -0
  80. package/lib/commonjs/stories/H5.stories.js +33 -0
  81. package/lib/commonjs/stories/H5.stories.js.map +1 -0
  82. package/lib/commonjs/stories/H6.stories.js +33 -0
  83. package/lib/commonjs/stories/H6.stories.js.map +1 -0
  84. package/lib/commonjs/stories/Label.stories.js +33 -0
  85. package/lib/commonjs/stories/Label.stories.js.map +1 -0
  86. package/lib/commonjs/stories/LabelSmall.stories.js +33 -0
  87. package/lib/commonjs/stories/LabelSmall.stories.js.map +1 -0
  88. package/lib/commonjs/stories/Link.stories.js +33 -0
  89. package/lib/commonjs/stories/Link.stories.js.map +1 -0
  90. package/lib/commonjs/stories/Monospace.stories.js +33 -0
  91. package/lib/commonjs/stories/Monospace.stories.js.map +1 -0
  92. package/lib/commonjs/utils/accessibility.js +19 -0
  93. package/lib/commonjs/utils/accessibility.js.map +1 -0
  94. package/lib/commonjs/utils/fonts.js +13 -4
  95. package/lib/commonjs/utils/fonts.js.map +1 -1
  96. package/lib/commonjs/utils/object.js +16 -0
  97. package/lib/commonjs/utils/object.js.map +1 -0
  98. package/lib/commonjs/utils/textInput/index.js +24 -0
  99. package/lib/commonjs/utils/textInput/index.js.map +1 -0
  100. package/lib/commonjs/utils/url.js +14 -0
  101. package/lib/commonjs/utils/url.js.map +1 -0
  102. package/lib/module/components/accordion/AccordionItem.js +126 -0
  103. package/lib/module/components/accordion/AccordionItem.js.map +1 -0
  104. package/lib/module/components/accordion/index.js +1 -1
  105. package/lib/module/components/accordion/index.js.map +1 -1
  106. package/lib/module/components/alert/Alert.js +1 -1
  107. package/lib/module/components/alert/Alert.js.map +1 -1
  108. package/lib/module/components/banner/Banner.js +1 -1
  109. package/lib/module/components/banner/Banner.js.map +1 -1
  110. package/lib/module/components/buttons/ButtonExtendedOutline.js +1 -1
  111. package/lib/module/components/buttons/ButtonExtendedOutline.js.map +1 -1
  112. package/lib/module/components/buttons/ButtonLink.js +6 -6
  113. package/lib/module/components/buttons/ButtonLink.js.map +1 -1
  114. package/lib/module/components/buttons/ButtonOutline.js +10 -10
  115. package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
  116. package/lib/module/components/buttons/ButtonSolid.js +5 -5
  117. package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
  118. package/lib/module/components/buttons/IconButton.js +4 -4
  119. package/lib/module/components/buttons/IconButton.js.map +1 -1
  120. package/lib/module/components/buttons/IconButtonContained.js +4 -4
  121. package/lib/module/components/buttons/IconButtonContained.js.map +1 -1
  122. package/lib/module/components/buttons/IconButtonSolid.js +5 -5
  123. package/lib/module/components/buttons/IconButtonSolid.js.map +1 -1
  124. package/lib/module/components/common/LogoPaymentWithFallback.js +40 -0
  125. package/lib/module/components/common/LogoPaymentWithFallback.js.map +1 -0
  126. package/lib/module/components/index.js +2 -0
  127. package/lib/module/components/index.js.map +1 -1
  128. package/lib/module/components/layout/BlockButtons.js +73 -0
  129. package/lib/module/components/layout/BlockButtons.js.map +1 -0
  130. package/lib/module/components/layout/FooterWithButtons.js +32 -0
  131. package/lib/module/components/layout/FooterWithButtons.js.map +1 -0
  132. package/lib/module/components/layout/index.js +1 -0
  133. package/lib/module/components/layout/index.js.map +1 -1
  134. package/lib/module/components/listitems/ListItemAction.js +1 -1
  135. package/lib/module/components/listitems/ListItemAction.js.map +1 -1
  136. package/lib/module/components/listitems/ListItemCheckbox.js +1 -1
  137. package/lib/module/components/listitems/ListItemCheckbox.js.map +1 -1
  138. package/lib/module/components/listitems/ListItemIDP.js +1 -1
  139. package/lib/module/components/listitems/ListItemIDP.js.map +1 -1
  140. package/lib/module/components/listitems/ListItemInfoCopy.js +1 -1
  141. package/lib/module/components/listitems/ListItemInfoCopy.js.map +1 -1
  142. package/lib/module/components/listitems/ListItemNav.js +1 -1
  143. package/lib/module/components/listitems/ListItemNav.js.map +1 -1
  144. package/lib/module/components/listitems/ListItemNavAlert.js +1 -1
  145. package/lib/module/components/listitems/ListItemNavAlert.js.map +1 -1
  146. package/lib/module/components/listitems/ListItemRadio.js +1 -1
  147. package/lib/module/components/listitems/ListItemRadio.js.map +1 -1
  148. package/lib/module/components/listitems/ListItemTransaction.js +48 -30
  149. package/lib/module/components/listitems/ListItemTransaction.js.map +1 -1
  150. package/lib/module/components/listitems/hooks/useListItemSpringAnimation.js +1 -1
  151. package/lib/module/components/listitems/hooks/useListItemSpringAnimation.js.map +1 -1
  152. package/lib/module/components/tabs/TabItem.js +1 -1
  153. package/lib/module/components/tabs/TabItem.js.map +1 -1
  154. package/lib/module/components/tabs/TabNavigation.js +2 -2
  155. package/lib/module/components/tabs/TabNavigation.js.map +1 -1
  156. package/lib/module/components/textInput/TextInput.js +4 -0
  157. package/lib/module/components/textInput/TextInput.js.map +1 -0
  158. package/lib/module/components/textInput/TextInputBase.js +225 -0
  159. package/lib/module/components/textInput/TextInputBase.js.map +1 -0
  160. package/lib/module/components/textInput/TextInputPassword.js +27 -0
  161. package/lib/module/components/textInput/TextInputPassword.js.map +1 -0
  162. package/lib/module/components/textInput/TextInputValidation.js +47 -0
  163. package/lib/module/components/textInput/TextInputValidation.js.map +1 -0
  164. package/lib/module/components/textInput/index.js +4 -0
  165. package/lib/module/components/textInput/index.js.map +1 -0
  166. package/lib/module/core/IOAnimations.js +5 -0
  167. package/lib/module/core/IOAnimations.js.map +1 -1
  168. package/lib/module/core/IOShapes.js +1 -0
  169. package/lib/module/core/IOShapes.js.map +1 -1
  170. package/lib/module/stories/ButtonDS.stories.js +27 -0
  171. package/lib/module/stories/ButtonDS.stories.js.map +1 -0
  172. package/lib/module/stories/H1.stories.js +26 -0
  173. package/lib/module/stories/H1.stories.js.map +1 -0
  174. package/lib/module/stories/H2.stories.js +26 -0
  175. package/lib/module/stories/H2.stories.js.map +1 -0
  176. package/lib/module/stories/H3.stories.js +26 -0
  177. package/lib/module/stories/H3.stories.js.map +1 -0
  178. package/lib/module/stories/H4.stories.js +26 -0
  179. package/lib/module/stories/H4.stories.js.map +1 -0
  180. package/lib/module/stories/H5.stories.js +26 -0
  181. package/lib/module/stories/H5.stories.js.map +1 -0
  182. package/lib/module/stories/H6.stories.js +26 -0
  183. package/lib/module/stories/H6.stories.js.map +1 -0
  184. package/lib/module/stories/Label.stories.js +26 -0
  185. package/lib/module/stories/Label.stories.js.map +1 -0
  186. package/lib/module/stories/LabelSmall.stories.js +26 -0
  187. package/lib/module/stories/LabelSmall.stories.js.map +1 -0
  188. package/lib/module/stories/Link.stories.js +26 -0
  189. package/lib/module/stories/Link.stories.js.map +1 -0
  190. package/lib/module/stories/Monospace.stories.js +26 -0
  191. package/lib/module/stories/Monospace.stories.js.map +1 -0
  192. package/lib/module/utils/accessibility.js +10 -0
  193. package/lib/module/utils/accessibility.js.map +1 -0
  194. package/lib/module/utils/fonts.js +13 -4
  195. package/lib/module/utils/fonts.js.map +1 -1
  196. package/lib/module/utils/object.js +7 -0
  197. package/lib/module/utils/object.js.map +1 -0
  198. package/lib/module/utils/textInput/index.js +17 -0
  199. package/lib/module/utils/textInput/index.js.map +1 -0
  200. package/lib/module/utils/url.js +7 -0
  201. package/lib/module/utils/url.js.map +1 -0
  202. package/lib/typescript/components/accordion/AccordionItem.d.ts +14 -0
  203. package/lib/typescript/components/accordion/AccordionItem.d.ts.map +1 -0
  204. package/lib/typescript/components/accordion/index.d.ts +1 -1
  205. package/lib/typescript/components/accordion/index.d.ts.map +1 -1
  206. package/lib/typescript/components/buttons/ButtonSolid.d.ts +16 -0
  207. package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
  208. package/lib/typescript/components/common/LogoPaymentWithFallback.d.ts +27 -0
  209. package/lib/typescript/components/common/LogoPaymentWithFallback.d.ts.map +1 -0
  210. package/lib/typescript/components/index.d.ts +2 -0
  211. package/lib/typescript/components/index.d.ts.map +1 -1
  212. package/lib/typescript/components/layout/BlockButtons.d.ts +53 -0
  213. package/lib/typescript/components/layout/BlockButtons.d.ts.map +1 -0
  214. package/lib/typescript/components/layout/FooterWithButtons.d.ts +9 -0
  215. package/lib/typescript/components/layout/FooterWithButtons.d.ts.map +1 -0
  216. package/lib/typescript/components/layout/index.d.ts +1 -0
  217. package/lib/typescript/components/layout/index.d.ts.map +1 -1
  218. package/lib/typescript/components/listitems/ListItemTransaction.d.ts +13 -5
  219. package/lib/typescript/components/listitems/ListItemTransaction.d.ts.map +1 -1
  220. package/lib/typescript/components/textInput/TextInput.d.ts +6 -0
  221. package/lib/typescript/components/textInput/TextInput.d.ts.map +1 -0
  222. package/lib/typescript/components/textInput/TextInputBase.d.ts +28 -0
  223. package/lib/typescript/components/textInput/TextInputBase.d.ts.map +1 -0
  224. package/lib/typescript/components/textInput/TextInputPassword.d.ts +6 -0
  225. package/lib/typescript/components/textInput/TextInputPassword.d.ts.map +1 -0
  226. package/lib/typescript/components/textInput/TextInputValidation.d.ts +9 -0
  227. package/lib/typescript/components/textInput/TextInputValidation.d.ts.map +1 -0
  228. package/lib/typescript/components/textInput/index.d.ts +4 -0
  229. package/lib/typescript/components/textInput/index.d.ts.map +1 -0
  230. package/lib/typescript/core/IOAnimations.d.ts +5 -0
  231. package/lib/typescript/core/IOAnimations.d.ts.map +1 -1
  232. package/lib/typescript/core/IOShapes.d.ts +1 -0
  233. package/lib/typescript/core/IOShapes.d.ts.map +1 -1
  234. package/lib/typescript/stories/ButtonDS.stories.d.ts +14 -0
  235. package/lib/typescript/stories/ButtonDS.stories.d.ts.map +1 -0
  236. package/lib/typescript/stories/H1.stories.d.ts +19 -0
  237. package/lib/typescript/stories/H1.stories.d.ts.map +1 -0
  238. package/lib/typescript/stories/H2.stories.d.ts +19 -0
  239. package/lib/typescript/stories/H2.stories.d.ts.map +1 -0
  240. package/lib/typescript/stories/H3.stories.d.ts +19 -0
  241. package/lib/typescript/stories/H3.stories.d.ts.map +1 -0
  242. package/lib/typescript/stories/H4.stories.d.ts +19 -0
  243. package/lib/typescript/stories/H4.stories.d.ts.map +1 -0
  244. package/lib/typescript/stories/H5.stories.d.ts +27 -0
  245. package/lib/typescript/stories/H5.stories.d.ts.map +1 -0
  246. package/lib/typescript/stories/H6.stories.d.ts +19 -0
  247. package/lib/typescript/stories/H6.stories.d.ts.map +1 -0
  248. package/lib/typescript/stories/Label.stories.d.ts +19 -0
  249. package/lib/typescript/stories/Label.stories.d.ts.map +1 -0
  250. package/lib/typescript/stories/LabelSmall.stories.d.ts +21 -0
  251. package/lib/typescript/stories/LabelSmall.stories.d.ts.map +1 -0
  252. package/lib/typescript/stories/Link.stories.d.ts +21 -0
  253. package/lib/typescript/stories/Link.stories.d.ts.map +1 -0
  254. package/lib/typescript/stories/Monospace.stories.d.ts +19 -0
  255. package/lib/typescript/stories/Monospace.stories.d.ts.map +1 -0
  256. package/lib/typescript/utils/accessibility.d.ts +6 -0
  257. package/lib/typescript/utils/accessibility.d.ts.map +1 -0
  258. package/lib/typescript/utils/fonts.d.ts.map +1 -1
  259. package/lib/typescript/utils/object.d.ts +5 -0
  260. package/lib/typescript/utils/object.d.ts.map +1 -0
  261. package/lib/typescript/utils/textInput/index.d.ts +9 -0
  262. package/lib/typescript/utils/textInput/index.d.ts.map +1 -0
  263. package/lib/typescript/utils/types.d.ts +1 -0
  264. package/lib/typescript/utils/types.d.ts.map +1 -1
  265. package/lib/typescript/utils/url.d.ts +8 -0
  266. package/lib/typescript/utils/url.d.ts.map +1 -0
  267. package/package.json +25 -4
  268. package/src/components/accordion/AccordionItem.tsx +165 -0
  269. package/src/components/accordion/index.tsx +1 -1
  270. package/src/components/buttons/ButtonSolid.tsx +16 -0
  271. package/src/components/common/LogoPaymentWithFallback.tsx +60 -0
  272. package/src/components/index.tsx +2 -0
  273. package/src/components/layout/BlockButtons.tsx +142 -0
  274. package/src/components/layout/FooterWithButtons.tsx +37 -0
  275. package/src/components/layout/index.tsx +1 -0
  276. package/src/components/listitems/ListItemTransaction.tsx +86 -39
  277. package/src/components/textInput/TextInput.tsx +15 -0
  278. package/src/components/textInput/TextInputBase.tsx +327 -0
  279. package/src/components/textInput/TextInputPassword.tsx +36 -0
  280. package/src/components/textInput/TextInputValidation.tsx +71 -0
  281. package/src/components/textInput/index.tsx +3 -0
  282. package/src/core/IOAnimations.ts +5 -0
  283. package/src/core/IOShapes.ts +1 -0
  284. package/src/stories/ButtonDS.stories.ts +31 -0
  285. package/src/stories/H1.stories.ts +28 -0
  286. package/src/stories/H2.stories.ts +28 -0
  287. package/src/stories/H3.stories.ts +28 -0
  288. package/src/stories/H4.stories.ts +28 -0
  289. package/src/stories/H5.stories.ts +28 -0
  290. package/src/stories/H6.stories.ts +28 -0
  291. package/src/stories/Label.stories.ts +28 -0
  292. package/src/stories/LabelSmall.stories.ts +28 -0
  293. package/src/stories/Link.stories.ts +28 -0
  294. package/src/stories/Monospace.stories.ts +28 -0
  295. package/src/utils/accessibility.ts +17 -0
  296. package/src/utils/fonts.ts +12 -5
  297. package/src/utils/object.ts +12 -0
  298. package/src/utils/textInput/index.ts +29 -0
  299. package/src/utils/types.ts +2 -0
  300. package/src/utils/url.ts +9 -0
  301. package/lib/commonjs/components/accordion/IOAccordion.js.map +0 -1
  302. package/lib/module/components/accordion/IOAccordion.js +0 -26
  303. package/lib/module/components/accordion/IOAccordion.js.map +0 -1
  304. package/lib/typescript/components/accordion/IOAccordion.d.ts +0 -13
  305. package/lib/typescript/components/accordion/IOAccordion.d.ts.map +0 -1
  306. package/src/components/accordion/IOAccordion.tsx +0 -35
@@ -3,19 +3,25 @@ import { pipe } from "fp-ts/lib/function";
3
3
  import React from "react";
4
4
  import { ImageURISource, StyleSheet, View } from "react-native";
5
5
  import Placeholder from "rn-placeholder";
6
+
6
7
  import {
7
8
  IOColors,
9
+ IOListItemLogoMargin,
8
10
  IOListItemStyles,
9
11
  IOListItemVisualParams,
10
12
  IOStyles,
11
13
  IOVisualCostants,
12
14
  useIOTheme
13
15
  } from "../../core";
16
+
17
+ import { LogoPaymentWithFallback } from "../common/LogoPaymentWithFallback";
18
+ import { isImageUri } from "../../utils/url";
14
19
  import { WithTestID } from "../../utils/types";
20
+ import { getAccessibleAmountText } from "../../utils/accessibility";
15
21
  import { Avatar } from "../avatar/Avatar";
16
22
  import { Badge } from "../badge/Badge";
17
- import { Icon } from "../icons";
18
- import { IOLogoPaymentType, LogoPayment } from "../logos";
23
+ import { IOIconSizeScale, Icon } from "../icons";
24
+ import { IOLogoPaymentType } from "../logos";
19
25
  import { VSpacer } from "../spacer";
20
26
  import { H6, LabelSmall } from "../typography";
21
27
  import {
@@ -23,103 +29,144 @@ import {
23
29
  PressableListItemBase
24
30
  } from "./PressableListItemsBase";
25
31
 
26
- type LogoNameOrUri = IOLogoPaymentType | ImageURISource;
32
+ export type ListItemTransactionStatus =
33
+ | "success"
34
+ | "failure"
35
+ | "pending"
36
+ | "cancelled"
37
+ | "refunded"
38
+ | "reversal";
39
+
40
+ type PaymentLogoIcon = IOLogoPaymentType | ImageURISource | React.ReactNode;
41
+
27
42
  export type ListItemTransaction = WithTestID<
28
43
  PressableBaseProps & {
29
44
  hasChevronRight?: boolean;
30
45
  isLoading?: boolean;
31
- paymentLogoOrUrl?: LogoNameOrUri;
46
+ /**
47
+ * A logo that will be displayed on the left of the list item.
48
+ *
49
+ * Must be a {@link IOLogoPaymentType} or an {@link ImageURISource} or an {@link Icon}.
50
+ */
51
+ paymentLogoIcon?: PaymentLogoIcon;
32
52
  subtitle: string;
33
53
  title: string;
34
54
  } & (
35
55
  | {
36
- transactionStatus: "success";
56
+ transactionStatus: "success" | "refunded";
57
+ badgeText?: string;
37
58
  transactionAmount: string;
38
59
  }
39
60
  | {
40
- transactionStatus: "failure" | "pending";
61
+ transactionStatus: "failure" | "pending" | "cancelled" | "reversal";
62
+ badgeText: string;
41
63
  transactionAmount?: string;
42
64
  }
43
65
  )
44
66
  >;
45
67
 
46
68
  type LeftComponentProps = {
47
- logoNameOrUrl: LogoNameOrUri;
69
+ logoIcon: PaymentLogoIcon;
48
70
  };
49
71
 
50
- const isImageUrI = (
51
- value: IOLogoPaymentType | ImageURISource
52
- ): value is ImageURISource =>
53
- typeof value === "object" && value.uri !== undefined;
72
+ const CARD_LOGO_SIZE: IOIconSizeScale = 24;
73
+ const MUNICIPALITY_LOGO_SIZE = 44;
74
+ // this is the <Avatar/>'s "small" size,
75
+ // since it is bigger than the card logos, we use
76
+ // it as a base size for homogeneous sizing via container size.
54
77
 
55
- const LeftComponent = ({ logoNameOrUrl }: LeftComponentProps) => {
56
- if (isImageUrI(logoNameOrUrl)) {
57
- return <Avatar shape="circle" size="small" logoUri={[logoNameOrUrl]} />;
58
- } else {
59
- return (
60
- <View
61
- style={{
62
- width: IOVisualCostants.avatarSizeSmall,
63
- height: IOVisualCostants.avatarSizeSmall,
64
- alignItems: "center",
65
- justifyContent: "center"
66
- }}
67
- >
68
- <LogoPayment name={logoNameOrUrl} />
69
- </View>
70
- );
78
+ const LeftComponent = ({ logoIcon }: LeftComponentProps) => {
79
+ if (isImageUri(logoIcon)) {
80
+ return <Avatar logoUri={[logoIcon]} size="small" shape="circle" />;
71
81
  }
82
+ if (React.isValidElement(logoIcon)) {
83
+ return <>{logoIcon}</>;
84
+ }
85
+ return (
86
+ <LogoPaymentWithFallback
87
+ brand={logoIcon as IOLogoPaymentType}
88
+ size={CARD_LOGO_SIZE}
89
+ />
90
+ );
72
91
  };
73
92
 
74
93
  export const ListItemTransaction = ({
75
94
  accessibilityLabel,
76
95
  hasChevronRight = false,
77
96
  isLoading = false,
78
- paymentLogoOrUrl,
97
+ paymentLogoIcon,
79
98
  onPress,
80
99
  subtitle,
81
100
  testID,
82
101
  title,
83
102
  transactionAmount,
103
+ badgeText,
84
104
  transactionStatus = "success"
85
105
  }: ListItemTransaction) => {
86
106
  const theme = useIOTheme();
87
107
 
108
+ const maybeBadgeText = pipe(
109
+ badgeText,
110
+ O.fromNullable,
111
+ O.getOrElse(() => "-")
112
+ );
113
+
88
114
  if (isLoading) {
89
115
  return <SkeletonComponent />;
90
116
  }
91
117
 
92
- const designSystemBlue: IOColors = "blue";
118
+ const designSystemBlue: IOColors = "blueIO-500";
93
119
  const ListItemTransactionContent = () => {
94
120
  const TransactionAmountOrBadgeComponent = () => {
95
121
  switch (transactionStatus) {
96
122
  case "success":
97
123
  return (
98
- <H6 color={hasChevronRight ? designSystemBlue : "black"}>
99
- {transactionAmount || "-"}
124
+ <H6
125
+ accessibilityLabel={getAccessibleAmountText(transactionAmount)}
126
+ color={hasChevronRight ? designSystemBlue : "black"}
127
+ >
128
+ {transactionAmount || ""}
129
+ </H6>
130
+ );
131
+ case "refunded":
132
+ return (
133
+ <H6
134
+ accessibilityLabel={getAccessibleAmountText(transactionAmount)}
135
+ color={hasChevronRight ? designSystemBlue : "success-700"}
136
+ >
137
+ {transactionAmount || ""}
100
138
  </H6>
101
139
  );
102
-
103
140
  case "failure":
104
- return <Badge variant="error" text={"Failed"} />;
141
+ case "cancelled":
142
+ return <Badge variant="error" text={maybeBadgeText} />;
143
+ case "reversal":
144
+ return <Badge variant="lightBlue" text={maybeBadgeText} />;
105
145
  case "pending":
106
- return <Badge variant="info" text={"Cancelled"} />;
146
+ return <Badge variant="info" text={maybeBadgeText} />;
107
147
  }
108
148
  };
109
149
 
110
150
  return (
111
151
  <>
112
- {paymentLogoOrUrl && (
113
- <View style={{ marginRight: IOListItemVisualParams.iconMargin }}>
114
- <LeftComponent logoNameOrUrl={paymentLogoOrUrl} />
152
+ {paymentLogoIcon && (
153
+ <View
154
+ style={{
155
+ marginRight: IOListItemLogoMargin,
156
+ width: MUNICIPALITY_LOGO_SIZE,
157
+ alignItems: "center"
158
+ }}
159
+ >
160
+ <LeftComponent logoIcon={paymentLogoIcon} />
115
161
  </View>
116
162
  )}
117
163
  <View style={IOStyles.flex}>
118
- <H6 color={theme["textBody-default"]}>{title}</H6>
164
+ <LabelSmall numberOfLines={2} color={theme["textBody-default"]}>
165
+ {title}
166
+ </LabelSmall>
119
167
  <LabelSmall weight="Regular" color={theme["textBody-tertiary"]}>
120
168
  {subtitle}
121
169
  </LabelSmall>
122
- <VSpacer size={4} />
123
170
  </View>
124
171
  <View style={Styles.rightSection}>
125
172
  <TransactionAmountOrBadgeComponent />
@@ -0,0 +1,15 @@
1
+ import * as React from "react";
2
+ import { TextInputBase } from "./TextInputBase";
3
+
4
+ type TextInputProps = Omit<
5
+ React.ComponentProps<typeof TextInputBase>,
6
+ | "rightElement"
7
+ | "status"
8
+ | "bottomMessageColor"
9
+ | "isPassword"
10
+ | "errorMessage"
11
+ >;
12
+
13
+ export const TextInput = (props: TextInputProps) => (
14
+ <TextInputBase {...props} />
15
+ );
@@ -0,0 +1,327 @@
1
+ /* eslint-disable functional/immutable-data */
2
+ import {
3
+ Pressable,
4
+ StyleSheet,
5
+ TextInput,
6
+ View,
7
+ ViewStyle
8
+ } from "react-native";
9
+ import React, { useCallback, useEffect, useMemo, useRef } from "react";
10
+ import Animated, {
11
+ Easing,
12
+ useAnimatedStyle,
13
+ useSharedValue,
14
+ withTiming
15
+ } from "react-native-reanimated";
16
+ import { IOColors, IOSpacingScale, IOStyles } from "../../core";
17
+ import { IOIcons, Icon } from "../icons";
18
+ import { HSpacer } from "../spacer";
19
+ import { LabelSmall } from "../typography";
20
+ import { InputType } from "../../utils/types";
21
+ import { getInputPropsByType } from "../../utils/textInput";
22
+ import { makeFontStyleObject } from "../../utils/fonts";
23
+
24
+ type InputStatus = "initial" | "focused" | "disabled" | "error";
25
+
26
+ type RNTextInputProps = Pick<
27
+ React.ComponentProps<typeof TextInput>,
28
+ "keyboardType" | "inputMode" | "textContentType" | "autoComplete"
29
+ >;
30
+
31
+ type InputTextProps = {
32
+ placeholder: string;
33
+ value: string;
34
+ onChangeText: (value: string) => void;
35
+ accessibilityLabel?: string;
36
+ textInputProps?: RNTextInputProps;
37
+ inputTyoe?: InputType;
38
+ status?: InputStatus;
39
+ icon?: IOIcons;
40
+ rightElement?: React.ReactNode;
41
+ counterLimit?: number;
42
+ bottomMessage?: string;
43
+ bottomMessageColor?: IOColors;
44
+ disabled?: boolean;
45
+ isPassword?: boolean;
46
+ onBlur?: () => void;
47
+ onFocus?: () => void;
48
+ };
49
+
50
+ const styles = StyleSheet.create({
51
+ textInput: {
52
+ ...IOStyles.row,
53
+ alignItems: "center",
54
+ paddingVertical: 8,
55
+ height: 60,
56
+ borderRadius: 8,
57
+ paddingHorizontal: 12
58
+ },
59
+ textInputStyle: {
60
+ ...IOStyles.flex,
61
+ ...makeFontStyleObject("Regular", false, "ReadexPro"),
62
+ fontSize: 16,
63
+ marginTop: IOSpacingScale[2],
64
+ lineHeight: 24,
65
+ height: "100%"
66
+ },
67
+ textInputLabelWrapper: {
68
+ position: "absolute",
69
+ paddingHorizontal: 12,
70
+ zIndex: 10,
71
+ bottom: 0,
72
+ top: 0,
73
+ justifyContent: "center"
74
+ }
75
+ });
76
+
77
+ type InputTextHelperRow = Pick<
78
+ InputTextProps,
79
+ "value" | "counterLimit" | "bottomMessage" | "bottomMessageColor"
80
+ >;
81
+
82
+ const HelperRow = ({
83
+ value,
84
+ counterLimit,
85
+ bottomMessage,
86
+ bottomMessageColor = "grey-700"
87
+ }: InputTextHelperRow) => {
88
+ const valueCount = useMemo(() => value.length, [value]);
89
+
90
+ const helperRowStyle: ViewStyle = useMemo(() => {
91
+ if (counterLimit && bottomMessage) {
92
+ return {
93
+ justifyContent: "space-between"
94
+ };
95
+ }
96
+ if (counterLimit) {
97
+ return {
98
+ justifyContent: "flex-end"
99
+ };
100
+ }
101
+ if (bottomMessage) {
102
+ return {
103
+ justifyContent: "flex-start"
104
+ };
105
+ }
106
+ return {};
107
+ }, [counterLimit, bottomMessage]);
108
+
109
+ return (
110
+ <View
111
+ style={[
112
+ IOStyles.row,
113
+ {
114
+ alignItems: "center",
115
+ paddingHorizontal: 10
116
+ },
117
+ helperRowStyle
118
+ ]}
119
+ >
120
+ {bottomMessage && (
121
+ <LabelSmall weight="Regular" color={bottomMessageColor}>
122
+ {bottomMessage}
123
+ </LabelSmall>
124
+ )}
125
+ {counterLimit && (
126
+ <LabelSmall
127
+ weight="Regular"
128
+ color="grey-700"
129
+ >{`${valueCount} / ${counterLimit}`}</LabelSmall>
130
+ )}
131
+ </View>
132
+ );
133
+ };
134
+
135
+ export const TextInputBase = ({
136
+ disabled = false,
137
+ placeholder,
138
+ value = "",
139
+ onChangeText,
140
+ accessibilityLabel,
141
+ textInputProps,
142
+ inputTyoe = "default",
143
+ status,
144
+ icon,
145
+ rightElement,
146
+ counterLimit,
147
+ bottomMessage,
148
+ bottomMessageColor,
149
+ onBlur,
150
+ onFocus,
151
+ isPassword
152
+ }: InputTextProps) => {
153
+ const labelSharedValue = useSharedValue<boolean>(false);
154
+ const [inputStatus, setInputStatus] = React.useState<InputStatus>(
155
+ disabled ? "disabled" : "initial"
156
+ );
157
+ const isSecretInput = useMemo(() => isPassword, [isPassword]);
158
+ const inputRef = useRef<TextInput>(null);
159
+
160
+ useEffect(() => {
161
+ if (status) {
162
+ setInputStatus(status);
163
+ }
164
+ }, [status]);
165
+
166
+ const boxStyle: ViewStyle = useMemo(() => {
167
+ if (inputStatus === "focused") {
168
+ return {
169
+ borderColor: IOColors["blueIO-500"],
170
+ borderWidth: 2
171
+ };
172
+ }
173
+ if (inputStatus === "error") {
174
+ return {
175
+ borderColor: IOColors["error-600"],
176
+ borderWidth: 1
177
+ };
178
+ }
179
+ return {
180
+ borderColor: IOColors["grey-200"],
181
+ borderWidth: 1
182
+ };
183
+ }, [inputStatus]);
184
+
185
+ const animatedLabelProps = useAnimatedStyle(() => ({
186
+ fontSize: withTiming(labelSharedValue.value ? 12 : 16, {
187
+ duration: 300,
188
+ easing: Easing.elastic(0.85)
189
+ }),
190
+ transform: [
191
+ {
192
+ translateY: withTiming(labelSharedValue.value ? -14 : 0, {
193
+ duration: 300,
194
+ easing: Easing.elastic(0.85)
195
+ })
196
+ }
197
+ ]
198
+ }));
199
+
200
+ useEffect(() => {
201
+ if (value.length > 0) {
202
+ labelSharedValue.value = true;
203
+ } else {
204
+ if (inputStatus !== "focused") {
205
+ labelSharedValue.value = false;
206
+ }
207
+ }
208
+ }, [labelSharedValue, value, inputStatus]);
209
+
210
+ const onTextInputPress = () => {
211
+ if (disabled) {
212
+ return;
213
+ }
214
+ labelSharedValue.value = true;
215
+ setInputStatus("focused");
216
+ inputRef?.current?.focus();
217
+ };
218
+
219
+ const onChangeTextHandler = useCallback(
220
+ (text: string) => {
221
+ if (counterLimit && text.length > counterLimit) {
222
+ return;
223
+ }
224
+ onChangeText(text);
225
+ },
226
+ [counterLimit, onChangeText]
227
+ );
228
+
229
+ const onBlurHandler = useCallback(() => {
230
+ if (!value) {
231
+ labelSharedValue.value = false;
232
+ }
233
+ onBlur?.();
234
+ setInputStatus("initial");
235
+ }, [value, labelSharedValue, onBlur]);
236
+
237
+ const derivedInputProps = useMemo(
238
+ () => getInputPropsByType(inputTyoe),
239
+ [inputTyoe]
240
+ );
241
+
242
+ const inputValue = useMemo(
243
+ () =>
244
+ derivedInputProps && derivedInputProps.valueFormat
245
+ ? derivedInputProps.valueFormat(value)
246
+ : value,
247
+ [value, derivedInputProps]
248
+ );
249
+
250
+ return (
251
+ <>
252
+ <Pressable
253
+ onPress={onTextInputPress}
254
+ style={[
255
+ inputStatus === "disabled" ? { opacity: 0.5 } : {},
256
+ boxStyle,
257
+ styles.textInput
258
+ ]}
259
+ accessible={false}
260
+ accessibilityRole={"none"}
261
+ >
262
+ {icon && (
263
+ <>
264
+ <Icon name={icon} color="grey-300" size={24} />
265
+ <HSpacer size={8} />
266
+ </>
267
+ )}
268
+ <TextInput
269
+ {...(derivedInputProps
270
+ ? derivedInputProps.textInputProps
271
+ : textInputProps)}
272
+ accessible
273
+ editable={!disabled}
274
+ secureTextEntry={isSecretInput}
275
+ disableFullscreenUI={true}
276
+ blurOnSubmit={true}
277
+ ref={inputRef}
278
+ accessibilityState={{ disabled }}
279
+ accessibilityLabel={accessibilityLabel ?? placeholder}
280
+ onFocus={() => {
281
+ setInputStatus("focused");
282
+ labelSharedValue.value = true;
283
+ onFocus?.();
284
+ }}
285
+ maxLength={counterLimit}
286
+ onBlur={onBlurHandler}
287
+ value={inputValue}
288
+ onChangeText={onChangeTextHandler}
289
+ style={styles.textInputStyle}
290
+ />
291
+ {/** Left value is due to the absolute position of the label in order to let it
292
+ * translate to top on focus
293
+ */}
294
+ <Animated.View
295
+ style={[styles.textInputLabelWrapper, icon ? { left: 32 } : {}]}
296
+ >
297
+ <Animated.Text
298
+ numberOfLines={1}
299
+ accessible={false}
300
+ style={[
301
+ animatedLabelProps,
302
+ {
303
+ color: IOColors["grey-700"]
304
+ }
305
+ ]}
306
+ >
307
+ {placeholder}
308
+ </Animated.Text>
309
+ </Animated.View>
310
+ {rightElement && (
311
+ <View style={{ marginLeft: "auto" }}>
312
+ <HSpacer size={8} />
313
+ {rightElement}
314
+ </View>
315
+ )}
316
+ </Pressable>
317
+ {(bottomMessage || counterLimit) && (
318
+ <HelperRow
319
+ value={value}
320
+ bottomMessage={bottomMessage}
321
+ bottomMessageColor={bottomMessageColor}
322
+ counterLimit={counterLimit}
323
+ />
324
+ )}
325
+ </>
326
+ );
327
+ };
@@ -0,0 +1,36 @@
1
+ import * as React from "react";
2
+ import { IconButton } from "../buttons";
3
+ import { TextInputBase } from "./TextInputBase";
4
+
5
+ type TextInputPasswordProps = Omit<
6
+ React.ComponentProps<typeof TextInputBase>,
7
+ "isPassword"
8
+ >;
9
+
10
+ export const TextInputPassword = (props: TextInputPasswordProps) => {
11
+ const { onBlur, disabled } = props;
12
+ const [showPassword, setShowPassword] = React.useState<boolean>(false);
13
+
14
+ const rightElement = (
15
+ <IconButton
16
+ icon={showPassword ? "eyeShow" : "eyeHide"}
17
+ disabled={disabled}
18
+ onPress={() => setShowPassword(v => !v)}
19
+ accessibilityLabel="Toggle secret input"
20
+ />
21
+ );
22
+
23
+ const onBlurHandler = React.useCallback(() => {
24
+ setShowPassword(false);
25
+ onBlur?.();
26
+ }, [onBlur]);
27
+
28
+ return (
29
+ <TextInputBase
30
+ {...props}
31
+ onBlur={onBlurHandler}
32
+ rightElement={rightElement}
33
+ isPassword={!showPassword}
34
+ />
35
+ );
36
+ };
@@ -0,0 +1,71 @@
1
+ import * as React from "react";
2
+ import { IOIcons, Icon } from "../icons";
3
+ import { IOColors } from "../../core/IOColors";
4
+ import { triggerHaptic } from "../../functions";
5
+ import { TextInputBase } from "./TextInputBase";
6
+
7
+ type TextInputValidationProps = Omit<
8
+ React.ComponentProps<typeof TextInputBase>,
9
+ "rightElement" | "status" | "bottomMessageColor" | "isPassword"
10
+ > & {
11
+ onValidate: (value: string) => boolean;
12
+ errorMessage?: string;
13
+ };
14
+
15
+ export const TextInputValidation = (props: TextInputValidationProps) => {
16
+ const { onValidate, errorMessage, value, bottomMessage, onBlur, onFocus } =
17
+ props;
18
+ const [isValid, setIsValid] = React.useState<boolean | undefined>(undefined);
19
+
20
+ const onBlurHandler = React.useCallback(() => {
21
+ const validation = onValidate(value);
22
+ setIsValid(validation);
23
+ if (!validation) {
24
+ triggerHaptic("notificationError");
25
+ } else {
26
+ triggerHaptic("notificationSuccess");
27
+ }
28
+ onBlur?.();
29
+ }, [onValidate, value, onBlur]);
30
+
31
+ const onFocusHandler = React.useCallback(() => {
32
+ setIsValid(undefined);
33
+ onFocus?.();
34
+ }, [onFocus]);
35
+
36
+ const labelError = React.useMemo(
37
+ () => (isValid === false && errorMessage ? errorMessage : bottomMessage),
38
+ [isValid, errorMessage, bottomMessage]
39
+ );
40
+
41
+ const labelErrorColor: IOColors | undefined = React.useMemo(
42
+ () => (isValid === false && errorMessage ? "error-600" : undefined),
43
+ [isValid, errorMessage]
44
+ );
45
+
46
+ const rightIcon = React.useMemo(
47
+ () =>
48
+ isValid !== undefined && (
49
+ <Icon
50
+ name={(isValid ? "success" : "errorFilled") as IOIcons}
51
+ color={(isValid ? "green" : "error-600") as IOColors}
52
+ size={24}
53
+ />
54
+ ),
55
+ [isValid]
56
+ );
57
+
58
+ return (
59
+ <TextInputBase
60
+ {...props}
61
+ status={isValid === false ? "error" : undefined}
62
+ bottomMessage={labelError}
63
+ bottomMessageColor={labelErrorColor}
64
+ rightElement={rightIcon}
65
+ onBlur={onBlurHandler}
66
+ onFocus={onFocusHandler}
67
+ />
68
+ );
69
+ };
70
+
71
+ export default TextInputValidation;
@@ -0,0 +1,3 @@
1
+ export * from "./TextInput";
2
+ export * from "./TextInputPassword";
3
+ export * from "./TextInputValidation";
@@ -9,6 +9,11 @@ export const IOSpringValues = {
9
9
  mass: 0.5,
10
10
  stiffness: 300
11
11
  },
12
+ accordion: {
13
+ damping: 30,
14
+ mass: 1,
15
+ stiffness: 325
16
+ },
12
17
  /* Used by selection items (checkbox, radio, etc…) */
13
18
  selection: {
14
19
  damping: 10,
@@ -18,3 +18,4 @@ export const IOTagRadius: IORadiusScale = 6;
18
18
  export const IOBottomSheetHeaderRadius: IORadiusScale = 24;
19
19
  export const IOListItemIDPRadius: IORadiusScale = IODefaultRadius;
20
20
  export const IOBadgeRadius: IORadiusScale = 24;
21
+ export const IOAccordionRadius: IORadiusScale = IODefaultRadius;