@pagopa/io-app-design-system 1.0.0-9 → 1.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 (265) hide show
  1. package/README.md +39 -4
  2. package/lib/commonjs/components/Advice/Advice.js +5 -7
  3. package/lib/commonjs/components/Advice/Advice.js.map +1 -1
  4. package/lib/commonjs/components/Advice/__test__/advice.test.js +2 -2
  5. package/lib/commonjs/components/Advice/__test__/advice.test.js.map +1 -1
  6. package/lib/commonjs/components/accordion/RawAccordion.js.map +1 -1
  7. package/lib/commonjs/components/badge/__test__/badge.test.js.map +1 -1
  8. package/lib/commonjs/components/buttons/ButtonLink.js +4 -5
  9. package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
  10. package/lib/commonjs/components/buttons/IconButton.js +0 -2
  11. package/lib/commonjs/components/buttons/IconButton.js.map +1 -1
  12. package/lib/commonjs/components/buttons/IconButtonContained.js +131 -0
  13. package/lib/commonjs/components/buttons/IconButtonContained.js.map +1 -0
  14. package/lib/commonjs/components/buttons/IconButtonSolid.js +109 -0
  15. package/lib/commonjs/components/buttons/IconButtonSolid.js.map +1 -0
  16. package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +370 -0
  17. package/lib/commonjs/components/buttons/__test__/button.test.js +27 -0
  18. package/lib/commonjs/components/buttons/__test__/button.test.js.map +1 -1
  19. package/lib/commonjs/components/buttons/index.js +30 -8
  20. package/lib/commonjs/components/buttons/index.js.map +1 -1
  21. package/lib/commonjs/components/checkbox/AnimatedCheckbox.js +1 -1
  22. package/lib/commonjs/components/checkbox/AnimatedCheckbox.js.map +1 -1
  23. package/lib/commonjs/components/icons/index.js +0 -18
  24. package/lib/commonjs/components/icons/index.js.map +1 -1
  25. package/lib/commonjs/components/index.js +72 -72
  26. package/lib/commonjs/components/index.js.map +1 -1
  27. package/lib/commonjs/components/layout/GradientBottomActions.js +90 -0
  28. package/lib/commonjs/components/layout/GradientBottomActions.js.map +1 -0
  29. package/lib/commonjs/components/layout/GradientScrollView.js +111 -0
  30. package/lib/commonjs/components/layout/GradientScrollView.js.map +1 -0
  31. package/lib/commonjs/components/layout/HeaderFirstLevel.js +62 -0
  32. package/lib/commonjs/components/layout/HeaderFirstLevel.js.map +1 -0
  33. package/lib/commonjs/components/layout/index.js +17 -0
  34. package/lib/commonjs/components/layout/index.js.map +1 -0
  35. package/lib/commonjs/components/listitems/ListItemCheckbox.js +135 -0
  36. package/lib/commonjs/components/listitems/ListItemCheckbox.js.map +1 -0
  37. package/lib/commonjs/components/listitems/ListItemInfo.js +3 -6
  38. package/lib/commonjs/components/listitems/ListItemInfo.js.map +1 -1
  39. package/lib/commonjs/components/listitems/ListItemInfoCopy.js +1 -4
  40. package/lib/commonjs/components/listitems/ListItemInfoCopy.js.map +1 -1
  41. package/lib/commonjs/components/listitems/ListItemRadio.js +136 -0
  42. package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -0
  43. package/lib/commonjs/components/listitems/ListItemSwitch.js +82 -0
  44. package/lib/commonjs/components/listitems/ListItemSwitch.js.map +1 -0
  45. package/lib/commonjs/components/listitems/ListItemTransaction.js.map +1 -1
  46. package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +0 -14
  47. package/lib/commonjs/components/listitems/index.js +33 -0
  48. package/lib/commonjs/components/listitems/index.js.map +1 -1
  49. package/lib/commonjs/components/logos/svg/LogoPaymentExtMaestro.js +3 -19
  50. package/lib/commonjs/components/logos/svg/LogoPaymentExtMaestro.js.map +1 -1
  51. package/lib/commonjs/components/logos/svg/LogoPaymentExtMastercard.js +5 -21
  52. package/lib/commonjs/components/logos/svg/LogoPaymentExtMastercard.js.map +1 -1
  53. package/lib/commonjs/components/logos/svg/LogoPaymentExtPayPal.js +9 -28
  54. package/lib/commonjs/components/logos/svg/LogoPaymentExtPayPal.js.map +1 -1
  55. package/lib/commonjs/components/logos/svg/LogoPaymentMaestro.js +8 -18
  56. package/lib/commonjs/components/logos/svg/LogoPaymentMaestro.js.map +1 -1
  57. package/lib/commonjs/components/logos/svg/LogoPaymentMastercard.js +7 -17
  58. package/lib/commonjs/components/logos/svg/LogoPaymentMastercard.js.map +1 -1
  59. package/lib/commonjs/components/logos/svg/LogoPaymentPayPal.js +5 -5
  60. package/lib/commonjs/components/logos/svg/LogoPaymentPayPal.js.map +1 -1
  61. package/lib/commonjs/components/radio/AnimatedRadio.js +1 -1
  62. package/lib/commonjs/components/radio/AnimatedRadio.js.map +1 -1
  63. package/lib/commonjs/components/radio/RadioGroup.js +36 -0
  64. package/lib/commonjs/components/radio/RadioGroup.js.map +1 -0
  65. package/lib/commonjs/components/radio/index.js +11 -0
  66. package/lib/commonjs/components/radio/index.js.map +1 -1
  67. package/lib/commonjs/components/typography/H3.js +20 -49
  68. package/lib/commonjs/components/typography/H3.js.map +1 -1
  69. package/lib/commonjs/components/typography/Link.js +17 -23
  70. package/lib/commonjs/components/typography/Link.js.map +1 -1
  71. package/lib/commonjs/components/typography/__test__/__snapshots__/typography.test.tsx.snap +50 -45
  72. package/lib/commonjs/core/IOColors.js +1 -1
  73. package/lib/commonjs/core/IOColors.js.map +1 -1
  74. package/lib/commonjs/core/IOSpacing.js +1 -1
  75. package/lib/commonjs/core/IOSpacing.js.map +1 -1
  76. package/lib/commonjs/core/IOStyles.js +7 -1
  77. package/lib/commonjs/core/IOStyles.js.map +1 -1
  78. package/lib/commonjs/index.js +11 -0
  79. package/lib/commonjs/index.js.map +1 -1
  80. package/lib/commonjs/json-import.d.js +2 -0
  81. package/lib/commonjs/json-import.d.js.map +1 -0
  82. package/lib/module/components/Advice/Advice.js +4 -6
  83. package/lib/module/components/Advice/Advice.js.map +1 -1
  84. package/lib/module/components/Advice/__test__/advice.test.js +1 -1
  85. package/lib/module/components/Advice/__test__/advice.test.js.map +1 -1
  86. package/lib/module/components/accordion/RawAccordion.js +1 -1
  87. package/lib/module/components/accordion/RawAccordion.js.map +1 -1
  88. package/lib/module/components/badge/__test__/badge.test.js.map +1 -1
  89. package/lib/module/components/buttons/ButtonLink.js +4 -5
  90. package/lib/module/components/buttons/ButtonLink.js.map +1 -1
  91. package/lib/module/components/buttons/IconButton.js +0 -2
  92. package/lib/module/components/buttons/IconButton.js.map +1 -1
  93. package/lib/module/components/buttons/IconButtonContained.js +122 -0
  94. package/lib/module/components/buttons/IconButtonContained.js.map +1 -0
  95. package/lib/module/components/buttons/IconButtonSolid.js +100 -0
  96. package/lib/module/components/buttons/IconButtonSolid.js.map +1 -0
  97. package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +370 -0
  98. package/lib/module/components/buttons/__test__/button.test.js +27 -0
  99. package/lib/module/components/buttons/__test__/button.test.js.map +1 -1
  100. package/lib/module/components/buttons/index.js +4 -2
  101. package/lib/module/components/buttons/index.js.map +1 -1
  102. package/lib/module/components/checkbox/AnimatedCheckbox.js +3 -3
  103. package/lib/module/components/checkbox/AnimatedCheckbox.js.map +1 -1
  104. package/lib/module/components/icons/index.js +0 -1
  105. package/lib/module/components/icons/index.js.map +1 -1
  106. package/lib/module/components/index.js +13 -13
  107. package/lib/module/components/index.js.map +1 -1
  108. package/lib/module/components/layout/GradientBottomActions.js +79 -0
  109. package/lib/module/components/layout/GradientBottomActions.js.map +1 -0
  110. package/lib/module/components/layout/GradientScrollView.js +100 -0
  111. package/lib/module/components/layout/GradientScrollView.js.map +1 -0
  112. package/lib/module/components/layout/HeaderFirstLevel.js +52 -0
  113. package/lib/module/components/layout/HeaderFirstLevel.js.map +1 -0
  114. package/lib/module/components/layout/index.js +2 -0
  115. package/lib/module/components/layout/index.js.map +1 -0
  116. package/lib/module/components/listitems/ListItemCheckbox.js +126 -0
  117. package/lib/module/components/listitems/ListItemCheckbox.js.map +1 -0
  118. package/lib/module/components/listitems/ListItemInfo.js +3 -6
  119. package/lib/module/components/listitems/ListItemInfo.js.map +1 -1
  120. package/lib/module/components/listitems/ListItemInfoCopy.js +1 -4
  121. package/lib/module/components/listitems/ListItemInfoCopy.js.map +1 -1
  122. package/lib/module/components/listitems/ListItemRadio.js +127 -0
  123. package/lib/module/components/listitems/ListItemRadio.js.map +1 -0
  124. package/lib/module/components/listitems/ListItemSwitch.js +74 -0
  125. package/lib/module/components/listitems/ListItemSwitch.js.map +1 -0
  126. package/lib/module/components/listitems/ListItemTransaction.js.map +1 -1
  127. package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +0 -14
  128. package/lib/module/components/listitems/index.js +3 -0
  129. package/lib/module/components/listitems/index.js.map +1 -1
  130. package/lib/module/components/logos/svg/LogoPaymentExtMaestro.js +3 -19
  131. package/lib/module/components/logos/svg/LogoPaymentExtMaestro.js.map +1 -1
  132. package/lib/module/components/logos/svg/LogoPaymentExtMastercard.js +5 -21
  133. package/lib/module/components/logos/svg/LogoPaymentExtMastercard.js.map +1 -1
  134. package/lib/module/components/logos/svg/LogoPaymentExtPayPal.js +10 -29
  135. package/lib/module/components/logos/svg/LogoPaymentExtPayPal.js.map +1 -1
  136. package/lib/module/components/logos/svg/LogoPaymentMaestro.js +9 -19
  137. package/lib/module/components/logos/svg/LogoPaymentMaestro.js.map +1 -1
  138. package/lib/module/components/logos/svg/LogoPaymentMastercard.js +8 -18
  139. package/lib/module/components/logos/svg/LogoPaymentMastercard.js.map +1 -1
  140. package/lib/module/components/logos/svg/LogoPaymentPayPal.js +5 -5
  141. package/lib/module/components/logos/svg/LogoPaymentPayPal.js.map +1 -1
  142. package/lib/module/components/radio/AnimatedRadio.js +3 -3
  143. package/lib/module/components/radio/AnimatedRadio.js.map +1 -1
  144. package/lib/module/components/radio/RadioGroup.js +28 -0
  145. package/lib/module/components/radio/RadioGroup.js.map +1 -0
  146. package/lib/module/components/radio/index.js +1 -0
  147. package/lib/module/components/radio/index.js.map +1 -1
  148. package/lib/module/components/typography/H3.js +19 -47
  149. package/lib/module/components/typography/H3.js.map +1 -1
  150. package/lib/module/components/typography/Link.js +17 -23
  151. package/lib/module/components/typography/Link.js.map +1 -1
  152. package/lib/module/components/typography/__test__/__snapshots__/typography.test.tsx.snap +50 -45
  153. package/lib/module/core/IOColors.js +1 -1
  154. package/lib/module/core/IOColors.js.map +1 -1
  155. package/lib/module/core/IOSpacing.js +1 -1
  156. package/lib/module/core/IOSpacing.js.map +1 -1
  157. package/lib/module/core/IOStyles.js +5 -0
  158. package/lib/module/core/IOStyles.js.map +1 -1
  159. package/lib/module/index.js +1 -0
  160. package/lib/module/index.js.map +1 -1
  161. package/lib/module/json-import.d.js +2 -0
  162. package/lib/module/json-import.d.js.map +1 -0
  163. package/lib/typescript/components/Advice/Advice.d.ts +7 -3
  164. package/lib/typescript/components/Advice/Advice.d.ts.map +1 -1
  165. package/lib/typescript/components/accordion/RawAccordion.d.ts +2 -2
  166. package/lib/typescript/components/accordion/RawAccordion.d.ts.map +1 -1
  167. package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
  168. package/lib/typescript/components/buttons/IconButton.d.ts.map +1 -1
  169. package/lib/typescript/components/buttons/IconButtonContained.d.ts +15 -0
  170. package/lib/typescript/components/buttons/IconButtonContained.d.ts.map +1 -0
  171. package/lib/typescript/components/buttons/IconButtonSolid.d.ts +15 -0
  172. package/lib/typescript/components/buttons/IconButtonSolid.d.ts.map +1 -0
  173. package/lib/typescript/components/buttons/index.d.ts +4 -2
  174. package/lib/typescript/components/buttons/index.d.ts.map +1 -1
  175. package/lib/typescript/components/checkbox/AnimatedCheckbox.d.ts.map +1 -1
  176. package/lib/typescript/components/icons/index.d.ts +0 -1
  177. package/lib/typescript/components/icons/index.d.ts.map +1 -1
  178. package/lib/typescript/components/index.d.ts +13 -13
  179. package/lib/typescript/components/index.d.ts.map +1 -1
  180. package/lib/typescript/components/layout/GradientBottomActions.d.ts +22 -0
  181. package/lib/typescript/components/layout/GradientBottomActions.d.ts.map +1 -0
  182. package/lib/typescript/components/layout/GradientScrollView.d.ts +14 -0
  183. package/lib/typescript/components/layout/GradientScrollView.d.ts.map +1 -0
  184. package/lib/typescript/components/layout/HeaderFirstLevel.d.ts +11 -0
  185. package/lib/typescript/components/layout/HeaderFirstLevel.d.ts.map +1 -0
  186. package/lib/typescript/components/layout/index.d.ts +2 -0
  187. package/lib/typescript/components/layout/index.d.ts.map +1 -0
  188. package/lib/typescript/components/listitems/ListItemCheckbox.d.ts +21 -0
  189. package/lib/typescript/components/listitems/ListItemCheckbox.d.ts.map +1 -0
  190. package/lib/typescript/components/listitems/ListItemInfo.d.ts.map +1 -1
  191. package/lib/typescript/components/listitems/ListItemInfoCopy.d.ts.map +1 -1
  192. package/lib/typescript/components/listitems/ListItemRadio.d.ts +22 -0
  193. package/lib/typescript/components/listitems/ListItemRadio.d.ts.map +1 -0
  194. package/lib/typescript/components/listitems/ListItemSwitch.d.ts +18 -0
  195. package/lib/typescript/components/listitems/ListItemSwitch.d.ts.map +1 -0
  196. package/lib/typescript/components/listitems/ListItemTransaction.d.ts.map +1 -1
  197. package/lib/typescript/components/listitems/index.d.ts +3 -0
  198. package/lib/typescript/components/listitems/index.d.ts.map +1 -1
  199. package/lib/typescript/components/logos/svg/LogoPaymentExtMaestro.d.ts.map +1 -1
  200. package/lib/typescript/components/logos/svg/LogoPaymentExtMastercard.d.ts +2 -2
  201. package/lib/typescript/components/logos/svg/LogoPaymentExtMastercard.d.ts.map +1 -1
  202. package/lib/typescript/components/logos/svg/LogoPaymentExtPayPal.d.ts.map +1 -1
  203. package/lib/typescript/components/logos/svg/LogoPaymentMaestro.d.ts.map +1 -1
  204. package/lib/typescript/components/logos/svg/LogoPaymentMastercard.d.ts.map +1 -1
  205. package/lib/typescript/components/radio/AnimatedRadio.d.ts.map +1 -1
  206. package/lib/typescript/components/radio/RadioGroup.d.ts +22 -0
  207. package/lib/typescript/components/radio/RadioGroup.d.ts.map +1 -0
  208. package/lib/typescript/components/radio/index.d.ts +1 -0
  209. package/lib/typescript/components/radio/index.d.ts.map +1 -1
  210. package/lib/typescript/components/typography/H3.d.ts +11 -30
  211. package/lib/typescript/components/typography/H3.d.ts.map +1 -1
  212. package/lib/typescript/components/typography/Link.d.ts +4 -4
  213. package/lib/typescript/components/typography/Link.d.ts.map +1 -1
  214. package/lib/typescript/core/IOColors.d.ts +2 -1
  215. package/lib/typescript/core/IOColors.d.ts.map +1 -1
  216. package/lib/typescript/core/IOSpacing.d.ts +1 -1
  217. package/lib/typescript/core/IOSpacing.d.ts.map +1 -1
  218. package/lib/typescript/core/IOStyles.d.ts +6 -2
  219. package/lib/typescript/core/IOStyles.d.ts.map +1 -1
  220. package/lib/typescript/index.d.ts +1 -0
  221. package/lib/typescript/index.d.ts.map +1 -1
  222. package/package.json +9 -5
  223. package/src/components/Advice/Advice.tsx +19 -23
  224. package/src/components/Advice/__test__/advice.test.tsx +4 -2
  225. package/src/components/accordion/RawAccordion.tsx +6 -6
  226. package/src/components/badge/__test__/badge.test.tsx +4 -2
  227. package/src/components/buttons/ButtonLink.tsx +177 -177
  228. package/src/components/buttons/IconButton.tsx +9 -6
  229. package/src/components/buttons/IconButtonContained.tsx +201 -0
  230. package/src/components/buttons/IconButtonSolid.tsx +168 -0
  231. package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +370 -0
  232. package/src/components/buttons/__test__/button.test.tsx +59 -4
  233. package/src/components/buttons/index.tsx +5 -3
  234. package/src/components/checkbox/AnimatedCheckbox.tsx +6 -8
  235. package/src/components/icons/index.tsx +1 -2
  236. package/src/components/index.tsx +13 -13
  237. package/src/components/layout/GradientBottomActions.tsx +119 -0
  238. package/src/components/layout/GradientScrollView.tsx +167 -0
  239. package/src/components/layout/HeaderFirstLevel.tsx +76 -0
  240. package/src/components/layout/index.tsx +1 -0
  241. package/src/components/listitems/ListItemCheckbox.tsx +182 -0
  242. package/src/components/listitems/ListItemInfo.tsx +53 -58
  243. package/src/components/listitems/ListItemInfoCopy.tsx +122 -127
  244. package/src/components/listitems/ListItemRadio.tsx +185 -0
  245. package/src/components/listitems/ListItemSwitch.tsx +109 -0
  246. package/src/components/listitems/ListItemTransaction.tsx +154 -150
  247. package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +0 -14
  248. package/src/components/listitems/index.tsx +3 -0
  249. package/src/components/logos/svg/LogoPaymentExtMaestro.tsx +3 -20
  250. package/src/components/logos/svg/LogoPaymentExtMastercard.tsx +5 -22
  251. package/src/components/logos/svg/LogoPaymentExtPayPal.tsx +9 -31
  252. package/src/components/logos/svg/LogoPaymentMaestro.tsx +8 -6
  253. package/src/components/logos/svg/LogoPaymentMastercard.tsx +8 -6
  254. package/src/components/logos/svg/LogoPaymentPayPal.tsx +5 -5
  255. package/src/components/radio/AnimatedRadio.tsx +6 -8
  256. package/src/components/radio/RadioGroup.tsx +43 -0
  257. package/src/components/radio/index.tsx +1 -0
  258. package/src/components/typography/H3.tsx +25 -91
  259. package/src/components/typography/Link.tsx +23 -30
  260. package/src/components/typography/__test__/__snapshots__/typography.test.tsx.snap +50 -45
  261. package/src/core/IOColors.ts +2 -2
  262. package/src/core/IOSpacing.ts +2 -2
  263. package/src/core/IOStyles.ts +9 -0
  264. package/src/index.tsx +1 -0
  265. package/src/json-import.d.ts +13 -0
@@ -1,16 +1,16 @@
1
1
  import React, { useEffect } from "react";
2
- import { StyleSheet, View, Pressable, PressableProps } from "react-native";
2
+ import { Pressable, PressableProps, StyleSheet, View } from "react-native";
3
3
  import Animated, {
4
- useSharedValue,
5
- useAnimatedStyle,
4
+ Easing,
6
5
  interpolate,
6
+ useAnimatedStyle,
7
+ useSharedValue,
7
8
  withSpring,
8
- withTiming,
9
- Easing
9
+ withTiming
10
10
  } from "react-native-reanimated";
11
- import { IOSelectionTickVisualParams } from "../../core/IOStyles";
12
11
  import { IOSpringValues } from "../../core/IOAnimations";
13
12
  import { IOColors } from "../../core/IOColors";
13
+ import { IOSelectionTickVisualParams } from "../../core/IOStyles";
14
14
  import { AnimatedTick } from "../common/AnimatedTick";
15
15
 
16
16
  type Props = {
@@ -83,7 +83,6 @@ export const AnimatedRadio = ({ checked, onPress, disabled }: OwnProps) => {
83
83
  onPress={onPress}
84
84
  style={styles.radioWrapper}
85
85
  >
86
- {/* ◀ REMOVE_LEGACY_COMPONENT: Remove the following conditions */}
87
86
  <View
88
87
  style={[
89
88
  styles.radioBorder,
@@ -103,7 +102,6 @@ export const AnimatedRadio = ({ checked, onPress, disabled }: OwnProps) => {
103
102
  animatedCheckboxSquare
104
103
  ]}
105
104
  />
106
- {/* REMOVE_LEGACY_COMPONENT: End ▶ */}
107
105
  {isChecked && (
108
106
  <View>
109
107
  <AnimatedTick
@@ -0,0 +1,43 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
3
+ import { Divider } from "../divider";
4
+ import { IOIcons } from "../icons";
5
+ import { ListItemRadio } from "../listitems/ListItemRadio";
6
+
7
+ export type NewRadioItem<T> = {
8
+ id: T;
9
+ value: string;
10
+ description?: string;
11
+ icon?: IOIcons;
12
+ disabled?: boolean;
13
+ };
14
+
15
+ type Props<T> = {
16
+ items: ReadonlyArray<NewRadioItem<T>>;
17
+ selectedItem?: T;
18
+ onPress: (selected: T) => void;
19
+ };
20
+
21
+ /**
22
+ * A list of radio buttons.
23
+ * The management of the selection is demanded and derived by the `selectedItem` prop.
24
+ * The item with the `id` equal to the `selectedItem` is the active one.
25
+ */
26
+ export const RadioGroup = <T,>({ items, selectedItem, onPress }: Props<T>) => (
27
+ <View>
28
+ {items.map((item, index) => (
29
+ <React.Fragment key={`radio_item_${item.id}`}>
30
+ <ListItemRadio
31
+ testID={`RadioItemTestID_${item.id}`}
32
+ value={item.value}
33
+ description={item.description}
34
+ icon={item.icon}
35
+ disabled={item.disabled}
36
+ onValueChange={() => onPress(item.id)}
37
+ selected={selectedItem === item.id}
38
+ />
39
+ {index < items.length - 1 && <Divider />}
40
+ </React.Fragment>
41
+ ))}
42
+ </View>
43
+ );
@@ -1 +1,2 @@
1
1
  export * from "./AnimatedRadio";
2
+ export * from "./RadioGroup";
@@ -1,101 +1,35 @@
1
- import React from "react";
2
- import type { IOColors, IOTheme } from "../../core/IOColors";
3
- import { FontFamily, IOFontWeight } from "../../utils/fonts";
1
+ import * as React from "react";
2
+ import { IOFontFamily, IOFontWeight } from "../../utils/fonts";
3
+ import { IOColorsStatusForeground, IOTheme } from "../../core";
4
+ import { ExternalTypographyProps, TypographyProps } from "./common";
4
5
  import { useTypographyFactory } from "./Factory";
5
- import { ExternalTypographyProps, RequiredTypographyProps } from "./common";
6
6
 
7
- // these colors are allowed only when the weight is SemiBold
8
- type AllowedSemiBoldColors = Extract<
9
- IOColors,
10
- | "bluegreyDark"
11
- | "bluegreyLight"
12
- | "white"
13
- | "red"
14
- | "blue"
15
- | "bluegrey"
16
- | "grey"
17
- >;
7
+ type AllowedColors = IOColorsStatusForeground | IOTheme["textHeading-default"];
8
+ type AllowedWeight = Extract<IOFontWeight, "Bold" | "Regular">;
18
9
 
19
- // when the weight is bold, only the white color is allowed
20
- type AllowedBoldColors = Extract<
21
- IOColors,
22
- | "white"
23
- | "bluegreyLight"
24
- | "black"
25
- | "bluegreyDark"
26
- | "blue"
27
- | "bluegrey"
28
- | "grey-200"
10
+ type OwnProps = ExternalTypographyProps<
11
+ TypographyProps<AllowedWeight, AllowedColors>
29
12
  >;
30
13
 
31
- // all the possible colors
32
- type AllowedColors =
33
- | AllowedBoldColors
34
- | AllowedSemiBoldColors
35
- | IOTheme["textHeading-default"];
36
-
37
- // all the possible weight
38
- type AllowedWeight = Extract<IOFontWeight, "Bold" | "SemiBold">;
39
-
40
- // these are the properties allowed only if weight is undefined or SemiBold
41
- type SemiBoldProps = {
42
- weight?: Extract<IOFontWeight, "SemiBold">;
43
- color?: AllowedSemiBoldColors | IOTheme["textHeading-default"];
44
- };
45
-
46
- // these are the properties allowed only if weight is Bold
47
- type BoldProps = {
48
- weight: Extract<IOFontWeight, "Bold">;
49
- color?: AllowedBoldColors | IOTheme["textHeading-default"];
50
- };
51
-
52
- type BoldKindProps = SemiBoldProps | BoldProps;
53
-
54
- type OwnProps = ExternalTypographyProps<BoldKindProps>;
55
-
56
- export const h3FontSize = 18;
57
- export const h3LineHeight = 22;
58
-
59
- /**
60
- * A custom function to calculate the values if no weight or color is provided.
61
- * The choose of the default color depends on the weight, for this reason cannot be used
62
- * the default calculateWeightColor with fallback if undefined.
63
- * @param weight
64
- * @param color
65
- */
66
- export const calculateH3WeightColor = (
67
- weight?: AllowedWeight,
68
- color?: AllowedColors
69
- ): RequiredTypographyProps<AllowedWeight, AllowedColors> => {
70
- const newWeight = weight ?? "SemiBold";
71
- const newColor =
72
- color !== undefined
73
- ? color
74
- : newWeight === "SemiBold"
75
- ? "bluegreyDark"
76
- : "white";
77
- return {
78
- weight: newWeight,
79
- color: newColor
80
- };
81
- };
14
+ /* Common typographic styles */
15
+ export const h3FontSize = 22;
16
+ export const h3LineHeight = 33;
17
+ /* New typographic styles */
18
+ const h3FontName: IOFontFamily = "ReadexPro";
19
+ const h3DefaultColor: AllowedColors = "black";
20
+ const h3DefaultWeight: AllowedWeight = "Regular";
82
21
 
83
22
  /**
84
- * Typography component to render `H3` text with font size {@link fontSize} and fontFamily {@link fontName}.
85
- * default values(if not defined) are weight: `SemiBold`, color: `bluegreyDark`
23
+ * Typography component to render `H2` text with font size {@link fontSize} and fontFamily {@link fontName}.
24
+ * default values(if not defined) are weight: `Bold`, color: `bluegreyDark`
86
25
  * @param props
87
26
  * @constructor
88
27
  */
89
- export const H3: React.FC<OwnProps> = (props) => {
90
- const fontName: FontFamily = "TitilliumWeb";
91
- const weightColorFactory = React.useCallback(
92
- () => calculateH3WeightColor(props.weight, props.color),
93
- [props.weight, props.color]
94
- );
95
- return useTypographyFactory<AllowedWeight, AllowedColors>({
96
- ...props,
97
- weightColorFactory,
98
- font: fontName,
99
- fontStyle: { fontSize: h3FontSize, lineHeight: h3LineHeight }
100
- });
101
- };
28
+ export const H3: React.FunctionComponent<OwnProps> = props =>
29
+ useTypographyFactory<AllowedWeight, AllowedColors>({
30
+ ...props,
31
+ defaultWeight: h3DefaultWeight,
32
+ defaultColor: h3DefaultColor,
33
+ font: h3FontName,
34
+ fontStyle: { fontSize: h3FontSize, lineHeight: h3LineHeight }
35
+ });
@@ -1,8 +1,8 @@
1
- import React from "react";
2
- import type { IOColors } from "../../core/IOColors";
3
- import { FontFamily, IOFontWeight } from "../../utils/fonts";
4
- import { useTypographyFactory } from "./Factory";
1
+ import * as React from "react";
2
+ import { IOFontFamily, IOFontWeight } from "../../utils/fonts";
3
+ import type { IOColors } from "../../core";
5
4
  import { ExternalTypographyProps, TypographyProps } from "./common";
5
+ import { useTypographyFactory } from "./Factory";
6
6
 
7
7
  type AllowedColors = IOColors;
8
8
  type AllowedWeight = Extract<IOFontWeight, "SemiBold" | "Bold">;
@@ -10,40 +10,33 @@ type FontSize = "regular" | "small";
10
10
  type AllowedFontSize = { fontSize?: FontSize };
11
11
 
12
12
  type OwnProps = ExternalTypographyProps<
13
- TypographyProps<AllowedWeight, AllowedColors>
13
+ TypographyProps<AllowedWeight, AllowedColors>
14
14
  > &
15
- AllowedFontSize;
15
+ AllowedFontSize;
16
+
17
+ const fontName: IOFontFamily = "TitilliumWeb";
18
+ const fontSizeMapping: Record<FontSize, number> = { regular: 16, small: 14 };
16
19
 
17
20
  export const linkDefaultColor: AllowedColors = "blueIO-500";
18
21
  export const linkDefaultWeight: AllowedWeight = "Bold";
19
22
 
20
23
  /**
21
24
  * Typography component to render `Link` text with font size {@link fontSize} and fontFamily {@link fontName}.
22
- * default values(if not defined) are weight: `Bold/SemiBold`, color: `blue/blueIO-500`
25
+ * default values(if not defined) are weight: `SemiBold`, color: `blue`
23
26
  * @param props`
24
27
  * @constructor
25
28
  */
26
- export const Link: React.FC<OwnProps> = (props) => {
27
- const fontName: FontFamily = "TitilliumWeb";
28
- const fontSizeMapping: Record<FontSize, number> = { regular: 16, small: 14 };
29
-
30
- const defaultWeight = linkDefaultWeight;
31
- const defaultColor = linkDefaultColor;
32
-
33
- const defaultFontSize = props.fontSize
29
+ export const Link: React.FunctionComponent<OwnProps> = props =>
30
+ useTypographyFactory<AllowedWeight, AllowedColors>({
31
+ accessibilityRole: props.onPress ? "link" : undefined,
32
+ ...props,
33
+ defaultWeight: linkDefaultWeight,
34
+ defaultColor: linkDefaultColor,
35
+ font: fontName,
36
+ fontStyle: {
37
+ fontSize: props.fontSize
34
38
  ? fontSizeMapping[props.fontSize]
35
- : fontSizeMapping.regular;
36
- const defaultTextDecorationLine = "underline";
37
-
38
- return useTypographyFactory<AllowedWeight, AllowedColors>({
39
- accessibilityRole: props.onPress ? "link" : undefined,
40
- ...props,
41
- defaultWeight,
42
- defaultColor,
43
- font: fontName,
44
- fontStyle: {
45
- fontSize: defaultFontSize,
46
- textDecorationLine: defaultTextDecorationLine
47
- },
48
- });
49
- };
39
+ : fontSizeMapping.regular,
40
+ textDecorationLine: "underline"
41
+ }
42
+ });
@@ -130,30 +130,31 @@ exports[`Test Typography Components H2 Snapshot 1`] = `
130
130
 
131
131
  exports[`Test Typography Components H3 Snapshot 1`] = `
132
132
  <Text
133
- color="bluegreyDark"
134
- font="TitilliumWeb"
133
+ color="black"
134
+ defaultColor="black"
135
+ defaultWeight="Regular"
136
+ font="ReadexPro"
135
137
  fontStyle={
136
138
  {
137
- "fontSize": 18,
138
- "lineHeight": 22,
139
+ "fontSize": 22,
140
+ "lineHeight": 33,
139
141
  }
140
142
  }
141
143
  style={
142
144
  [
143
145
  {
144
- "fontSize": 18,
145
- "lineHeight": 22,
146
+ "fontSize": 22,
147
+ "lineHeight": 33,
146
148
  },
147
149
  {
148
- "color": "#17324D",
149
- "fontFamily": "Titillium Web",
150
+ "color": "#0E0F13",
151
+ "fontFamily": "Readex Pro",
150
152
  "fontStyle": "normal",
151
- "fontWeight": "600",
153
+ "fontWeight": "400",
152
154
  },
153
155
  ]
154
156
  }
155
- weight="SemiBold"
156
- weightColorFactory={[Function]}
157
+ weight="Regular"
157
158
  >
158
159
  Text
159
160
  </Text>
@@ -162,29 +163,30 @@ exports[`Test Typography Components H3 Snapshot 1`] = `
162
163
  exports[`Test Typography Components H3 Snapshot 2`] = `
163
164
  <Text
164
165
  color="bluegreyLight"
165
- font="TitilliumWeb"
166
+ defaultColor="black"
167
+ defaultWeight="Regular"
168
+ font="ReadexPro"
166
169
  fontStyle={
167
170
  {
168
- "fontSize": 18,
169
- "lineHeight": 22,
171
+ "fontSize": 22,
172
+ "lineHeight": 33,
170
173
  }
171
174
  }
172
175
  style={
173
176
  [
174
177
  {
175
- "fontSize": 18,
176
- "lineHeight": 22,
178
+ "fontSize": 22,
179
+ "lineHeight": 33,
177
180
  },
178
181
  {
179
182
  "color": "#CCD4DC",
180
- "fontFamily": "Titillium Web",
183
+ "fontFamily": "Readex Pro",
181
184
  "fontStyle": "normal",
182
- "fontWeight": "600",
185
+ "fontWeight": "400",
183
186
  },
184
187
  ]
185
188
  }
186
- weight="SemiBold"
187
- weightColorFactory={[Function]}
189
+ weight="Regular"
188
190
  >
189
191
  Text
190
192
  </Text>
@@ -193,29 +195,30 @@ exports[`Test Typography Components H3 Snapshot 2`] = `
193
195
  exports[`Test Typography Components H3 Snapshot 3`] = `
194
196
  <Text
195
197
  color="white"
196
- font="TitilliumWeb"
198
+ defaultColor="black"
199
+ defaultWeight="Regular"
200
+ font="ReadexPro"
197
201
  fontStyle={
198
202
  {
199
- "fontSize": 18,
200
- "lineHeight": 22,
203
+ "fontSize": 22,
204
+ "lineHeight": 33,
201
205
  }
202
206
  }
203
207
  style={
204
208
  [
205
209
  {
206
- "fontSize": 18,
207
- "lineHeight": 22,
210
+ "fontSize": 22,
211
+ "lineHeight": 33,
208
212
  },
209
213
  {
210
214
  "color": "#FFFFFF",
211
- "fontFamily": "Titillium Web",
215
+ "fontFamily": "Readex Pro",
212
216
  "fontStyle": "normal",
213
- "fontWeight": "600",
217
+ "fontWeight": "400",
214
218
  },
215
219
  ]
216
220
  }
217
- weight="SemiBold"
218
- weightColorFactory={[Function]}
221
+ weight="Regular"
219
222
  >
220
223
  Text
221
224
  </Text>
@@ -224,29 +227,30 @@ exports[`Test Typography Components H3 Snapshot 3`] = `
224
227
  exports[`Test Typography Components H3 Snapshot 4`] = `
225
228
  <Text
226
229
  color="white"
227
- font="TitilliumWeb"
230
+ defaultColor="black"
231
+ defaultWeight="Regular"
232
+ font="ReadexPro"
228
233
  fontStyle={
229
234
  {
230
- "fontSize": 18,
231
- "lineHeight": 22,
235
+ "fontSize": 22,
236
+ "lineHeight": 33,
232
237
  }
233
238
  }
234
239
  style={
235
240
  [
236
241
  {
237
- "fontSize": 18,
238
- "lineHeight": 22,
242
+ "fontSize": 22,
243
+ "lineHeight": 33,
239
244
  },
240
245
  {
241
246
  "color": "#FFFFFF",
242
- "fontFamily": "Titillium Web",
247
+ "fontFamily": "Readex Pro",
243
248
  "fontStyle": "normal",
244
249
  "fontWeight": "700",
245
250
  },
246
251
  ]
247
252
  }
248
253
  weight="Bold"
249
- weightColorFactory={[Function]}
250
254
  >
251
255
  Text
252
256
  </Text>
@@ -254,30 +258,31 @@ exports[`Test Typography Components H3 Snapshot 4`] = `
254
258
 
255
259
  exports[`Test Typography Components H3 Snapshot 5`] = `
256
260
  <Text
257
- color="white"
258
- font="TitilliumWeb"
261
+ color="black"
262
+ defaultColor="black"
263
+ defaultWeight="Regular"
264
+ font="ReadexPro"
259
265
  fontStyle={
260
266
  {
261
- "fontSize": 18,
262
- "lineHeight": 22,
267
+ "fontSize": 22,
268
+ "lineHeight": 33,
263
269
  }
264
270
  }
265
271
  style={
266
272
  [
267
273
  {
268
- "fontSize": 18,
269
- "lineHeight": 22,
274
+ "fontSize": 22,
275
+ "lineHeight": 33,
270
276
  },
271
277
  {
272
- "color": "#FFFFFF",
273
- "fontFamily": "Titillium Web",
278
+ "color": "#0E0F13",
279
+ "fontFamily": "Readex Pro",
274
280
  "fontStyle": "normal",
275
281
  "fontWeight": "700",
276
282
  },
277
283
  ]
278
284
  }
279
285
  weight="Bold"
280
- weightColorFactory={[Function]}
281
286
  >
282
287
  Text
283
288
  </Text>
@@ -404,8 +404,8 @@ Return the color value with RGBA format (RGB + Alpha transparency), starting fro
404
404
  @param opacity Opacity value that range from 0 to 1. Default value = 1.
405
405
  */
406
406
  /* Taken from this Gist: https://gist.github.com/danieliser/b4b24c9f772066bcf0a6 */
407
- export const hexToRgba = (hexCode: string, opacity: number = 1) => {
408
- const hex = hexCode.replace("#", "");
407
+ export const hexToRgba = (hexCode: ColorValue, opacity: number = 1) => {
408
+ const hex = hexCode.toString().replace("#", "");
409
409
 
410
410
  const r = parseInt(hex.substring(0, 2), 16);
411
411
  const g = parseInt(hex.substring(2, 4), 16);
@@ -5,7 +5,7 @@ should use a value defined in the following scale.
5
5
  */
6
6
 
7
7
  export const IOSpacingScale = [
8
- 4, 6, 8, 12, 16, 20, 24, 28, 32, 40, 48, 56, 64, 72
8
+ 4, 6, 8, 12, 16, 20, 24, 28, 32, 40, 48, 56, 64, 72, 80
9
9
  ] as const;
10
10
 
11
11
  export type IOSpacingScale = (typeof IOSpacingScale)[number];
@@ -45,4 +45,4 @@ export type IOListItemIDPSpacing = Extract<IOSpacingScale, 8 | 16 | 24>;
45
45
  export const IOListItemIDPHSpacing: IOListItemIDPSpacing = 16 as const;
46
46
  export const IOListItemIDPVSpacing: IOListItemIDPSpacing = 16 as const;
47
47
  export const IOListItemIDPSavedVSpacing: IOListItemIDPSpacing = 24 as const;
48
- export const IOListItemLogoMargin: IOListItemIDPSpacing = 8 as const;
48
+ export const IOListItemLogoMargin: IOListItemIDPSpacing = 8 as const;
@@ -9,6 +9,8 @@ import { IOAppMargin, IOSpacer, IOSpacingScale } from "./IOSpacing";
9
9
 
10
10
  interface IOVisualCostants {
11
11
  appMarginDefault: IOAppMargin;
12
+ // Header
13
+ headerHeight: number;
12
14
  // Dimensions
13
15
  avatarSizeSmall: number;
14
16
  avatarSizeMedium: number;
@@ -16,6 +18,7 @@ interface IOVisualCostants {
16
18
 
17
19
  export const IOVisualCostants: IOVisualCostants = {
18
20
  appMarginDefault: 24,
21
+ headerHeight: 56,
19
22
  avatarSizeSmall: 44,
20
23
  avatarSizeMedium: 66
21
24
  };
@@ -88,6 +91,8 @@ const btnSizeLarge = 56;
88
91
  // NEW Design System
89
92
  const btnBorderRadius = 8;
90
93
  const btnSizeDefault = 48;
94
+ export const buttonSolidHeight: number = btnSizeDefault;
95
+
91
96
  // TODO: Replace the number type with the new IOIconSizeScale
92
97
  const iconBtnSizeSmall: number = 24;
93
98
 
@@ -217,6 +222,7 @@ interface IOListItemVisualParams {
217
222
  paddingVertical: IOSpacingScale;
218
223
  paddingHorizontal: IOAppMargin;
219
224
  iconMargin: IOSpacingScale;
225
+ actionMargin: IOSpacingScale;
220
226
  iconSize: IOIconSizeScale;
221
227
  chevronSize: IOIconSizeScale;
222
228
  }
@@ -225,6 +231,7 @@ export const IOListItemVisualParams: IOListItemVisualParams = {
225
231
  paddingVertical: 12,
226
232
  paddingHorizontal: IOVisualCostants.appMarginDefault,
227
233
  iconMargin: 16,
234
+ actionMargin: 16,
228
235
  iconSize: 24,
229
236
  chevronSize: 24
230
237
  };
@@ -298,6 +305,7 @@ interface IOSelectionListItemVisualParams {
298
305
  paddingVertical: IOSpacingScale;
299
306
  paddingHorizontal: IOAppMargin;
300
307
  iconMargin: IOSpacingScale;
308
+ actionMargin: IOSpacer;
301
309
  iconSize: IOIconSizeScale;
302
310
  descriptionMargin: IOSpacer;
303
311
  }
@@ -308,6 +316,7 @@ export const IOSelectionListItemVisualParams: IOSelectionListItemVisualParams =
308
316
  paddingHorizontal: IOVisualCostants.appMarginDefault,
309
317
  iconMargin: 8,
310
318
  iconSize: 24,
319
+ actionMargin: 16,
311
320
  descriptionMargin: 4
312
321
  };
313
322
 
package/src/index.tsx CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./core";
2
2
  export * from "./components";
3
3
  export * from "./functions";
4
+ export * from "./utils/types";
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Allow import of json files.
3
+ *
4
+ * Ex: import jsonFile from '../file.json`
5
+ *
6
+ * More @https://hackernoon.com/import-json-into-typescript-8d465beded79
7
+ */
8
+
9
+ declare module "*.json" {
10
+ const value: any;
11
+ export default value;
12
+ }
13
+