@pagopa/io-app-design-system 7.0.1 → 7.1.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 (214) hide show
  1. package/lib/commonjs/components/alert/Alert.js +6 -5
  2. package/lib/commonjs/components/alert/Alert.js.map +1 -1
  3. package/lib/commonjs/components/banner/Banner.js +7 -6
  4. package/lib/commonjs/components/banner/Banner.js.map +1 -1
  5. package/lib/commonjs/components/buttons/IOButton/IOButton.js +10 -8
  6. package/lib/commonjs/components/buttons/IOButton/IOButton.js.map +1 -1
  7. package/lib/commonjs/components/icons/Icon.js +2 -2
  8. package/lib/commonjs/components/icons/Icon.js.map +1 -1
  9. package/lib/commonjs/components/icons/svg/IconStop.js +25 -0
  10. package/lib/commonjs/components/icons/svg/IconStop.js.map +1 -0
  11. package/lib/commonjs/components/icons/svg/originals/IconStop.svg +10 -0
  12. package/lib/commonjs/components/layout/ContentWrapper.js +5 -4
  13. package/lib/commonjs/components/layout/ContentWrapper.js.map +1 -1
  14. package/lib/commonjs/components/otpInput/BoxedInput.js +12 -8
  15. package/lib/commonjs/components/otpInput/BoxedInput.js.map +1 -1
  16. package/lib/commonjs/components/otpInput/OTPInput.js +6 -4
  17. package/lib/commonjs/components/otpInput/OTPInput.js.map +1 -1
  18. package/lib/commonjs/components/searchInput/SearchInput.js +8 -6
  19. package/lib/commonjs/components/searchInput/SearchInput.js.map +1 -1
  20. package/lib/commonjs/components/tabs/TabItem.js +6 -4
  21. package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
  22. package/lib/commonjs/components/textInput/TextInputValidation.js +5 -3
  23. package/lib/commonjs/components/textInput/TextInputValidation.js.map +1 -1
  24. package/lib/commonjs/components/typography/Body.js +8 -5
  25. package/lib/commonjs/components/typography/Body.js.map +1 -1
  26. package/lib/commonjs/components/typography/BodyMonospace.js +4 -5
  27. package/lib/commonjs/components/typography/BodyMonospace.js.map +1 -1
  28. package/lib/commonjs/components/typography/BodySmall.js +8 -5
  29. package/lib/commonjs/components/typography/BodySmall.js.map +1 -1
  30. package/lib/commonjs/components/typography/ButtonText.js +4 -5
  31. package/lib/commonjs/components/typography/ButtonText.js.map +1 -1
  32. package/lib/commonjs/components/typography/Caption.js +4 -5
  33. package/lib/commonjs/components/typography/Caption.js.map +1 -1
  34. package/lib/commonjs/components/typography/H1.js +4 -5
  35. package/lib/commonjs/components/typography/H1.js.map +1 -1
  36. package/lib/commonjs/components/typography/H2.js +4 -5
  37. package/lib/commonjs/components/typography/H2.js.map +1 -1
  38. package/lib/commonjs/components/typography/H3.js +4 -5
  39. package/lib/commonjs/components/typography/H3.js.map +1 -1
  40. package/lib/commonjs/components/typography/H4.js +4 -5
  41. package/lib/commonjs/components/typography/H4.js.map +1 -1
  42. package/lib/commonjs/components/typography/H5.js +4 -5
  43. package/lib/commonjs/components/typography/H5.js.map +1 -1
  44. package/lib/commonjs/components/typography/H6.js +4 -5
  45. package/lib/commonjs/components/typography/H6.js.map +1 -1
  46. package/lib/commonjs/components/typography/Hero.js +4 -5
  47. package/lib/commonjs/components/typography/Hero.js.map +1 -1
  48. package/lib/commonjs/components/typography/IOText.js +16 -14
  49. package/lib/commonjs/components/typography/IOText.js.map +1 -1
  50. package/lib/commonjs/components/typography/LabelMini.js +8 -5
  51. package/lib/commonjs/components/typography/LabelMini.js.map +1 -1
  52. package/lib/commonjs/components/typography/markdown/MdH1.js +4 -5
  53. package/lib/commonjs/components/typography/markdown/MdH1.js.map +1 -1
  54. package/lib/commonjs/components/typography/markdown/MdH2.js +4 -5
  55. package/lib/commonjs/components/typography/markdown/MdH2.js.map +1 -1
  56. package/lib/commonjs/components/typography/markdown/MdH3.js +4 -5
  57. package/lib/commonjs/components/typography/markdown/MdH3.js.map +1 -1
  58. package/lib/commonjs/context/IOThemeContextProvider.js +3 -4
  59. package/lib/commonjs/context/IOThemeContextProvider.js.map +1 -1
  60. package/lib/module/components/alert/Alert.js +5 -5
  61. package/lib/module/components/alert/Alert.js.map +1 -1
  62. package/lib/module/components/banner/Banner.js +6 -6
  63. package/lib/module/components/banner/Banner.js.map +1 -1
  64. package/lib/module/components/buttons/IOButton/IOButton.js +10 -9
  65. package/lib/module/components/buttons/IOButton/IOButton.js.map +1 -1
  66. package/lib/module/components/icons/Icon.js +2 -2
  67. package/lib/module/components/icons/Icon.js.map +1 -1
  68. package/lib/module/components/icons/svg/IconStop.js +21 -0
  69. package/lib/module/components/icons/svg/IconStop.js.map +1 -0
  70. package/lib/module/components/icons/svg/originals/IconStop.svg +10 -0
  71. package/lib/module/components/layout/ContentWrapper.js +4 -4
  72. package/lib/module/components/layout/ContentWrapper.js.map +1 -1
  73. package/lib/module/components/otpInput/BoxedInput.js +12 -8
  74. package/lib/module/components/otpInput/BoxedInput.js.map +1 -1
  75. package/lib/module/components/otpInput/OTPInput.js +6 -5
  76. package/lib/module/components/otpInput/OTPInput.js.map +1 -1
  77. package/lib/module/components/searchInput/SearchInput.js +8 -7
  78. package/lib/module/components/searchInput/SearchInput.js.map +1 -1
  79. package/lib/module/components/tabs/TabItem.js +6 -5
  80. package/lib/module/components/tabs/TabItem.js.map +1 -1
  81. package/lib/module/components/textInput/TextInputValidation.js +5 -4
  82. package/lib/module/components/textInput/TextInputValidation.js.map +1 -1
  83. package/lib/module/components/typography/Body.js +7 -5
  84. package/lib/module/components/typography/Body.js.map +1 -1
  85. package/lib/module/components/typography/BodyMonospace.js +3 -5
  86. package/lib/module/components/typography/BodyMonospace.js.map +1 -1
  87. package/lib/module/components/typography/BodySmall.js +7 -5
  88. package/lib/module/components/typography/BodySmall.js.map +1 -1
  89. package/lib/module/components/typography/ButtonText.js +3 -5
  90. package/lib/module/components/typography/ButtonText.js.map +1 -1
  91. package/lib/module/components/typography/Caption.js +3 -5
  92. package/lib/module/components/typography/Caption.js.map +1 -1
  93. package/lib/module/components/typography/H1.js +3 -5
  94. package/lib/module/components/typography/H1.js.map +1 -1
  95. package/lib/module/components/typography/H2.js +3 -5
  96. package/lib/module/components/typography/H2.js.map +1 -1
  97. package/lib/module/components/typography/H3.js +3 -5
  98. package/lib/module/components/typography/H3.js.map +1 -1
  99. package/lib/module/components/typography/H4.js +3 -5
  100. package/lib/module/components/typography/H4.js.map +1 -1
  101. package/lib/module/components/typography/H5.js +3 -5
  102. package/lib/module/components/typography/H5.js.map +1 -1
  103. package/lib/module/components/typography/H6.js +3 -5
  104. package/lib/module/components/typography/H6.js.map +1 -1
  105. package/lib/module/components/typography/Hero.js +3 -5
  106. package/lib/module/components/typography/Hero.js.map +1 -1
  107. package/lib/module/components/typography/IOText.js +16 -15
  108. package/lib/module/components/typography/IOText.js.map +1 -1
  109. package/lib/module/components/typography/LabelMini.js +7 -5
  110. package/lib/module/components/typography/LabelMini.js.map +1 -1
  111. package/lib/module/components/typography/markdown/MdH1.js +3 -5
  112. package/lib/module/components/typography/markdown/MdH1.js.map +1 -1
  113. package/lib/module/components/typography/markdown/MdH2.js +3 -5
  114. package/lib/module/components/typography/markdown/MdH2.js.map +1 -1
  115. package/lib/module/components/typography/markdown/MdH3.js +3 -5
  116. package/lib/module/components/typography/markdown/MdH3.js.map +1 -1
  117. package/lib/module/context/IOThemeContextProvider.js +3 -4
  118. package/lib/module/context/IOThemeContextProvider.js.map +1 -1
  119. package/lib/typescript/components/alert/Alert.d.ts +3 -1
  120. package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
  121. package/lib/typescript/components/banner/Banner.d.ts +3 -1
  122. package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
  123. package/lib/typescript/components/buttons/IOButton/IOButton.d.ts +3 -2
  124. package/lib/typescript/components/buttons/IOButton/IOButton.d.ts.map +1 -1
  125. package/lib/typescript/components/icons/Icon.d.ts +1 -1
  126. package/lib/typescript/components/icons/svg/IconStop.d.ts +4 -0
  127. package/lib/typescript/components/icons/svg/IconStop.d.ts.map +1 -0
  128. package/lib/typescript/components/layout/ContentWrapper.d.ts +10 -6
  129. package/lib/typescript/components/layout/ContentWrapper.d.ts.map +1 -1
  130. package/lib/typescript/components/otpInput/BoxedInput.d.ts.map +1 -1
  131. package/lib/typescript/components/otpInput/OTPInput.d.ts +3 -1
  132. package/lib/typescript/components/otpInput/OTPInput.d.ts.map +1 -1
  133. package/lib/typescript/components/searchInput/SearchInput.d.ts +3 -1
  134. package/lib/typescript/components/searchInput/SearchInput.d.ts.map +1 -1
  135. package/lib/typescript/components/tabs/TabItem.d.ts +3 -11
  136. package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -1
  137. package/lib/typescript/components/textInput/TextInputValidation.d.ts +7 -24
  138. package/lib/typescript/components/textInput/TextInputValidation.d.ts.map +1 -1
  139. package/lib/typescript/components/typography/Body.d.ts +4 -2
  140. package/lib/typescript/components/typography/Body.d.ts.map +1 -1
  141. package/lib/typescript/components/typography/BodyMonospace.d.ts +2 -8
  142. package/lib/typescript/components/typography/BodyMonospace.d.ts.map +1 -1
  143. package/lib/typescript/components/typography/BodySmall.d.ts +4 -2
  144. package/lib/typescript/components/typography/BodySmall.d.ts.map +1 -1
  145. package/lib/typescript/components/typography/ButtonText.d.ts +2 -8
  146. package/lib/typescript/components/typography/ButtonText.d.ts.map +1 -1
  147. package/lib/typescript/components/typography/Caption.d.ts +2 -8
  148. package/lib/typescript/components/typography/Caption.d.ts.map +1 -1
  149. package/lib/typescript/components/typography/H1.d.ts +2 -8
  150. package/lib/typescript/components/typography/H1.d.ts.map +1 -1
  151. package/lib/typescript/components/typography/H2.d.ts +6 -10
  152. package/lib/typescript/components/typography/H2.d.ts.map +1 -1
  153. package/lib/typescript/components/typography/H3.d.ts +2 -8
  154. package/lib/typescript/components/typography/H3.d.ts.map +1 -1
  155. package/lib/typescript/components/typography/H4.d.ts +2 -8
  156. package/lib/typescript/components/typography/H4.d.ts.map +1 -1
  157. package/lib/typescript/components/typography/H5.d.ts +2 -8
  158. package/lib/typescript/components/typography/H5.d.ts.map +1 -1
  159. package/lib/typescript/components/typography/H6.d.ts +2 -8
  160. package/lib/typescript/components/typography/H6.d.ts.map +1 -1
  161. package/lib/typescript/components/typography/Hero.d.ts +2 -8
  162. package/lib/typescript/components/typography/Hero.d.ts.map +1 -1
  163. package/lib/typescript/components/typography/IOText.d.ts +5 -5
  164. package/lib/typescript/components/typography/IOText.d.ts.map +1 -1
  165. package/lib/typescript/components/typography/LabelMini.d.ts +4 -2
  166. package/lib/typescript/components/typography/LabelMini.d.ts.map +1 -1
  167. package/lib/typescript/components/typography/markdown/MdH1.d.ts +2 -8
  168. package/lib/typescript/components/typography/markdown/MdH1.d.ts.map +1 -1
  169. package/lib/typescript/components/typography/markdown/MdH2.d.ts +2 -8
  170. package/lib/typescript/components/typography/markdown/MdH2.d.ts.map +1 -1
  171. package/lib/typescript/components/typography/markdown/MdH3.d.ts +2 -8
  172. package/lib/typescript/components/typography/markdown/MdH3.d.ts.map +1 -1
  173. package/lib/typescript/context/IOThemeContextProvider.d.ts.map +1 -1
  174. package/package.json +6 -7
  175. package/src/components/alert/Alert.tsx +108 -112
  176. package/src/components/banner/Banner.tsx +121 -125
  177. package/src/components/buttons/IOButton/IOButton.tsx +204 -216
  178. package/src/components/icons/Icon.tsx +2 -2
  179. package/src/components/icons/svg/IconStop.tsx +13 -0
  180. package/src/components/icons/svg/originals/IconStop.svg +10 -0
  181. package/src/components/layout/ContentWrapper.tsx +21 -24
  182. package/src/components/otpInput/BoxedInput.tsx +15 -11
  183. package/src/components/otpInput/OTPInput.tsx +156 -167
  184. package/src/components/searchInput/SearchInput.tsx +208 -217
  185. package/src/components/tabs/TabItem.tsx +143 -146
  186. package/src/components/textInput/TextInputValidation.tsx +116 -122
  187. package/src/components/typography/Body.tsx +51 -52
  188. package/src/components/typography/BodyMonospace.tsx +19 -24
  189. package/src/components/typography/BodySmall.tsx +51 -52
  190. package/src/components/typography/ButtonText.tsx +14 -20
  191. package/src/components/typography/Caption.tsx +18 -23
  192. package/src/components/typography/H1.tsx +12 -20
  193. package/src/components/typography/H2.tsx +16 -23
  194. package/src/components/typography/H3.tsx +12 -20
  195. package/src/components/typography/H4.tsx +12 -20
  196. package/src/components/typography/H5.tsx +16 -24
  197. package/src/components/typography/H6.tsx +13 -21
  198. package/src/components/typography/Hero.tsx +14 -19
  199. package/src/components/typography/IOText.tsx +54 -59
  200. package/src/components/typography/LabelMini.tsx +45 -49
  201. package/src/components/typography/markdown/MdH1.tsx +14 -19
  202. package/src/components/typography/markdown/MdH2.tsx +14 -19
  203. package/src/components/typography/markdown/MdH3.tsx +14 -19
  204. package/src/context/IOThemeContextProvider.tsx +4 -12
  205. package/lib/commonjs/components/icons/svg/IconPause.js +0 -28
  206. package/lib/commonjs/components/icons/svg/IconPause.js.map +0 -1
  207. package/lib/commonjs/components/icons/svg/originals/IconPause.svg +0 -4
  208. package/lib/module/components/icons/svg/IconPause.js +0 -24
  209. package/lib/module/components/icons/svg/IconPause.js.map +0 -1
  210. package/lib/module/components/icons/svg/originals/IconPause.svg +0 -4
  211. package/lib/typescript/components/icons/svg/IconPause.d.ts +0 -4
  212. package/lib/typescript/components/icons/svg/IconPause.d.ts.map +0 -1
  213. package/src/components/icons/svg/IconPause.tsx +0 -17
  214. package/src/components/icons/svg/originals/IconPause.svg +0 -4
@@ -1,12 +1,6 @@
1
- import { View } from "react-native";
2
- import { IOTextProps } from "../IOText";
1
+ import { TypographicStyleProps } from "../IOText";
3
2
  /**
4
3
  * `MdH3` typographic style
5
4
  */
6
- export declare const MdH3: import("react").ForwardRefExoticComponent<Omit<IOTextProps, "style" | "lineHeight" | "fontStyle" | "size" | "color" | "font" | "weight"> & {
7
- textStyle?: import("../IOText").IOTextStyle;
8
- style?: import("../IOText").IOTextStyle;
9
- } & {
10
- color?: "white" | "grey-50" | "grey-100" | "grey-200" | "grey-300" | "grey-450" | "grey-650" | "grey-700" | "grey-850" | "grey-900" | "black" | "blueIO-850" | "blueIO-600" | "blueIO-500" | "blueIO-400" | "blueIO-300" | "blueIO-200" | "blueIO-150" | "blueIO-100" | "blueIO-50" | "hanPurple-850" | "hanPurple-500" | "hanPurple-250" | "hanPurple-100" | "hanPurple-50" | "turquoise-850" | "turquoise-500" | "turquoise-450" | "turquoise-300" | "turquoise-150" | "turquoise-100" | "turquoise-50" | "error-850" | "error-600" | "error-500" | "error-400" | "error-100" | "warning-850" | "warning-700" | "warning-500" | "warning-400" | "warning-100" | "success-850" | "success-700" | "success-500" | "success-400" | "success-100" | "info-850" | "info-700" | "info-500" | "info-400" | "info-100" | "blueItalia-850" | "blueItalia-600" | "blueItalia-500" | "blueItalia-300" | "blueItalia-100" | "blueItalia-50" | undefined;
11
- } & import("react").RefAttributes<View>>;
5
+ export declare const MdH3: ({ color: customColor, ...props }: TypographicStyleProps) => import("react/jsx-runtime").JSX.Element;
12
6
  //# sourceMappingURL=MdH3.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MdH3.d.ts","sourceRoot":"","sources":["../../../../../src/components/typography/markdown/MdH3.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAU,WAAW,EAAyB,MAAM,WAAW,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,IAAI;;;;;wCAkBhB,CAAC"}
1
+ {"version":3,"file":"MdH3.d.ts","sourceRoot":"","sources":["../../../../../src/components/typography/markdown/MdH3.tsx"],"names":[],"mappings":"AACA,OAAO,EAAuB,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,IAAI,GAAI,kCAGlB,qBAAqB,4CAYvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"IOThemeContextProvider.d.ts","sourceRoot":"","sources":["../../../src/context/IOThemeContextProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,iBAAiB,EAIlB,MAAM,OAAO,CAAC;AACf,OAAO,EAAc,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,OAAO,EAA6B,MAAM,kBAAkB,CAAC;AAEtE,eAAO,MAAM,QAAQ;;;CAGpB,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,SAAS,EAAE,eAAe,CAAC;IAC3B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,kBAAkB,CAMnD,CAAC;AAEL,eAAO,MAAM,iBAAiB,0BAAmC,CAAC;AAElE,eAAO,MAAM,UAAU,eAAkC,CAAC;AAE1D,KAAK,2BAA2B,GAAG;IACjC,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,qBAGpC,iBAAiB,CAAC,2BAA2B,CAAC,4CAyBhD,CAAC"}
1
+ {"version":3,"file":"IOThemeContextProvider.d.ts","sourceRoot":"","sources":["../../../src/context/IOThemeContextProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,iBAAiB,EAIlB,MAAM,OAAO,CAAC;AACf,OAAO,EAAc,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,OAAO,EAA6B,MAAM,kBAAkB,CAAC;AAEtE,eAAO,MAAM,QAAQ;;;CAA6C,CAAC;AAEnE,KAAK,kBAAkB,GAAG;IACxB,SAAS,EAAE,eAAe,CAAC;IAC3B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,kBAAkB,CAMnD,CAAC;AAEL,eAAO,MAAM,iBAAiB,0BAAmC,CAAC;AAElE,eAAO,MAAM,UAAU,eAAkC,CAAC;AAE1D,KAAK,2BAA2B,GAAG;IACjC,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,qBAGpC,iBAAiB,CAAC,2BAA2B,CAAC,4CAoBhD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-app-design-system",
3
- "version": "7.0.1",
3
+ "version": "7.1.0",
4
4
  "description": "The library defining the core components of the design system of @pagopa/io-app",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -63,14 +63,13 @@
63
63
  "@react-native-community/eslint-config": "^3.0.2",
64
64
  "@react-native/babel-preset": "^0.82.1",
65
65
  "@release-it/conventional-changelog": "^5.0.0",
66
- "@stylistic/eslint-plugin": "^2.12.1",
67
66
  "@svgr/core": "^8.1.0",
68
67
  "@svgr/plugin-jsx": "^8.1.0",
69
68
  "@svgr/plugin-svgo": "^8.1.0",
70
69
  "@testing-library/react-native": "^13.2.0",
71
70
  "@types/jest": "^29.5.14",
72
71
  "@types/markdown-it": "^14.1.2",
73
- "@types/react": "^19.2.0",
72
+ "@types/react": "^19.1.0",
74
73
  "@types/react-test-renderer": "19.1.0",
75
74
  "babel-jest": "^29.7.0",
76
75
  "babel-plugin-module-resolver": "^5.0.2",
@@ -87,16 +86,16 @@
87
86
  "jest": "^29.6.3",
88
87
  "pod-install": "^0.1.0",
89
88
  "prettier": "^2.0.5",
90
- "react": "19.2.0",
91
- "react-native": "0.83.4",
89
+ "react": "19.1.0",
90
+ "react-native": "0.81.5",
92
91
  "react-native-builder-bob": "^0.38.0",
93
- "react-test-renderer": "19.2.0",
92
+ "react-test-renderer": "19.1.0",
94
93
  "release-it": "^15.0.0",
95
94
  "svgo": "^3.0.2",
96
95
  "typescript": "^5.8.3"
97
96
  },
98
97
  "peerDependencies": {
99
- "react": "*",
98
+ "react": "^19.0.0",
100
99
  "react-native": "*",
101
100
  "react-native-easing-gradient": "*",
102
101
  "react-native-gesture-handler": "*",
@@ -1,4 +1,4 @@
1
- import { JSX, forwardRef } from "react";
1
+ import { JSX, Ref } from "react";
2
2
  import {
3
3
  ColorValue,
4
4
  GestureResponderEvent,
@@ -24,6 +24,7 @@ const ICON_SIZE: IOIconSizeScale = 24;
24
24
  const [padding, paddingFullWidth] = IOAlertSpacing;
25
25
 
26
26
  type AlertProps = WithTestID<{
27
+ ref?: Ref<View>;
27
28
  variant: "error" | "warning" | "info" | "success";
28
29
  content: string;
29
30
  fullWidth?: boolean;
@@ -105,123 +106,118 @@ const mapVariantStatesDarkMode: Record<
105
106
  }
106
107
  };
107
108
 
108
- export const Alert = forwardRef<View, AlertType>(
109
- (
110
- {
111
- variant,
112
- content,
113
- action,
114
- onPress,
115
- fullWidth = false,
116
- accessibilityHint,
117
- testID
118
- }: AlertType,
119
- viewRef
120
- ): JSX.Element => {
121
- const { onPressIn, onPressOut, scaleAnimatedStyle } =
122
- useScaleAnimation("medium");
123
- const { dynamicFontScale, spacingScaleMultiplier } =
124
- useIOFontDynamicScale();
125
- const { themeType } = useIOThemeContext();
126
-
127
- const paddingDefaultVariant: ViewStyle = {
128
- padding,
129
- borderRadius: IOAlertRadius * dynamicFontScale * spacingScaleMultiplier,
130
- borderCurve: "continuous"
131
- };
132
-
133
- const mapVariantStates =
134
- themeType === "light"
135
- ? mapVariantStatesLightMode
136
- : mapVariantStatesDarkMode;
137
-
138
- const renderMainBlock = () => (
139
- <HStack
140
- space={IOVisualCostants.iconMargin as IOSpacer}
141
- allowScaleSpacing
142
- style={{ alignItems: "center" }}
143
- >
144
- <Icon
145
- allowFontScaling
146
- name={mapVariantStates[variant].icon}
147
- size={ICON_SIZE}
148
- color={mapVariantStates[variant].foreground}
149
- />
150
- {/* Sadly we don't have specific alignments style for text
109
+ export const Alert = ({
110
+ variant,
111
+ content,
112
+ action,
113
+ onPress,
114
+ fullWidth = false,
115
+ accessibilityHint,
116
+ ref: viewRef,
117
+ testID
118
+ }: AlertType): JSX.Element => {
119
+ const { onPressIn, onPressOut, scaleAnimatedStyle } =
120
+ useScaleAnimation("medium");
121
+ const { dynamicFontScale, spacingScaleMultiplier } = useIOFontDynamicScale();
122
+ const { themeType } = useIOThemeContext();
123
+
124
+ const paddingDefaultVariant: ViewStyle = {
125
+ padding,
126
+ borderRadius: IOAlertRadius * dynamicFontScale * spacingScaleMultiplier,
127
+ borderCurve: "continuous"
128
+ };
129
+
130
+ const mapVariantStates =
131
+ themeType === "light"
132
+ ? mapVariantStatesLightMode
133
+ : mapVariantStatesDarkMode;
134
+
135
+ const renderMainBlock = () => (
136
+ <HStack
137
+ space={IOVisualCostants.iconMargin as IOSpacer}
138
+ allowScaleSpacing
139
+ style={{ alignItems: "center" }}
140
+ >
141
+ <Icon
142
+ allowFontScaling
143
+ name={mapVariantStates[variant].icon}
144
+ size={ICON_SIZE}
145
+ color={mapVariantStates[variant].foreground}
146
+ />
147
+ {/* Sadly we don't have specific alignments style for text
151
148
  in React Native, like `text-box-trim` for CSS. So we
152
149
  have to put these magic numbers after manual adjustments.
153
150
  Tested on both Android and iOS. */}
154
- <View
155
- style={{
156
- marginTop: -4 * dynamicFontScale,
157
- marginBottom: -4 * dynamicFontScale,
158
- flex: 1
159
- }}
160
- >
161
- <VStack space={8} allowScaleSpacing>
162
- <Body
151
+ <View
152
+ style={{
153
+ marginTop: -4 * dynamicFontScale,
154
+ marginBottom: -4 * dynamicFontScale,
155
+ flex: 1
156
+ }}
157
+ >
158
+ <VStack space={8} allowScaleSpacing>
159
+ <Body
160
+ color={mapVariantStates[variant].foreground}
161
+ weight={"Regular"}
162
+ accessibilityRole="text"
163
+ >
164
+ {content}
165
+ </Body>
166
+ {action && (
167
+ <ButtonText
163
168
  color={mapVariantStates[variant].foreground}
164
- weight={"Regular"}
165
- accessibilityRole="text"
169
+ numberOfLines={1}
170
+ ellipsizeMode="tail"
166
171
  >
167
- {content}
168
- </Body>
169
- {action && (
170
- <ButtonText
171
- color={mapVariantStates[variant].foreground}
172
- numberOfLines={1}
173
- ellipsizeMode="tail"
174
- >
175
- {action}
176
- </ButtonText>
177
- )}
178
- </VStack>
179
- </View>
180
- </HStack>
181
- );
182
-
183
- const StaticComponent = () => (
184
- <View
185
- ref={viewRef}
172
+ {action}
173
+ </ButtonText>
174
+ )}
175
+ </VStack>
176
+ </View>
177
+ </HStack>
178
+ );
179
+
180
+ const StaticComponent = () => (
181
+ <View
182
+ ref={viewRef}
183
+ style={[
184
+ fullWidth ? { padding: paddingFullWidth } : paddingDefaultVariant,
185
+ { backgroundColor: mapVariantStates[variant].background }
186
+ ]}
187
+ testID={testID}
188
+ accessible={false}
189
+ accessibilityRole="alert"
190
+ accessibilityHint={accessibilityHint}
191
+ >
192
+ {renderMainBlock()}
193
+ </View>
194
+ );
195
+
196
+ const PressableButton = () => (
197
+ <Pressable
198
+ ref={viewRef}
199
+ testID={testID}
200
+ onPress={onPress}
201
+ onPressIn={onPressIn}
202
+ onPressOut={onPressOut}
203
+ onTouchEnd={onPressOut}
204
+ // A11y related props
205
+ accessible={true}
206
+ accessibilityHint={accessibilityHint}
207
+ accessibilityRole={"button"}
208
+ >
209
+ <Animated.View
186
210
  style={[
187
- fullWidth ? { padding } : paddingDefaultVariant,
188
- { backgroundColor: mapVariantStates[variant].background }
211
+ fullWidth ? { padding: paddingFullWidth } : paddingDefaultVariant,
212
+ { backgroundColor: mapVariantStates[variant].background },
213
+ // Disable pressed animation when component is full width
214
+ !fullWidth && scaleAnimatedStyle
189
215
  ]}
190
- testID={testID}
191
- accessible={false}
192
- accessibilityRole="alert"
193
- accessibilityHint={accessibilityHint}
194
216
  >
195
217
  {renderMainBlock()}
196
- </View>
197
- );
198
-
199
- const PressableButton = () => (
200
- <Pressable
201
- ref={viewRef}
202
- testID={testID}
203
- onPress={onPress}
204
- onPressIn={onPressIn}
205
- onPressOut={onPressOut}
206
- onTouchEnd={onPressOut}
207
- // A11y related props
208
- accessible={true}
209
- accessibilityHint={accessibilityHint}
210
- accessibilityRole={"button"}
211
- >
212
- <Animated.View
213
- style={[
214
- fullWidth ? { padding: paddingFullWidth } : paddingDefaultVariant,
215
- { backgroundColor: mapVariantStates[variant].background },
216
- // Disable pressed animation when component is full width
217
- !fullWidth && scaleAnimatedStyle
218
- ]}
219
- >
220
- {renderMainBlock()}
221
- </Animated.View>
222
- </Pressable>
223
- );
224
-
225
- return action ? <PressableButton /> : <StaticComponent />;
226
- }
227
- );
218
+ </Animated.View>
219
+ </Pressable>
220
+ );
221
+
222
+ return action ? <PressableButton /> : <StaticComponent />;
223
+ };
@@ -1,4 +1,4 @@
1
- import { forwardRef } from "react";
1
+ import { Ref } from "react";
2
2
  import {
3
3
  AccessibilityRole,
4
4
  GestureResponderEvent,
@@ -51,6 +51,7 @@ const styles = StyleSheet.create({
51
51
  /* Component Types */
52
52
 
53
53
  type BaseBannerProps = WithTestID<{
54
+ ref?: Ref<View>;
54
55
  color: "neutral" | "turquoise";
55
56
  pictogramName: IOPictogramsBleed;
56
57
  // A11y related props
@@ -123,140 +124,135 @@ const mapBackgroundColorDarkMode: Record<
123
124
  turquoise: "turquoise-300"
124
125
  };
125
126
 
126
- export const Banner = forwardRef<View, Banner>(
127
- (
128
- {
129
- color,
130
- pictogramName,
131
- title,
132
- content,
133
- action,
134
- labelClose,
135
- onPress,
136
- onClose,
137
- accessibilityHint,
138
- accessibilityLabel,
139
- accessibilityRole = "button",
140
- testID
141
- }: Banner,
142
- viewRef
143
- ) => {
144
- const { onPressIn, onPressOut, scaleAnimatedStyle } =
145
- useScaleAnimation("medium");
146
- const { themeType } = useIOThemeContext();
147
- const theme = useIOTheme();
127
+ export const Banner = ({
128
+ color,
129
+ pictogramName,
130
+ title,
131
+ content,
132
+ action,
133
+ labelClose,
134
+ onPress,
135
+ onClose,
136
+ accessibilityHint,
137
+ accessibilityLabel,
138
+ accessibilityRole = "button",
139
+ ref: viewRef,
140
+ testID
141
+ }: Banner) => {
142
+ const { onPressIn, onPressOut, scaleAnimatedStyle } =
143
+ useScaleAnimation("medium");
144
+ const { themeType } = useIOThemeContext();
145
+ const theme = useIOTheme();
148
146
 
149
- // Dynamic colors
150
- const colorTitle: IOColors =
151
- themeType === "dark" ? "grey-50" : "blueIO-850";
152
- const colorCloseButton: IconButton["color"] =
153
- themeType === "dark" ? "contrast" : "neutral";
154
- const colorMainButton =
155
- themeType === "dark" ? "blueIO-200" : theme["interactiveElem-default"];
147
+ // Dynamic colors
148
+ const colorTitle: IOColors = themeType === "dark" ? "grey-50" : "blueIO-850";
149
+ const colorCloseButton: IconButton["color"] =
150
+ themeType === "dark" ? "contrast" : "neutral";
151
+ const colorMainButton =
152
+ themeType === "dark" ? "blueIO-200" : theme["interactiveElem-default"];
156
153
 
157
- const dynamicContainerStyles: ViewStyle = {
158
- backgroundColor:
159
- themeType === "dark"
160
- ? hexToRgba(IOColors[mapBackgroundColorDarkMode[color]], 0.1)
161
- : IOColors[mapBackgroundColorLightMode[color]]
162
- };
154
+ const dynamicContainerStyles: ViewStyle = {
155
+ backgroundColor:
156
+ themeType === "dark"
157
+ ? hexToRgba(IOColors[mapBackgroundColorDarkMode[color]], 0.1)
158
+ : IOColors[mapBackgroundColorLightMode[color]]
159
+ };
163
160
 
164
- /* Generates a complete fallbackAccessibilityLabel by concatenating the title, content, and action
161
+ /* Generates a complete fallbackAccessibilityLabel by concatenating the title, content, and action
165
162
  if they are present. */
166
- const fallbackAccessibilityLabel = [title, content, action]
167
- .filter(Boolean)
168
- .join(" ");
163
+ const fallbackAccessibilityLabel = [title, content, action]
164
+ .filter(Boolean)
165
+ .join(" ");
169
166
 
170
- const renderMainBlock = () => (
171
- <>
172
- <View
173
- style={{ flex: 1, alignSelf: "center", gap: 4 }}
174
- accessible={true}
175
- // A11y related props
176
- accessibilityLabel={accessibilityLabel ?? fallbackAccessibilityLabel}
177
- accessibilityHint={accessibilityHint}
178
- accessibilityRole={action !== undefined ? accessibilityRole : "text"}
179
- >
180
- {title && <H6 color={colorTitle}>{title}</H6>}
181
- {content && (
182
- <BodySmall color={theme["textBody-tertiary"]} weight={"Regular"}>
183
- {content}
184
- </BodySmall>
185
- )}
186
- {action && (
187
- /* Disable pointer events to avoid
167
+ const renderMainBlock = () => (
168
+ <>
169
+ <View
170
+ style={{ flex: 1, alignSelf: "center", gap: 4 }}
171
+ accessible={true}
172
+ // A11y related props
173
+ accessibilityLabel={accessibilityLabel ?? fallbackAccessibilityLabel}
174
+ accessibilityHint={accessibilityHint}
175
+ accessibilityRole={action !== undefined ? accessibilityRole : "text"}
176
+ >
177
+ {title && <H6 color={colorTitle}>{title}</H6>}
178
+ {content && (
179
+ <BodySmall color={theme["textBody-tertiary"]} weight={"Regular"}>
180
+ {content}
181
+ </BodySmall>
182
+ )}
183
+ {action && (
184
+ /* Disable pointer events to avoid
188
185
  pressed state on the button */
189
- <Pressable
190
- pointerEvents="none"
186
+ <Pressable
187
+ pointerEvents="none"
188
+ importantForAccessibility="no-hide-descendants"
189
+ accessible={true}
190
+ accessibilityElementsHidden
191
+ accessibilityLabel={action}
192
+ accessibilityRole="button"
193
+ onPress={onPress}
194
+ >
195
+ <VSpacer size={8} />
196
+ <IOText
197
+ weight="Semibold"
198
+ color={colorMainButton}
199
+ size={buttonTextFontSize}
200
+ numberOfLines={1}
201
+ ellipsizeMode="tail"
202
+ // A11y
203
+ accessible={false}
191
204
  importantForAccessibility="no-hide-descendants"
192
- accessible={true}
193
- accessibilityElementsHidden
194
- accessibilityLabel={action}
195
- accessibilityRole="button"
196
- onPress={onPress}
205
+ accessibilityElementsHidden={true}
197
206
  >
198
- <VSpacer size={8} />
199
- <IOText
200
- weight="Semibold"
201
- color={colorMainButton}
202
- size={buttonTextFontSize}
203
- numberOfLines={1}
204
- ellipsizeMode="tail"
205
- // A11y
206
- accessible={false}
207
- importantForAccessibility="no-hide-descendants"
208
- accessibilityElementsHidden={true}
209
- >
210
- {action}
211
- </IOText>
212
- </Pressable>
213
- )}
214
- </View>
215
- <View style={[styles.bleedPictogram, { alignSelf: "center" }]}>
216
- <PictogramBleed name={pictogramName} size={sizePictogram} />
217
- </View>
218
- {onClose && labelClose && (
219
- <View style={styles.closeIconButton}>
220
- <IconButton
221
- icon="closeSmall"
222
- color={colorCloseButton}
223
- onPress={onClose}
224
- accessibilityLabel={labelClose}
225
- />
226
- </View>
207
+ {action}
208
+ </IOText>
209
+ </Pressable>
227
210
  )}
228
- </>
229
- );
230
-
231
- const PressableButton = () => (
232
- <Pressable
233
- ref={viewRef}
234
- testID={testID}
235
- onPress={onPress}
236
- onPressIn={onPressIn}
237
- onPressOut={onPressOut}
238
- accessible={false}
239
- >
240
- <Animated.View
241
- style={[styles.container, dynamicContainerStyles, scaleAnimatedStyle]}
242
- >
243
- {renderMainBlock()}
244
- </Animated.View>
245
- </Pressable>
246
- );
211
+ </View>
212
+ <View style={[styles.bleedPictogram, { alignSelf: "center" }]}>
213
+ <PictogramBleed name={pictogramName} size={sizePictogram} />
214
+ </View>
215
+ {onClose && labelClose && (
216
+ <View style={styles.closeIconButton}>
217
+ <IconButton
218
+ icon="closeSmall"
219
+ color={colorCloseButton}
220
+ onPress={onClose}
221
+ accessibilityLabel={labelClose}
222
+ />
223
+ </View>
224
+ )}
225
+ </>
226
+ );
247
227
 
248
- const StaticComponent = () => (
249
- <View
250
- ref={viewRef}
251
- testID={testID}
252
- style={[styles.container, dynamicContainerStyles]}
253
- // A11y related props
254
- accessible={false}
228
+ const PressableButton = () => (
229
+ <Pressable
230
+ ref={viewRef}
231
+ testID={testID}
232
+ onPress={onPress}
233
+ onPressIn={onPressIn}
234
+ onPressOut={onPressOut}
235
+ accessible={false}
236
+ >
237
+ <Animated.View
238
+ style={[styles.container, dynamicContainerStyles, scaleAnimatedStyle]}
255
239
  >
256
240
  {renderMainBlock()}
257
- </View>
258
- );
241
+ </Animated.View>
242
+ </Pressable>
243
+ );
259
244
 
260
- return action ? <PressableButton /> : <StaticComponent />;
261
- }
262
- );
245
+ const StaticComponent = () => (
246
+ <View
247
+ ref={viewRef}
248
+ testID={testID}
249
+ style={[styles.container, dynamicContainerStyles]}
250
+ // A11y related props
251
+ accessible={false}
252
+ >
253
+ {renderMainBlock()}
254
+ </View>
255
+ );
256
+
257
+ return action ? <PressableButton /> : <StaticComponent />;
258
+ };