@pagopa/io-app-design-system 1.42.0 → 2.0.0-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 (349) hide show
  1. package/lib/commonjs/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +8 -32
  2. package/lib/commonjs/components/accordion/AccordionItem.js +1 -10
  3. package/lib/commonjs/components/accordion/AccordionItem.js.map +1 -1
  4. package/lib/commonjs/components/alert/Alert.js +3 -16
  5. package/lib/commonjs/components/alert/Alert.js.map +1 -1
  6. package/lib/commonjs/components/badge/Badge.js +13 -21
  7. package/lib/commonjs/components/badge/Badge.js.map +1 -1
  8. package/lib/commonjs/components/badge/__test__/__snapshots__/badge.test.tsx.snap +16 -16
  9. package/lib/commonjs/components/badge/__test__/badge.test.js.map +1 -1
  10. package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +14 -38
  11. package/lib/commonjs/components/buttons/ButtonLink.js +10 -24
  12. package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
  13. package/lib/commonjs/components/buttons/ButtonOutline.js +14 -24
  14. package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
  15. package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +45 -60
  16. package/lib/commonjs/components/featureInfo/FeatureInfo.js +6 -7
  17. package/lib/commonjs/components/featureInfo/FeatureInfo.js.map +1 -1
  18. package/lib/commonjs/components/layout/HeaderSecondLevel.js +10 -15
  19. package/lib/commonjs/components/layout/HeaderSecondLevel.js.map +1 -1
  20. package/lib/commonjs/components/listitems/ListItemAction.js +12 -50
  21. package/lib/commonjs/components/listitems/ListItemAction.js.map +1 -1
  22. package/lib/commonjs/components/listitems/ListItemAmount.js +2 -5
  23. package/lib/commonjs/components/listitems/ListItemAmount.js.map +1 -1
  24. package/lib/commonjs/components/listitems/ListItemSwitch.js +2 -2
  25. package/lib/commonjs/components/listitems/ListItemSwitch.js.map +1 -1
  26. package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +83 -347
  27. package/lib/commonjs/components/modules/ModuleIDP.js +13 -20
  28. package/lib/commonjs/components/modules/ModuleIDP.js.map +1 -1
  29. package/lib/commonjs/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +30 -150
  30. package/lib/commonjs/components/searchInput/SearchInput.js +2 -4
  31. package/lib/commonjs/components/searchInput/SearchInput.js.map +1 -1
  32. package/lib/commonjs/components/switch/SwitchLabel.js +7 -29
  33. package/lib/commonjs/components/switch/SwitchLabel.js.map +1 -1
  34. package/lib/commonjs/components/tabs/TabItem.js +3 -2
  35. package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
  36. package/lib/commonjs/components/tag/Tag.js +14 -18
  37. package/lib/commonjs/components/tag/Tag.js.map +1 -1
  38. package/lib/commonjs/components/textInput/TextInputBase.js +4 -6
  39. package/lib/commonjs/components/textInput/TextInputBase.js.map +1 -1
  40. package/lib/commonjs/components/typography/BaseTypography.js +5 -1
  41. package/lib/commonjs/components/typography/BaseTypography.js.map +1 -1
  42. package/lib/commonjs/components/typography/Body.js +34 -26
  43. package/lib/commonjs/components/typography/Body.js.map +1 -1
  44. package/lib/commonjs/components/typography/BodyMonospace.js +26 -24
  45. package/lib/commonjs/components/typography/BodyMonospace.js.map +1 -1
  46. package/lib/commonjs/components/typography/ButtonText.js +25 -19
  47. package/lib/commonjs/components/typography/ButtonText.js.map +1 -1
  48. package/lib/commonjs/components/typography/Caption.js +29 -19
  49. package/lib/commonjs/components/typography/Caption.js.map +1 -1
  50. package/lib/commonjs/components/typography/Chip.js +24 -21
  51. package/lib/commonjs/components/typography/Chip.js.map +1 -1
  52. package/lib/commonjs/components/typography/Factory.js +1 -0
  53. package/lib/commonjs/components/typography/Factory.js.map +1 -1
  54. package/lib/commonjs/components/typography/H1.js +27 -20
  55. package/lib/commonjs/components/typography/H1.js.map +1 -1
  56. package/lib/commonjs/components/typography/H2.js +27 -20
  57. package/lib/commonjs/components/typography/H2.js.map +1 -1
  58. package/lib/commonjs/components/typography/H3.js +27 -19
  59. package/lib/commonjs/components/typography/H3.js.map +1 -1
  60. package/lib/commonjs/components/typography/H4.js +27 -21
  61. package/lib/commonjs/components/typography/H4.js.map +1 -1
  62. package/lib/commonjs/components/typography/H5.js +26 -22
  63. package/lib/commonjs/components/typography/H5.js.map +1 -1
  64. package/lib/commonjs/components/typography/H6.js +25 -20
  65. package/lib/commonjs/components/typography/H6.js.map +1 -1
  66. package/lib/commonjs/components/typography/Hero.js +25 -17
  67. package/lib/commonjs/components/typography/Hero.js.map +1 -1
  68. package/lib/commonjs/components/typography/IOText.js +104 -0
  69. package/lib/commonjs/components/typography/IOText.js.map +1 -0
  70. package/lib/commonjs/components/typography/Label.js +28 -26
  71. package/lib/commonjs/components/typography/Label.js.map +1 -1
  72. package/lib/commonjs/components/typography/LabelMini.js +45 -0
  73. package/lib/commonjs/components/typography/LabelMini.js.map +1 -0
  74. package/lib/commonjs/components/typography/LabelSmall.js +30 -30
  75. package/lib/commonjs/components/typography/LabelSmall.js.map +1 -1
  76. package/lib/commonjs/components/typography/LabelSmallAlt.js +25 -20
  77. package/lib/commonjs/components/typography/LabelSmallAlt.js.map +1 -1
  78. package/lib/commonjs/components/typography/__test__/__snapshots__/typography.test.tsx.snap +86 -551
  79. package/lib/commonjs/components/typography/__test__/typography.test.js +6 -25
  80. package/lib/commonjs/components/typography/__test__/typography.test.js.map +1 -1
  81. package/lib/commonjs/components/typography/index.js +15 -37
  82. package/lib/commonjs/components/typography/index.js.map +1 -1
  83. package/lib/commonjs/components/typography/markdown/MdH1.js +27 -16
  84. package/lib/commonjs/components/typography/markdown/MdH1.js.map +1 -1
  85. package/lib/commonjs/components/typography/markdown/MdH2.js +28 -18
  86. package/lib/commonjs/components/typography/markdown/MdH2.js.map +1 -1
  87. package/lib/commonjs/components/typography/markdown/MdH3.js +26 -16
  88. package/lib/commonjs/components/typography/markdown/MdH3.js.map +1 -1
  89. package/lib/commonjs/core/IOColors.js +19 -2
  90. package/lib/commonjs/core/IOColors.js.map +1 -1
  91. package/lib/commonjs/core/IOStyles.js +0 -1
  92. package/lib/commonjs/core/IOStyles.js.map +1 -1
  93. package/lib/commonjs/utils/accessibility.js +24 -1
  94. package/lib/commonjs/utils/accessibility.js.map +1 -1
  95. package/lib/commonjs/utils/fonts.js +72 -40
  96. package/lib/commonjs/utils/fonts.js.map +1 -1
  97. package/lib/module/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +8 -32
  98. package/lib/module/components/accordion/AccordionItem.js +3 -12
  99. package/lib/module/components/accordion/AccordionItem.js.map +1 -1
  100. package/lib/module/components/alert/Alert.js +5 -18
  101. package/lib/module/components/alert/Alert.js.map +1 -1
  102. package/lib/module/components/badge/Badge.js +15 -23
  103. package/lib/module/components/badge/Badge.js.map +1 -1
  104. package/lib/module/components/badge/__test__/__snapshots__/badge.test.tsx.snap +16 -16
  105. package/lib/module/components/badge/__test__/badge.test.js.map +1 -1
  106. package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +14 -38
  107. package/lib/module/components/buttons/ButtonLink.js +12 -26
  108. package/lib/module/components/buttons/ButtonLink.js.map +1 -1
  109. package/lib/module/components/buttons/ButtonOutline.js +15 -25
  110. package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
  111. package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +45 -60
  112. package/lib/module/components/featureInfo/FeatureInfo.js +7 -8
  113. package/lib/module/components/featureInfo/FeatureInfo.js.map +1 -1
  114. package/lib/module/components/layout/HeaderSecondLevel.js +10 -15
  115. package/lib/module/components/layout/HeaderSecondLevel.js.map +1 -1
  116. package/lib/module/components/listitems/ListItemAction.js +16 -54
  117. package/lib/module/components/listitems/ListItemAction.js.map +1 -1
  118. package/lib/module/components/listitems/ListItemAmount.js +2 -5
  119. package/lib/module/components/listitems/ListItemAmount.js.map +1 -1
  120. package/lib/module/components/listitems/ListItemSwitch.js +3 -3
  121. package/lib/module/components/listitems/ListItemSwitch.js.map +1 -1
  122. package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +83 -347
  123. package/lib/module/components/modules/ModuleIDP.js +15 -22
  124. package/lib/module/components/modules/ModuleIDP.js.map +1 -1
  125. package/lib/module/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +30 -150
  126. package/lib/module/components/searchInput/SearchInput.js +2 -4
  127. package/lib/module/components/searchInput/SearchInput.js.map +1 -1
  128. package/lib/module/components/switch/SwitchLabel.js +9 -31
  129. package/lib/module/components/switch/SwitchLabel.js.map +1 -1
  130. package/lib/module/components/tabs/TabItem.js +3 -2
  131. package/lib/module/components/tabs/TabItem.js.map +1 -1
  132. package/lib/module/components/tag/Tag.js +16 -20
  133. package/lib/module/components/tag/Tag.js.map +1 -1
  134. package/lib/module/components/textInput/TextInputBase.js +4 -6
  135. package/lib/module/components/textInput/TextInputBase.js.map +1 -1
  136. package/lib/module/components/typography/BaseTypography.js +5 -1
  137. package/lib/module/components/typography/BaseTypography.js.map +1 -1
  138. package/lib/module/components/typography/Body.js +31 -22
  139. package/lib/module/components/typography/Body.js.map +1 -1
  140. package/lib/module/components/typography/BodyMonospace.js +25 -23
  141. package/lib/module/components/typography/BodyMonospace.js.map +1 -1
  142. package/lib/module/components/typography/ButtonText.js +24 -19
  143. package/lib/module/components/typography/ButtonText.js.map +1 -1
  144. package/lib/module/components/typography/Caption.js +28 -19
  145. package/lib/module/components/typography/Caption.js.map +1 -1
  146. package/lib/module/components/typography/Chip.js +23 -21
  147. package/lib/module/components/typography/Chip.js.map +1 -1
  148. package/lib/module/components/typography/Factory.js +1 -0
  149. package/lib/module/components/typography/Factory.js.map +1 -1
  150. package/lib/module/components/typography/H1.js +26 -20
  151. package/lib/module/components/typography/H1.js.map +1 -1
  152. package/lib/module/components/typography/H2.js +26 -20
  153. package/lib/module/components/typography/H2.js.map +1 -1
  154. package/lib/module/components/typography/H3.js +26 -19
  155. package/lib/module/components/typography/H3.js.map +1 -1
  156. package/lib/module/components/typography/H4.js +26 -21
  157. package/lib/module/components/typography/H4.js.map +1 -1
  158. package/lib/module/components/typography/H5.js +24 -21
  159. package/lib/module/components/typography/H5.js.map +1 -1
  160. package/lib/module/components/typography/H6.js +24 -21
  161. package/lib/module/components/typography/H6.js.map +1 -1
  162. package/lib/module/components/typography/Hero.js +24 -17
  163. package/lib/module/components/typography/Hero.js.map +1 -1
  164. package/lib/module/components/typography/IOText.js +96 -0
  165. package/lib/module/components/typography/IOText.js.map +1 -0
  166. package/lib/module/components/typography/Label.js +27 -26
  167. package/lib/module/components/typography/Label.js.map +1 -1
  168. package/lib/module/components/typography/LabelMini.js +36 -0
  169. package/lib/module/components/typography/LabelMini.js.map +1 -0
  170. package/lib/module/components/typography/LabelSmall.js +29 -30
  171. package/lib/module/components/typography/LabelSmall.js.map +1 -1
  172. package/lib/module/components/typography/LabelSmallAlt.js +24 -20
  173. package/lib/module/components/typography/LabelSmallAlt.js.map +1 -1
  174. package/lib/module/components/typography/__test__/__snapshots__/typography.test.tsx.snap +86 -551
  175. package/lib/module/components/typography/__test__/typography.test.js +6 -25
  176. package/lib/module/components/typography/__test__/typography.test.js.map +1 -1
  177. package/lib/module/components/typography/index.js +2 -4
  178. package/lib/module/components/typography/index.js.map +1 -1
  179. package/lib/module/components/typography/markdown/MdH1.js +25 -15
  180. package/lib/module/components/typography/markdown/MdH1.js.map +1 -1
  181. package/lib/module/components/typography/markdown/MdH2.js +26 -17
  182. package/lib/module/components/typography/markdown/MdH2.js.map +1 -1
  183. package/lib/module/components/typography/markdown/MdH3.js +24 -15
  184. package/lib/module/components/typography/markdown/MdH3.js.map +1 -1
  185. package/lib/module/core/IOColors.js +17 -1
  186. package/lib/module/core/IOColors.js.map +1 -1
  187. package/lib/module/core/IOStyles.js +0 -1
  188. package/lib/module/core/IOStyles.js.map +1 -1
  189. package/lib/module/utils/accessibility.js +22 -0
  190. package/lib/module/utils/accessibility.js.map +1 -1
  191. package/lib/module/utils/fonts.js +70 -36
  192. package/lib/module/utils/fonts.js.map +1 -1
  193. package/lib/typescript/components/accordion/AccordionItem.d.ts.map +1 -1
  194. package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
  195. package/lib/typescript/components/badge/Badge.d.ts.map +1 -1
  196. package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
  197. package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
  198. package/lib/typescript/components/featureInfo/FeatureInfo.d.ts +6 -5
  199. package/lib/typescript/components/featureInfo/FeatureInfo.d.ts.map +1 -1
  200. package/lib/typescript/components/layout/HeaderSecondLevel.d.ts.map +1 -1
  201. package/lib/typescript/components/listitems/ListItemAction.d.ts.map +1 -1
  202. package/lib/typescript/components/listitems/ListItemAmount.d.ts.map +1 -1
  203. package/lib/typescript/components/modules/ModuleIDP.d.ts.map +1 -1
  204. package/lib/typescript/components/switch/SwitchLabel.d.ts.map +1 -1
  205. package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -1
  206. package/lib/typescript/components/tag/Tag.d.ts.map +1 -1
  207. package/lib/typescript/components/textInput/TextInputBase.d.ts.map +1 -1
  208. package/lib/typescript/components/typography/BaseTypography.d.ts +3 -2
  209. package/lib/typescript/components/typography/BaseTypography.d.ts.map +1 -1
  210. package/lib/typescript/components/typography/Body.d.ts +5 -10
  211. package/lib/typescript/components/typography/Body.d.ts.map +1 -1
  212. package/lib/typescript/components/typography/BodyMonospace.d.ts +7 -7
  213. package/lib/typescript/components/typography/BodyMonospace.d.ts.map +1 -1
  214. package/lib/typescript/components/typography/ButtonText.d.ts +9 -10
  215. package/lib/typescript/components/typography/ButtonText.d.ts.map +1 -1
  216. package/lib/typescript/components/typography/Caption.d.ts +9 -5
  217. package/lib/typescript/components/typography/Caption.d.ts.map +1 -1
  218. package/lib/typescript/components/typography/Chip.d.ts +7 -7
  219. package/lib/typescript/components/typography/Chip.d.ts.map +1 -1
  220. package/lib/typescript/components/typography/Factory.d.ts +1 -0
  221. package/lib/typescript/components/typography/Factory.d.ts.map +1 -1
  222. package/lib/typescript/components/typography/H1.d.ts +9 -8
  223. package/lib/typescript/components/typography/H1.d.ts.map +1 -1
  224. package/lib/typescript/components/typography/H2.d.ts +9 -8
  225. package/lib/typescript/components/typography/H2.d.ts.map +1 -1
  226. package/lib/typescript/components/typography/H3.d.ts +9 -8
  227. package/lib/typescript/components/typography/H3.d.ts.map +1 -1
  228. package/lib/typescript/components/typography/H4.d.ts +9 -8
  229. package/lib/typescript/components/typography/H4.d.ts.map +1 -1
  230. package/lib/typescript/components/typography/H5.d.ts +9 -5
  231. package/lib/typescript/components/typography/H5.d.ts.map +1 -1
  232. package/lib/typescript/components/typography/H6.d.ts +9 -10
  233. package/lib/typescript/components/typography/H6.d.ts.map +1 -1
  234. package/lib/typescript/components/typography/Hero.d.ts +9 -8
  235. package/lib/typescript/components/typography/Hero.d.ts.map +1 -1
  236. package/lib/typescript/components/typography/IOText.d.ts +54 -0
  237. package/lib/typescript/components/typography/IOText.d.ts.map +1 -0
  238. package/lib/typescript/components/typography/Label.d.ts +6 -10
  239. package/lib/typescript/components/typography/Label.d.ts.map +1 -1
  240. package/lib/typescript/components/typography/LabelMini.d.ts +13 -0
  241. package/lib/typescript/components/typography/LabelMini.d.ts.map +1 -0
  242. package/lib/typescript/components/typography/LabelSmall.d.ts +5 -11
  243. package/lib/typescript/components/typography/LabelSmall.d.ts.map +1 -1
  244. package/lib/typescript/components/typography/LabelSmallAlt.d.ts +7 -10
  245. package/lib/typescript/components/typography/LabelSmallAlt.d.ts.map +1 -1
  246. package/lib/typescript/components/typography/index.d.ts +2 -4
  247. package/lib/typescript/components/typography/index.d.ts.map +1 -1
  248. package/lib/typescript/components/typography/markdown/MdH1.d.ts +9 -9
  249. package/lib/typescript/components/typography/markdown/MdH1.d.ts.map +1 -1
  250. package/lib/typescript/components/typography/markdown/MdH2.d.ts +9 -9
  251. package/lib/typescript/components/typography/markdown/MdH2.d.ts.map +1 -1
  252. package/lib/typescript/components/typography/markdown/MdH3.d.ts +9 -9
  253. package/lib/typescript/components/typography/markdown/MdH3.d.ts.map +1 -1
  254. package/lib/typescript/core/IOColors.d.ts +3 -20
  255. package/lib/typescript/core/IOColors.d.ts.map +1 -1
  256. package/lib/typescript/core/IOStyles.d.ts +0 -3
  257. package/lib/typescript/core/IOStyles.d.ts.map +1 -1
  258. package/lib/typescript/utils/accessibility.d.ts +5 -0
  259. package/lib/typescript/utils/accessibility.d.ts.map +1 -1
  260. package/lib/typescript/utils/fonts.d.ts +17 -25
  261. package/lib/typescript/utils/fonts.d.ts.map +1 -1
  262. package/package.json +1 -1
  263. package/src/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +8 -32
  264. package/src/components/accordion/AccordionItem.tsx +2 -14
  265. package/src/components/alert/Alert.tsx +5 -18
  266. package/src/components/badge/Badge.tsx +15 -28
  267. package/src/components/badge/__test__/__snapshots__/badge.test.tsx.snap +16 -16
  268. package/src/components/badge/__test__/badge.test.tsx +2 -2
  269. package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +14 -38
  270. package/src/components/buttons/ButtonLink.tsx +12 -35
  271. package/src/components/buttons/ButtonOutline.tsx +14 -25
  272. package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +45 -60
  273. package/src/components/featureInfo/FeatureInfo.tsx +13 -13
  274. package/src/components/layout/HeaderSecondLevel.tsx +9 -18
  275. package/src/components/listitems/ListItemAction.tsx +13 -75
  276. package/src/components/listitems/ListItemAmount.tsx +2 -5
  277. package/src/components/listitems/ListItemSwitch.tsx +3 -3
  278. package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +83 -347
  279. package/src/components/modules/ModuleIDP.tsx +15 -32
  280. package/src/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +30 -150
  281. package/src/components/searchInput/SearchInput.tsx +14 -6
  282. package/src/components/switch/SwitchLabel.tsx +6 -32
  283. package/src/components/tabs/TabItem.tsx +4 -2
  284. package/src/components/tag/Tag.tsx +22 -24
  285. package/src/components/textInput/TextInputBase.tsx +21 -8
  286. package/src/components/typography/BaseTypography.tsx +13 -4
  287. package/src/components/typography/Body.tsx +43 -38
  288. package/src/components/typography/BodyMonospace.tsx +24 -37
  289. package/src/components/typography/ButtonText.tsx +25 -35
  290. package/src/components/typography/Caption.tsx +31 -33
  291. package/src/components/typography/Chip.tsx +25 -37
  292. package/src/components/typography/Factory.tsx +1 -0
  293. package/src/components/typography/H1.tsx +31 -36
  294. package/src/components/typography/H2.tsx +31 -36
  295. package/src/components/typography/H3.tsx +30 -35
  296. package/src/components/typography/H4.tsx +31 -36
  297. package/src/components/typography/H5.tsx +26 -32
  298. package/src/components/typography/H6.tsx +30 -41
  299. package/src/components/typography/Hero.tsx +30 -33
  300. package/src/components/typography/IOText.tsx +157 -0
  301. package/src/components/typography/Label.tsx +41 -48
  302. package/src/components/typography/LabelMini.tsx +52 -0
  303. package/src/components/typography/LabelSmall.tsx +41 -63
  304. package/src/components/typography/LabelSmallAlt.tsx +28 -48
  305. package/src/components/typography/__test__/__snapshots__/typography.test.tsx.snap +86 -551
  306. package/src/components/typography/__test__/typography.test.tsx +7 -31
  307. package/src/components/typography/index.tsx +2 -4
  308. package/src/components/typography/markdown/MdH1.tsx +26 -28
  309. package/src/components/typography/markdown/MdH2.tsx +27 -30
  310. package/src/components/typography/markdown/MdH3.tsx +25 -28
  311. package/src/core/IOColors.ts +31 -21
  312. package/src/core/IOStyles.ts +1 -5
  313. package/src/utils/accessibility.ts +31 -0
  314. package/src/utils/fonts.ts +93 -51
  315. package/lib/commonjs/components/typography/LabelHeader.js +0 -44
  316. package/lib/commonjs/components/typography/LabelHeader.js.map +0 -1
  317. package/lib/commonjs/components/typography/LabelLink.js +0 -44
  318. package/lib/commonjs/components/typography/LabelLink.js.map +0 -1
  319. package/lib/commonjs/components/typography/markdown/MdH4.js +0 -30
  320. package/lib/commonjs/components/typography/markdown/MdH4.js.map +0 -1
  321. package/lib/commonjs/components/typography/markdown/MdH5.js +0 -28
  322. package/lib/commonjs/components/typography/markdown/MdH5.js.map +0 -1
  323. package/lib/commonjs/components/typography/markdown/MdH6.js +0 -29
  324. package/lib/commonjs/components/typography/markdown/MdH6.js.map +0 -1
  325. package/lib/module/components/typography/LabelHeader.js +0 -33
  326. package/lib/module/components/typography/LabelHeader.js.map +0 -1
  327. package/lib/module/components/typography/LabelLink.js +0 -33
  328. package/lib/module/components/typography/LabelLink.js.map +0 -1
  329. package/lib/module/components/typography/markdown/MdH4.js +0 -23
  330. package/lib/module/components/typography/markdown/MdH4.js.map +0 -1
  331. package/lib/module/components/typography/markdown/MdH5.js +0 -21
  332. package/lib/module/components/typography/markdown/MdH5.js.map +0 -1
  333. package/lib/module/components/typography/markdown/MdH6.js +0 -22
  334. package/lib/module/components/typography/markdown/MdH6.js.map +0 -1
  335. package/lib/typescript/components/typography/LabelHeader.d.ts +0 -18
  336. package/lib/typescript/components/typography/LabelHeader.d.ts.map +0 -1
  337. package/lib/typescript/components/typography/LabelLink.d.ts +0 -20
  338. package/lib/typescript/components/typography/LabelLink.d.ts.map +0 -1
  339. package/lib/typescript/components/typography/markdown/MdH4.d.ts +0 -13
  340. package/lib/typescript/components/typography/markdown/MdH4.d.ts.map +0 -1
  341. package/lib/typescript/components/typography/markdown/MdH5.d.ts +0 -13
  342. package/lib/typescript/components/typography/markdown/MdH5.d.ts.map +0 -1
  343. package/lib/typescript/components/typography/markdown/MdH6.d.ts +0 -13
  344. package/lib/typescript/components/typography/markdown/MdH6.d.ts.map +0 -1
  345. package/src/components/typography/LabelHeader.tsx +0 -56
  346. package/src/components/typography/LabelLink.tsx +0 -61
  347. package/src/components/typography/markdown/MdH4.tsx +0 -34
  348. package/src/components/typography/markdown/MdH5.tsx +0 -32
  349. package/src/components/typography/markdown/MdH6.tsx +0 -33
@@ -1,8 +1,10 @@
1
1
  import React from "react";
2
2
  import * as TestRenderer from "react-test-renderer";
3
+ import { Alert } from "react-native";
3
4
  import type { IOColors } from "../../../core/IOColors";
4
5
  import { IOFontWeight } from "../../../utils/fonts";
5
6
  import { Body } from "../Body";
7
+ import { BodyMonospace } from "../BodyMonospace";
6
8
  import { ButtonText } from "../ButtonText";
7
9
  import { H1 } from "../H1";
8
10
  import { H2 } from "../H2";
@@ -12,8 +14,6 @@ import { H5 } from "../H5";
12
14
  import { H6 } from "../H6";
13
15
  import { Label } from "../Label";
14
16
  import { LabelSmall } from "../LabelSmall";
15
- import { LabelLink } from "../LabelLink";
16
- import { BodyMonospace } from "../BodyMonospace";
17
17
  import { calculateWeightColor } from "../common";
18
18
 
19
19
  describe("Test Typography Components", () => {
@@ -54,34 +54,6 @@ describe("Test Typography Components", () => {
54
54
  expect(h4Dblue).toMatchSnapshot();
55
55
  const h4white = TestRenderer.create(<H4 color={"white"}>Text</H4>).toJSON();
56
56
  expect(h4white).toMatchSnapshot();
57
-
58
- // Regular weight
59
- // with regular weight, default color is bluegreydark
60
- const h4Regular = TestRenderer.create(
61
- <H4 weight={"Regular"}>Text</H4>
62
- ).toJSON();
63
- expect(h4Regular).toMatchSnapshot();
64
-
65
- const h4Regularbluegrey = TestRenderer.create(
66
- <H4 weight={"Regular"} color={"bluegrey"}>
67
- Text
68
- </H4>
69
- ).toJSON();
70
- expect(h4Regularbluegrey).toMatchSnapshot();
71
-
72
- const h4RegularbluegreyLight = TestRenderer.create(
73
- <H4 weight={"Regular"} color={"bluegreyLight"}>
74
- Text
75
- </H4>
76
- ).toJSON();
77
- expect(h4RegularbluegreyLight).toMatchSnapshot();
78
-
79
- const h4Regularwhite = TestRenderer.create(
80
- <H4 weight={"Regular"} color={"white"}>
81
- Text
82
- </H4>
83
- ).toJSON();
84
- expect(h4Regularwhite).toMatchSnapshot();
85
57
  });
86
58
  it("H5 Snapshot", () => {
87
59
  // SemiBold weight, default
@@ -151,7 +123,11 @@ describe("Test Typography Components", () => {
151
123
  });
152
124
  });
153
125
  it("Link Snapshot", () => {
154
- const link = TestRenderer.create(<LabelLink>Text</LabelLink>).toJSON();
126
+ const link = TestRenderer.create(
127
+ <Label asLink onPress={() => Alert.alert("Pressed")}>
128
+ Text
129
+ </Label>
130
+ ).toJSON();
155
131
  expect(link).toMatchSnapshot();
156
132
  });
157
133
  it("BodyMonospace Snapshot", () => {
@@ -1,4 +1,5 @@
1
1
  export * from "./BaseTypography";
2
+ export * from "./IOText";
2
3
  export * from "./Body";
3
4
  export * from "./Caption";
4
5
  export * from "./Chip";
@@ -14,12 +15,9 @@ export * from "./Hero";
14
15
  export * from "./Label";
15
16
  export * from "./LabelSmall";
16
17
  export * from "./LabelSmallAlt";
17
- export * from "./LabelLink";
18
+ export * from "./LabelMini";
18
19
  export * from "./BodyMonospace";
19
20
  export * from "./common";
20
21
  export * from "./markdown/MdH1";
21
22
  export * from "./markdown/MdH2";
22
23
  export * from "./markdown/MdH3";
23
- export * from "./markdown/MdH4";
24
- export * from "./markdown/MdH5";
25
- export * from "./markdown/MdH6";
@@ -1,32 +1,30 @@
1
- import { IOColors, IOTheme } from "../../../core";
2
- import { FontFamily, IOFontWeight } from "../../../utils/fonts";
3
- import { ExternalTypographyProps, TypographyProps } from "../common";
4
- import { useTypographyFactory } from "../Factory";
5
-
6
- type AllowedColors = Extract<IOTheme, "textHeading-default"> | IOColors;
7
- type AllowedWeight = Extract<IOFontWeight, "Regular">;
8
-
9
- type MdH1Props = ExternalTypographyProps<
10
- TypographyProps<AllowedWeight, AllowedColors>
11
- >;
12
-
13
- const fontSize = 20;
14
- const lineHeight = 24;
15
- const font: FontFamily = "ReadexPro";
16
- const defaultColor: AllowedColors = "black";
17
- const defaultWeight: AllowedWeight = "Regular";
1
+ import React, { ForwardedRef, forwardRef } from "react";
2
+ import { View } from "react-native";
3
+ import { useIOExperimentalDesign, useIOTheme } from "../../../core";
4
+ import { IOText, IOTextProps, TypographicStyleProps } from "../IOText";
18
5
 
19
6
  /**
20
7
  * `MdH1` typographic style
21
8
  */
22
- export const MdH1 = (props: MdH1Props) =>
23
- useTypographyFactory<AllowedWeight, AllowedColors>({
24
- ...props,
25
- defaultWeight,
26
- defaultColor,
27
- font,
28
- fontStyle: {
29
- fontSize,
30
- lineHeight
31
- }
32
- });
9
+
10
+ export const MdH1 = forwardRef<View, TypographicStyleProps>(
11
+ ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
12
+ const theme = useIOTheme();
13
+ const { isExperimental } = useIOExperimentalDesign();
14
+
15
+ const MdH1Props: IOTextProps = {
16
+ ...props,
17
+ font: isExperimental ? "ReadexPro" : "TitilliumSansPro",
18
+ weight: isExperimental ? "Regular" : "Semibold",
19
+ size: 20,
20
+ lineHeight: 24,
21
+ color: customColor ?? theme["textHeading-tertiary"]
22
+ };
23
+
24
+ return (
25
+ <IOText ref={ref} {...MdH1Props}>
26
+ {props.children}
27
+ </IOText>
28
+ );
29
+ }
30
+ );
@@ -1,34 +1,31 @@
1
- import { IOColors, IOTheme } from "../../../core";
2
- import { FontFamily, IOFontWeight } from "../../../utils/fonts";
3
- import { ExternalTypographyProps, TypographyProps } from "../common";
4
- import { useTypographyFactory } from "../Factory";
5
-
6
- type AllowedColors = Extract<IOTheme, "textHeading-default"> | IOColors;
7
- type AllowedWeight = Extract<IOFontWeight, "Regular">;
8
-
9
- type MdH2Props = ExternalTypographyProps<
10
- TypographyProps<AllowedWeight, AllowedColors>
11
- >;
12
-
13
- /* We set 18 instead of 16 to diffrentiate from the H3 typographic style.
14
- It should be 16 with `SemiBold` font weight. */
15
- const fontSize = 18;
16
- const lineHeight = 24;
17
- const font: FontFamily = "ReadexPro";
18
- const defaultColor: AllowedColors = "black";
19
- const defaultWeight: AllowedWeight = "Regular";
1
+ import React, { ForwardedRef, forwardRef } from "react";
2
+ import { View } from "react-native";
3
+ import { useIOExperimentalDesign, useIOTheme } from "../../../core";
4
+ import { IOText, IOTextProps, TypographicStyleProps } from "../IOText";
20
5
 
21
6
  /**
22
7
  * `MdH2` typographic style
23
8
  */
24
- export const MdH2 = (props: MdH2Props) =>
25
- useTypographyFactory<AllowedWeight, AllowedColors>({
26
- ...props,
27
- defaultWeight,
28
- defaultColor,
29
- font,
30
- fontStyle: {
31
- fontSize,
32
- lineHeight
33
- }
34
- });
9
+ export const MdH2 = forwardRef<View, TypographicStyleProps>(
10
+ ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
11
+ const theme = useIOTheme();
12
+ const { isExperimental } = useIOExperimentalDesign();
13
+
14
+ const MdH2Props: IOTextProps = {
15
+ ...props,
16
+ font: isExperimental ? "ReadexPro" : "TitilliumSansPro",
17
+ weight: isExperimental ? "Regular" : "Semibold",
18
+ /* We set 18 instead of 16 to diffrentiate from the H3 typographic style.
19
+ It should be 16 with `SemiBold` font weight. */
20
+ size: 18,
21
+ lineHeight: 24,
22
+ color: customColor ?? theme["textHeading-tertiary"]
23
+ };
24
+
25
+ return (
26
+ <IOText ref={ref} {...MdH2Props}>
27
+ {props.children}
28
+ </IOText>
29
+ );
30
+ }
31
+ );
@@ -1,32 +1,29 @@
1
- import { IOColors, IOTheme } from "../../../core";
2
- import { FontFamily, IOFontWeight } from "../../../utils/fonts";
3
- import { ExternalTypographyProps, TypographyProps } from "../common";
4
- import { useTypographyFactory } from "../Factory";
5
-
6
- type AllowedColors = Extract<IOTheme, "textHeading-default"> | IOColors;
7
- type AllowedWeight = Extract<IOFontWeight, "Regular">;
8
-
9
- type MdH3Props = ExternalTypographyProps<
10
- TypographyProps<AllowedWeight, AllowedColors>
11
- >;
12
-
13
- const fontSize = 16;
14
- const lineHeight = 24;
15
- const font: FontFamily = "ReadexPro";
16
- const defaultColor: AllowedColors = "black";
17
- const defaultWeight: AllowedWeight = "Regular";
1
+ import React, { ForwardedRef, forwardRef } from "react";
2
+ import { View } from "react-native";
3
+ import { useIOExperimentalDesign, useIOTheme } from "../../../core";
4
+ import { IOText, IOTextProps, TypographicStyleProps } from "../IOText";
18
5
 
19
6
  /**
20
7
  * `MdH3` typographic style
21
8
  */
22
- export const MdH3 = (props: MdH3Props) =>
23
- useTypographyFactory<AllowedWeight, AllowedColors>({
24
- ...props,
25
- defaultWeight,
26
- defaultColor,
27
- font,
28
- fontStyle: {
29
- fontSize,
30
- lineHeight
31
- }
32
- });
9
+ export const MdH3 = forwardRef<View, TypographicStyleProps>(
10
+ ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
11
+ const theme = useIOTheme();
12
+ const { isExperimental } = useIOExperimentalDesign();
13
+
14
+ const MdH3Props: IOTextProps = {
15
+ ...props,
16
+ font: isExperimental ? "ReadexPro" : "TitilliumSansPro",
17
+ weight: isExperimental ? "Regular" : "Semibold",
18
+ size: 16,
19
+ lineHeight: 24,
20
+ color: customColor ?? theme["textHeading-tertiary"]
21
+ };
22
+
23
+ return (
24
+ <IOText ref={ref} {...MdH3Props}>
25
+ {props.children}
26
+ </IOText>
27
+ );
28
+ }
29
+ );
@@ -256,33 +256,39 @@ export type IOColorsExtra = keyof typeof IOColorsExtra;
256
256
  ░░░ THEME COLORS ░░░
257
257
  */
258
258
 
259
- export type IOTheme = {
259
+ const themeKeys = [
260
260
  // General
261
- "appBackground-primary": IOColors;
262
- "appBackground-secondary": IOColors;
263
- "appBackground-tertiary": IOColors;
264
- "appBackground-accent": IOColors;
265
- "interactiveElem-default": IOColors;
266
- "interactiveElem-pressed": IOColors;
267
- "listItem-pressed": IOColors;
261
+ "appBackground-primary",
262
+ "appBackground-secondary",
263
+ "appBackground-tertiary",
264
+ "appBackground-accent",
265
+ "interactiveElem-default",
266
+ "interactiveElem-pressed",
267
+ "listItem-pressed",
268
268
  // Typography
269
- "textHeading-default": IOColors;
270
- "textBody-default": IOColors;
271
- "textBody-secondary": IOColors;
272
- "textBody-tertiary": IOColors;
269
+ "textHeading-default",
270
+ "textHeading-secondary",
271
+ "textHeading-tertiary",
272
+ "textBody-default",
273
+ "textBody-secondary",
274
+ "textBody-tertiary",
273
275
  // Design System related
274
- "cardBorder-default": IOColors;
275
- "icon-default": IOColors;
276
- "icon-decorative": IOColors;
276
+ "cardBorder-default",
277
+ "icon-default",
278
+ "icon-decorative",
277
279
  // Layout
278
- "divider-default": IOColors;
280
+ "divider-default",
279
281
  // Status
280
- errorIcon: IOColors;
281
- errorText: IOColors;
282
+ "errorIcon",
283
+ "errorText",
282
284
  // Pictograms
283
- "pictogram-hands": IOColors;
284
- "pictogram-tint-main": IOColors;
285
- "pictogram-tint-secondary": IOColors;
285
+ "pictogram-hands",
286
+ "pictogram-tint-main",
287
+ "pictogram-tint-secondary"
288
+ ] as const;
289
+
290
+ export type IOTheme = {
291
+ [K in (typeof themeKeys)[number]]: IOColors;
286
292
  };
287
293
 
288
294
  export const IOThemeLight: IOTheme = {
@@ -296,6 +302,8 @@ export const IOThemeLight: IOTheme = {
296
302
  "listItem-pressed": "grey-50",
297
303
  // Typography
298
304
  "textHeading-default": "black",
305
+ "textHeading-secondary": "grey-850",
306
+ "textHeading-tertiary": "grey-700",
299
307
  "textBody-default": "black",
300
308
  "textBody-secondary": "grey-850",
301
309
  "textBody-tertiary": "grey-700",
@@ -332,6 +340,8 @@ export const IOThemeDark: IOTheme = {
332
340
  "listItem-pressed": "grey-850",
333
341
  // Typography
334
342
  "textHeading-default": "grey-200",
343
+ "textHeading-secondary": "grey-300",
344
+ "textHeading-tertiary": "grey-450",
335
345
  "textBody-default": "white",
336
346
  "textBody-secondary": "grey-100",
337
347
  "textBody-tertiary": "grey-450",
@@ -1,5 +1,4 @@
1
- import { Platform, StyleSheet, Text } from "react-native";
2
- import { ComponentProps } from "react";
1
+ import { Platform, StyleSheet } from "react-native";
3
2
  import { IOIconSizeScale } from "../components/icons";
4
3
  import { IOColors } from "./IOColors";
5
4
  import { IOModuleIDPRadius } from "./IOShapes";
@@ -19,8 +18,6 @@ interface IOVisualCostants {
19
18
  appMarginDefault: IOAppMargin;
20
19
  // Header
21
20
  headerHeight: number;
22
- // Typography
23
- maxFontSizeMultiplier: ComponentProps<typeof Text>["maxFontSizeMultiplier"];
24
21
  // Dimensions
25
22
  avatarSizeSmall: number;
26
23
  avatarSizeMedium: number;
@@ -35,7 +32,6 @@ interface IOVisualCostants {
35
32
  export const IOVisualCostants: IOVisualCostants = {
36
33
  appMarginDefault: 24,
37
34
  headerHeight: 56,
38
- maxFontSizeMultiplier: 1.25,
39
35
  avatarSizeSmall: 44,
40
36
  avatarSizeMedium: 66,
41
37
  avatarRadiusSizeSmall: 8,
@@ -1,6 +1,8 @@
1
1
  import { pipe } from "fp-ts/lib/function";
2
2
  import * as O from "fp-ts/lib/Option";
3
3
  import I18n from "i18n-js";
4
+ import { useEffect, useState } from "react";
5
+ import { AccessibilityInfo } from "react-native";
4
6
 
5
7
  /**
6
8
  * This function is used to get the text that will be read by the screen reader
@@ -15,3 +17,32 @@ export const getAccessibleAmountText = (amount?: string) =>
15
17
  ),
16
18
  O.getOrElseW(() => undefined)
17
19
  );
20
+
21
+ /**
22
+ * Query whether a bold text is currently enabled. The result is true
23
+ * when bold text is enabled and false otherwise.
24
+ */
25
+ export const useBoldTextEnabled = () => {
26
+ const [boldTextEnabled, setBoldTextEnabled] = useState(false);
27
+
28
+ useEffect(() => {
29
+ const boldTextChangedSubscription = AccessibilityInfo.addEventListener(
30
+ "boldTextChanged",
31
+ isBoldTextEnabled => {
32
+ setBoldTextEnabled(isBoldTextEnabled);
33
+ }
34
+ );
35
+
36
+ AccessibilityInfo.isBoldTextEnabled()
37
+ .then(isBoldTextEnabled => {
38
+ setBoldTextEnabled(isBoldTextEnabled);
39
+ })
40
+ .catch(_ => false);
41
+
42
+ return () => {
43
+ boldTextChangedSubscription.remove();
44
+ };
45
+ }, []);
46
+
47
+ return boldTextEnabled;
48
+ };
@@ -4,42 +4,57 @@
4
4
  * README file included in this repository.
5
5
  */
6
6
 
7
- import { Platform } from "react-native";
7
+ import { Platform, TextStyle } from "react-native";
8
8
 
9
9
  /**
10
10
  * Choose the font name based on the platform
11
11
  */
12
- const fonts = {
12
+ const fonts: Record<string, string> = {
13
13
  TitilliumSansPro: Platform.select({
14
14
  android: "TitilliumSansPro",
15
15
  web: "TitilliumSansPro",
16
- ios: "Titillium Sans Pro"
16
+ ios: "Titillium Sans Pro",
17
+ default: "TitilliumSansPro"
17
18
  }),
18
19
  ReadexPro: Platform.select({
19
20
  android: "ReadexPro",
20
21
  web: "ReadexPro",
21
- ios: "Readex Pro"
22
+ ios: "Readex Pro",
23
+ default: "ReadexPro"
22
24
  }),
23
25
  DMMono: Platform.select({
24
26
  android: "DMMono",
25
27
  web: "DMMono",
26
- ios: "DM Mono"
28
+ ios: "DM Mono",
29
+ default: "DMMono"
27
30
  })
28
31
  };
29
32
 
30
33
  export type IOFontFamily = keyof typeof fonts;
31
34
 
35
+ /*
36
+ * Font Sizes
37
+ */
38
+ const fontSizes = [12, 14, 16, 20, 22, 26, 28, 32] as const;
39
+ const fontSizesLegacy = [18, 28, 31, 35] as const;
40
+ const allFontSizes = [...new Set([...fontSizes, ...fontSizesLegacy])];
41
+ export type IOFontSize = (typeof allFontSizes)[number];
42
+
43
+ /*
44
+ * Font Weights
45
+ */
46
+
32
47
  const weights = ["Light", "Regular", "Medium", "Semibold", "Bold"] as const;
33
48
  export type IOFontWeight = (typeof weights)[number];
34
49
 
35
50
  const weightValues = ["300", "400", "500", "600", "700"] as const;
36
- export type FontWeightValue = (typeof weightValues)[number];
51
+ export type IOFontWeightNumeric = (typeof weightValues)[number];
37
52
 
38
53
  /**
39
54
  * Mapping between the nominal description of the weight (also the postfix used on Android) and the numeric value
40
55
  * used on iOS
41
56
  */
42
- export const fontWeights: Record<IOFontWeight, FontWeightValue> = {
57
+ export const fontWeights: Record<IOFontWeight, IOFontWeightNumeric> = {
43
58
  Light: "300",
44
59
  Regular: "400",
45
60
  Medium: "500",
@@ -47,30 +62,26 @@ export const fontWeights: Record<IOFontWeight, FontWeightValue> = {
47
62
  Bold: "700"
48
63
  };
49
64
 
50
- export type FontFamily = keyof typeof fonts;
51
- export type FontWeight = keyof typeof fontWeights;
52
-
53
- /**
54
- * Mapping between the nominal description of the weight (also the postfix used on Android) and the numeric value
55
- * used on iOS
56
- */
57
- export const fontWeightsMap: Record<IOFontWeight, FontWeightValue> = {
58
- Light: "300",
59
- Regular: "400",
60
- Medium: "500",
61
- Semibold: "600",
62
- Bold: "700"
65
+ type FontStyleObject = {
66
+ fontSize: IOFontSize;
67
+ fontFamily: IOFontFamily;
68
+ fontWeight?: IOFontWeightNumeric;
69
+ lineHeight?: TextStyle["lineHeight"];
70
+ fontStyle?: TextStyle["fontStyle"];
71
+ boldEnabled?: boolean;
63
72
  };
64
73
 
65
- export enum FontStyle {
66
- "normal" = "normal",
67
- "italic" = "italic"
68
- }
69
-
70
- type FontStyleObject = {
71
- fontFamily: string;
72
- fontWeight?: FontWeightValue;
73
- fontStyle?: FontStyle;
74
+ /* Function that, given a certain weight, returns the next
75
+ available `FontWeight` value.
76
+ For example, if I set it to `Regular`, the function
77
+ should return `Medium`, and so on. If I set it to the last `FontWeight`
78
+ value, the function will return the same value.
79
+ */
80
+ const getBolderFontWeight = (weight: IOFontWeight): IOFontWeight => {
81
+ const currentWeight = weights.indexOf(weight);
82
+ return currentWeight === weights.length - 1
83
+ ? weight
84
+ : weights[currentWeight + 1];
74
85
  };
75
86
 
76
87
  /**
@@ -80,42 +91,73 @@ type FontStyleObject = {
80
91
  * @param isItalic
81
92
  */
82
93
  export const makeFontFamilyName = (
83
- font: FontFamily,
84
- weight?: IOFontWeight,
85
- isItalic: boolean = false
86
- ): string =>
94
+ font: IOFontFamily,
95
+ weight: IOFontWeight = defaultWeight,
96
+ fontStyle: TextStyle["fontStyle"] = "normal"
97
+ ): IOFontFamily =>
87
98
  Platform.select({
88
99
  web: fonts[font],
89
- android: `${fonts[font]}-${weight || "Regular"}${isItalic ? "Italic" : ""}`,
100
+ android: `${fonts[font]}-${weight || "Regular"}${
101
+ fontStyle === "italic" ? "Italic" : ""
102
+ }`,
90
103
  ios: fonts[font],
91
- default: "undefined"
104
+ default: fonts[font]
92
105
  });
93
106
 
107
+ /**
108
+ * Default `IOText` typography style
109
+ */
110
+ const defaultFont: IOFontFamily = "TitilliumSansPro";
111
+ const defaultWeight: IOFontWeight = "Regular";
112
+ const defaultFontSize: IOFontSize = 16;
113
+
94
114
  /**
95
115
  * Return a {@link FontStyleObject} with the fields filled based on the platform (iOS or Android).
96
- * @param weight
97
- * @param isItalic
116
+ * @param size
98
117
  * @param font
118
+ * @param weight
119
+ * @param fontStyle
99
120
  */
121
+
100
122
  export const makeFontStyleObject = (
101
- weight: IOFontWeight | undefined = undefined,
102
- isItalic: boolean | undefined = false,
103
- font: FontFamily | undefined = "TitilliumSansPro"
104
- ): FontStyleObject =>
105
- Platform.select({
123
+ size: IOFontSize = defaultFontSize,
124
+ font: IOFontFamily = defaultFont,
125
+ lineHeight: TextStyle["lineHeight"],
126
+ weight: IOFontWeight = defaultWeight,
127
+ fontStyle: TextStyle["fontStyle"] = "normal",
128
+ boldEnabled: boolean = false
129
+ ): FontStyleObject => {
130
+ /* If bold text is currently enabled, we select the next
131
+ available `IOFontWeight` value */
132
+ const dynamicWeight = boldEnabled ? getBolderFontWeight(weight) : weight;
133
+
134
+ return Platform.select({
106
135
  web: {
107
- fontFamily: makeFontFamilyName(font, weight, isItalic),
108
- fontWeight: weight !== undefined ? fontWeightsMap[weight] : weight,
109
- fontStyle: isItalic ? FontStyle.italic : FontStyle.normal
136
+ fontSize: size,
137
+ fontFamily: makeFontFamilyName(font, dynamicWeight, fontStyle),
138
+ fontWeight: fontWeights[dynamicWeight],
139
+ lineHeight,
140
+ fontStyle
110
141
  },
142
+ // On Android other type attributes, like `fontWeight` or `fontStyle`
143
+ // are directly managed through the `fontFamily` name, so we dont' need to
144
+ // include them in the object.
111
145
  android: {
112
- includeFontPadding: false,
113
- fontFamily: makeFontFamilyName(font, weight, isItalic)
146
+ fontSize: size,
147
+ fontFamily: makeFontFamilyName(font, dynamicWeight, fontStyle),
148
+ lineHeight,
149
+ includeFontPadding: false
114
150
  },
115
151
  ios: {
116
- fontFamily: makeFontFamilyName(font, weight, isItalic),
117
- fontWeight: weight !== undefined ? fontWeightsMap[weight] : weight,
118
- fontStyle: isItalic ? FontStyle.italic : FontStyle.normal
152
+ fontSize: size,
153
+ fontFamily: makeFontFamilyName(font, dynamicWeight, fontStyle),
154
+ fontWeight: fontWeights[dynamicWeight],
155
+ lineHeight,
156
+ fontStyle
119
157
  },
120
- default: { fontFamily: "undefined" }
158
+ default: {
159
+ fontSize: size,
160
+ fontFamily: makeFontFamilyName(font, dynamicWeight, fontStyle)
161
+ }
121
162
  });
163
+ };
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.labelHeaderLineHeight = exports.labelHeaderFontSize = exports.labelHeaderDefaultColor = exports.LabelHeader = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _core = require("../../core");
9
- var _Factory = require("./Factory");
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
- const labelHeaderFontSize = 14;
12
- exports.labelHeaderFontSize = labelHeaderFontSize;
13
- const labelHeaderLineHeight = 18;
14
- exports.labelHeaderLineHeight = labelHeaderLineHeight;
15
- const labelHeaderDefaultColor = _core.IOThemeLight["textBody-default"];
16
- exports.labelHeaderDefaultColor = labelHeaderDefaultColor;
17
- const labelHeaderFontName = "ReadexPro";
18
- const labelHeaderDefaultWeight = "Regular";
19
-
20
- // TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
21
- const legacyLabelHeaderFontName = "TitilliumSansPro";
22
- const legacyLabelHeaderWeight = "Semibold";
23
- const legacyLabelHeaderLineHeight = 20;
24
- /**
25
- * `LabelHeader` typographic style
26
- */
27
- const LabelHeader = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
28
- const {
29
- isExperimental
30
- } = (0, _core.useIOExperimentalDesign)();
31
- // console.log("isExperimental", isExperimental);
32
- return (0, _Factory.useTypographyFactory)({
33
- ...props,
34
- defaultWeight: isExperimental ? labelHeaderDefaultWeight : legacyLabelHeaderWeight,
35
- defaultColor: labelHeaderDefaultColor,
36
- font: isExperimental ? labelHeaderFontName : legacyLabelHeaderFontName,
37
- fontStyle: {
38
- fontSize: labelHeaderFontSize,
39
- lineHeight: isExperimental ? labelHeaderLineHeight : legacyLabelHeaderLineHeight
40
- }
41
- }, ref);
42
- });
43
- exports.LabelHeader = LabelHeader;
44
- //# sourceMappingURL=LabelHeader.js.map