@pagopa/io-app-design-system 4.5.5 → 4.6.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 (182) hide show
  1. package/lib/commonjs/components/accordion/AccordionItem.js +20 -56
  2. package/lib/commonjs/components/accordion/AccordionItem.js.map +1 -1
  3. package/lib/commonjs/components/banner/Banner.js +3 -2
  4. package/lib/commonjs/components/banner/Banner.js.map +1 -1
  5. package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +56 -0
  6. package/lib/commonjs/components/buttons/ButtonLink.js +1 -1
  7. package/lib/commonjs/components/buttons/ButtonSolid.js +1 -1
  8. package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
  9. package/lib/commonjs/components/checkbox/AnimatedCheckbox.js +8 -5
  10. package/lib/commonjs/components/checkbox/AnimatedCheckbox.js.map +1 -1
  11. package/lib/commonjs/components/checkbox/AnimatedMessageCheckbox.js +4 -2
  12. package/lib/commonjs/components/checkbox/AnimatedMessageCheckbox.js.map +1 -1
  13. package/lib/commonjs/components/claimsSelector/ClaimsSelector.js +119 -0
  14. package/lib/commonjs/components/claimsSelector/ClaimsSelector.js.map +1 -0
  15. package/lib/commonjs/components/claimsSelector/__test__/ClaimsSelector.test.js +46 -0
  16. package/lib/commonjs/components/claimsSelector/__test__/ClaimsSelector.test.js.map +1 -0
  17. package/lib/commonjs/components/claimsSelector/__test__/__snapshots__/ClaimsSelector.test.tsx.snap +1270 -0
  18. package/lib/commonjs/components/claimsSelector/index.js +17 -0
  19. package/lib/commonjs/components/claimsSelector/index.js.map +1 -0
  20. package/lib/commonjs/components/index.js +11 -0
  21. package/lib/commonjs/components/index.js.map +1 -1
  22. package/lib/commonjs/components/listitems/ListItemCheckbox.js +1 -1
  23. package/lib/commonjs/components/listitems/ListItemCheckbox.js.map +1 -1
  24. package/lib/commonjs/components/listitems/ListItemInfo.js +6 -2
  25. package/lib/commonjs/components/listitems/ListItemInfo.js.map +1 -1
  26. package/lib/commonjs/components/listitems/ListItemRadio.js +1 -1
  27. package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -1
  28. package/lib/commonjs/components/listitems/ListItemSwitch.js +1 -1
  29. package/lib/commonjs/components/listitems/ListItemSwitch.js.map +1 -1
  30. package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +10 -0
  31. package/lib/commonjs/components/radio/AnimatedRadio.js +8 -5
  32. package/lib/commonjs/components/radio/AnimatedRadio.js.map +1 -1
  33. package/lib/commonjs/components/switch/NativeSwitch.js +5 -5
  34. package/lib/commonjs/components/switch/NativeSwitch.js.map +1 -1
  35. package/lib/commonjs/components/switch/index.js +0 -22
  36. package/lib/commonjs/components/switch/index.js.map +1 -1
  37. package/lib/commonjs/components/textInput/TextInputValidation.js +19 -7
  38. package/lib/commonjs/components/textInput/TextInputValidation.js.map +1 -1
  39. package/lib/commonjs/components/typography/markdown/MdH1.js +1 -2
  40. package/lib/commonjs/components/typography/markdown/MdH1.js.map +1 -1
  41. package/lib/commonjs/components/typography/markdown/MdH2.js +2 -2
  42. package/lib/commonjs/components/typography/markdown/MdH2.js.map +1 -1
  43. package/lib/commonjs/components/typography/markdown/MdH3.js +2 -2
  44. package/lib/commonjs/components/typography/markdown/MdH3.js.map +1 -1
  45. package/lib/commonjs/core/IOColors.js +28 -6
  46. package/lib/commonjs/core/IOColors.js.map +1 -1
  47. package/lib/commonjs/core/IOStyles.js +2 -16
  48. package/lib/commonjs/core/IOStyles.js.map +1 -1
  49. package/lib/commonjs/hooks/useAccordionAnimation.js +83 -0
  50. package/lib/commonjs/hooks/useAccordionAnimation.js.map +1 -0
  51. package/lib/module/components/accordion/AccordionItem.js +19 -52
  52. package/lib/module/components/accordion/AccordionItem.js.map +1 -1
  53. package/lib/module/components/banner/Banner.js +3 -2
  54. package/lib/module/components/banner/Banner.js.map +1 -1
  55. package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +56 -0
  56. package/lib/module/components/buttons/ButtonLink.js +1 -1
  57. package/lib/module/components/buttons/ButtonSolid.js +1 -1
  58. package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
  59. package/lib/module/components/checkbox/AnimatedCheckbox.js +9 -6
  60. package/lib/module/components/checkbox/AnimatedCheckbox.js.map +1 -1
  61. package/lib/module/components/checkbox/AnimatedMessageCheckbox.js +6 -4
  62. package/lib/module/components/checkbox/AnimatedMessageCheckbox.js.map +1 -1
  63. package/lib/module/components/claimsSelector/ClaimsSelector.js +109 -0
  64. package/lib/module/components/claimsSelector/ClaimsSelector.js.map +1 -0
  65. package/lib/module/components/claimsSelector/__test__/ClaimsSelector.test.js +41 -0
  66. package/lib/module/components/claimsSelector/__test__/ClaimsSelector.test.js.map +1 -0
  67. package/lib/module/components/claimsSelector/__test__/__snapshots__/ClaimsSelector.test.tsx.snap +1270 -0
  68. package/lib/module/components/claimsSelector/index.js +2 -0
  69. package/lib/module/components/claimsSelector/index.js.map +1 -0
  70. package/lib/module/components/index.js +1 -0
  71. package/lib/module/components/index.js.map +1 -1
  72. package/lib/module/components/listitems/ListItemCheckbox.js +1 -1
  73. package/lib/module/components/listitems/ListItemCheckbox.js.map +1 -1
  74. package/lib/module/components/listitems/ListItemInfo.js +6 -2
  75. package/lib/module/components/listitems/ListItemInfo.js.map +1 -1
  76. package/lib/module/components/listitems/ListItemRadio.js +1 -1
  77. package/lib/module/components/listitems/ListItemRadio.js.map +1 -1
  78. package/lib/module/components/listitems/ListItemSwitch.js +1 -1
  79. package/lib/module/components/listitems/ListItemSwitch.js.map +1 -1
  80. package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +10 -0
  81. package/lib/module/components/radio/AnimatedRadio.js +9 -6
  82. package/lib/module/components/radio/AnimatedRadio.js.map +1 -1
  83. package/lib/module/components/switch/NativeSwitch.js +6 -6
  84. package/lib/module/components/switch/NativeSwitch.js.map +1 -1
  85. package/lib/module/components/switch/index.js +0 -2
  86. package/lib/module/components/switch/index.js.map +1 -1
  87. package/lib/module/components/textInput/TextInputValidation.js +20 -8
  88. package/lib/module/components/textInput/TextInputValidation.js.map +1 -1
  89. package/lib/module/components/typography/markdown/MdH1.js +1 -2
  90. package/lib/module/components/typography/markdown/MdH1.js.map +1 -1
  91. package/lib/module/components/typography/markdown/MdH2.js +2 -2
  92. package/lib/module/components/typography/markdown/MdH2.js.map +1 -1
  93. package/lib/module/components/typography/markdown/MdH3.js +2 -2
  94. package/lib/module/components/typography/markdown/MdH3.js.map +1 -1
  95. package/lib/module/core/IOColors.js +28 -6
  96. package/lib/module/core/IOColors.js.map +1 -1
  97. package/lib/module/core/IOStyles.js +1 -14
  98. package/lib/module/core/IOStyles.js.map +1 -1
  99. package/lib/module/hooks/useAccordionAnimation.js +76 -0
  100. package/lib/module/hooks/useAccordionAnimation.js.map +1 -0
  101. package/lib/typescript/components/accordion/AccordionItem.d.ts +0 -6
  102. package/lib/typescript/components/accordion/AccordionItem.d.ts.map +1 -1
  103. package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
  104. package/lib/typescript/components/checkbox/AnimatedCheckbox.d.ts.map +1 -1
  105. package/lib/typescript/components/checkbox/AnimatedMessageCheckbox.d.ts.map +1 -1
  106. package/lib/typescript/components/claimsSelector/ClaimsSelector.d.ts +42 -0
  107. package/lib/typescript/components/claimsSelector/ClaimsSelector.d.ts.map +1 -0
  108. package/lib/typescript/components/claimsSelector/__test__/ClaimsSelector.test.d.ts +2 -0
  109. package/lib/typescript/components/claimsSelector/__test__/ClaimsSelector.test.d.ts.map +1 -0
  110. package/lib/typescript/components/claimsSelector/index.d.ts +2 -0
  111. package/lib/typescript/components/claimsSelector/index.d.ts.map +1 -0
  112. package/lib/typescript/components/index.d.ts +1 -0
  113. package/lib/typescript/components/index.d.ts.map +1 -1
  114. package/lib/typescript/components/listitems/ListItemInfo.d.ts +2 -1
  115. package/lib/typescript/components/listitems/ListItemInfo.d.ts.map +1 -1
  116. package/lib/typescript/components/switch/NativeSwitch.d.ts.map +1 -1
  117. package/lib/typescript/components/switch/index.d.ts +0 -2
  118. package/lib/typescript/components/switch/index.d.ts.map +1 -1
  119. package/lib/typescript/components/textInput/TextInputValidation.d.ts +31 -4
  120. package/lib/typescript/components/textInput/TextInputValidation.d.ts.map +1 -1
  121. package/lib/typescript/components/typography/BodyMonospace.d.ts +1 -1
  122. package/lib/typescript/components/typography/ButtonText.d.ts +1 -1
  123. package/lib/typescript/components/typography/Caption.d.ts +1 -1
  124. package/lib/typescript/components/typography/H1.d.ts +1 -1
  125. package/lib/typescript/components/typography/H2.d.ts +1 -1
  126. package/lib/typescript/components/typography/H3.d.ts +1 -1
  127. package/lib/typescript/components/typography/H4.d.ts +1 -1
  128. package/lib/typescript/components/typography/H5.d.ts +1 -1
  129. package/lib/typescript/components/typography/H6.d.ts +1 -1
  130. package/lib/typescript/components/typography/Hero.d.ts +1 -1
  131. package/lib/typescript/components/typography/markdown/MdH1.d.ts +1 -1
  132. package/lib/typescript/components/typography/markdown/MdH1.d.ts.map +1 -1
  133. package/lib/typescript/components/typography/markdown/MdH2.d.ts +1 -1
  134. package/lib/typescript/components/typography/markdown/MdH3.d.ts +1 -1
  135. package/lib/typescript/core/IOColors.d.ts +4 -1
  136. package/lib/typescript/core/IOColors.d.ts.map +1 -1
  137. package/lib/typescript/core/IOStyles.d.ts +0 -13
  138. package/lib/typescript/core/IOStyles.d.ts.map +1 -1
  139. package/lib/typescript/hooks/useAccordionAnimation.d.ts +41 -0
  140. package/lib/typescript/hooks/useAccordionAnimation.d.ts.map +1 -0
  141. package/package.json +1 -1
  142. package/src/components/accordion/AccordionItem.tsx +21 -82
  143. package/src/components/banner/Banner.tsx +3 -2
  144. package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +56 -0
  145. package/src/components/buttons/ButtonLink.tsx +1 -1
  146. package/src/components/buttons/ButtonSolid.tsx +1 -1
  147. package/src/components/checkbox/AnimatedCheckbox.tsx +9 -10
  148. package/src/components/checkbox/AnimatedMessageCheckbox.tsx +5 -5
  149. package/src/components/claimsSelector/ClaimsSelector.tsx +185 -0
  150. package/src/components/claimsSelector/__test__/ClaimsSelector.test.tsx +55 -0
  151. package/src/components/claimsSelector/__test__/__snapshots__/ClaimsSelector.test.tsx.snap +1270 -0
  152. package/src/components/claimsSelector/index.tsx +1 -0
  153. package/src/components/index.tsx +1 -0
  154. package/src/components/listitems/ListItemCheckbox.tsx +1 -1
  155. package/src/components/listitems/ListItemInfo.tsx +7 -2
  156. package/src/components/listitems/ListItemRadio.tsx +1 -1
  157. package/src/components/listitems/ListItemSwitch.tsx +1 -1
  158. package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +10 -0
  159. package/src/components/radio/AnimatedRadio.tsx +10 -10
  160. package/src/components/switch/NativeSwitch.tsx +6 -6
  161. package/src/components/switch/index.tsx +0 -2
  162. package/src/components/textInput/TextInputValidation.tsx +140 -97
  163. package/src/components/typography/markdown/MdH1.tsx +1 -2
  164. package/src/components/typography/markdown/MdH2.tsx +2 -2
  165. package/src/components/typography/markdown/MdH3.tsx +2 -2
  166. package/src/core/IOColors.ts +33 -5
  167. package/src/core/IOStyles.ts +1 -28
  168. package/src/hooks/useAccordionAnimation.tsx +106 -0
  169. package/lib/commonjs/components/switch/AnimatedSwitch.js +0 -94
  170. package/lib/commonjs/components/switch/AnimatedSwitch.js.map +0 -1
  171. package/lib/commonjs/components/switch/SwitchLabel.js +0 -76
  172. package/lib/commonjs/components/switch/SwitchLabel.js.map +0 -1
  173. package/lib/module/components/switch/AnimatedSwitch.js +0 -85
  174. package/lib/module/components/switch/AnimatedSwitch.js.map +0 -1
  175. package/lib/module/components/switch/SwitchLabel.js +0 -68
  176. package/lib/module/components/switch/SwitchLabel.js.map +0 -1
  177. package/lib/typescript/components/switch/AnimatedSwitch.d.ts +0 -13
  178. package/lib/typescript/components/switch/AnimatedSwitch.d.ts.map +0 -1
  179. package/lib/typescript/components/switch/SwitchLabel.d.ts +0 -18
  180. package/lib/typescript/components/switch/SwitchLabel.d.ts.map +0 -1
  181. package/src/components/switch/AnimatedSwitch.tsx +0 -126
  182. package/src/components/switch/SwitchLabel.tsx +0 -80
@@ -0,0 +1 @@
1
+ export * from "./ClaimsSelector";
@@ -5,6 +5,7 @@ export * from "./badge";
5
5
  export * from "./banner";
6
6
  export * from "./buttons";
7
7
  export * from "./checkbox";
8
+ export * from "./claimsSelector";
8
9
  export * from "./codeInput";
9
10
  export * from "./contentWrapper";
10
11
  export * from "./divider";
@@ -119,7 +119,7 @@ export const ListItemCheckbox = ({
119
119
  <Icon
120
120
  allowFontScaling
121
121
  name={icon}
122
- color="grey-300"
122
+ color={theme["icon-decorative"]}
123
123
  size={IOSelectionListItemVisualParams.iconSize}
124
124
  />
125
125
  )}
@@ -60,6 +60,7 @@ export type ListItemInfo = WithTestID<{
60
60
  // Accessibility
61
61
  accessibilityLabel?: string;
62
62
  accessibilityRole?: AccessibilityRole;
63
+ reversed?: boolean;
63
64
  }> &
64
65
  GraphicProps &
65
66
  InteractiveProps;
@@ -70,6 +71,7 @@ export const ListItemInfo = ({
70
71
  label,
71
72
  value,
72
73
  numberOfLines = 2,
74
+ reversed = false,
73
75
  icon,
74
76
  paymentLogoIcon,
75
77
  endElement,
@@ -99,7 +101,10 @@ export const ListItemInfo = ({
99
101
 
100
102
  const itemInfoTextComponent = useMemo(
101
103
  () => (
102
- <View accessible={Platform.OS === "ios"}>
104
+ <View
105
+ accessible={Platform.OS === "ios"}
106
+ style={{ flexDirection: reversed ? "column-reverse" : "column" }}
107
+ >
103
108
  <BodySmall weight="Regular" color={theme["textBody-tertiary"]}>
104
109
  {label}
105
110
  </BodySmall>
@@ -112,7 +117,7 @@ export const ListItemInfo = ({
112
117
  )}
113
118
  </View>
114
119
  ),
115
- [label, value, numberOfLines, theme]
120
+ [label, value, numberOfLines, theme, reversed]
116
121
  );
117
122
 
118
123
  const listItemInfoAction = useCallback(() => {
@@ -198,7 +198,7 @@ export const ListItemRadio = ({
198
198
  <Icon
199
199
  allowFontScaling
200
200
  name={startImage.icon}
201
- color="grey-300"
201
+ color={theme["icon-decorative"]}
202
202
  size={IOSelectionListItemVisualParams.iconSize}
203
203
  />
204
204
  )}
@@ -115,7 +115,7 @@ export const ListItemSwitch = React.memo(
115
115
  <Icon
116
116
  allowFontScaling
117
117
  name={icon}
118
- color="grey-300"
118
+ color={theme["icon-decorative"]}
119
119
  size={IOSelectionListItemVisualParams.iconSize}
120
120
  />
121
121
  )}
@@ -239,6 +239,11 @@ exports[`Test List Item Components - Experimental Enabled ListItemInfo Snapshot
239
239
  >
240
240
  <View
241
241
  accessible={true}
242
+ style={
243
+ {
244
+ "flexDirection": "column",
245
+ }
246
+ }
242
247
  >
243
248
  <Text
244
249
  allowFontScaling={true}
@@ -1909,6 +1914,11 @@ exports[`Test List Item Components ListItemInfo Snapshot 1`] = `
1909
1914
  >
1910
1915
  <View
1911
1916
  accessible={true}
1917
+ style={
1918
+ {
1919
+ "flexDirection": "column",
1920
+ }
1921
+ }
1912
1922
  >
1913
1923
  <Text
1914
1924
  allowFontScaling={true}
@@ -14,7 +14,7 @@ import Animated, {
14
14
  withSpring,
15
15
  withTiming
16
16
  } from "react-native-reanimated";
17
- import { useIOExperimentalDesign } from "../../core";
17
+ import { useIOExperimentalDesign, useIOTheme } from "../../core";
18
18
  import { IOSpringValues } from "../../core/IOAnimations";
19
19
  import { IOColors } from "../../core/IOColors";
20
20
  import {
@@ -54,11 +54,12 @@ export const AnimatedRadio = ({
54
54
  onPress,
55
55
  disabled
56
56
  }: OwnProps) => {
57
+ const theme = useIOTheme();
57
58
  const isChecked = checked ?? false;
58
59
 
59
60
  const { isExperimental } = useIOExperimentalDesign();
60
- const borderColorOffState =
61
- IOColors[IOSelectionTickVisualParams.borderColorOffState];
61
+ const borderColorOffState = IOColors[theme["selection-border-off"]];
62
+
62
63
  // TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
63
64
  const legacyBorderColorOffState =
64
65
  IOColors[IOSelectionTickLegacyVisualParams.borderColorOffState];
@@ -66,12 +67,13 @@ export const AnimatedRadio = ({
66
67
  ? borderColorOffState
67
68
  : legacyBorderColorOffState;
68
69
 
69
- const backgroundColorOnState =
70
- IOColors[IOSelectionTickVisualParams.bgColorOnState];
70
+ const backgroundColorOnState = IOColors[theme["selection-background-on"]];
71
+
71
72
  // TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
72
73
  const legacyBackgroundColorOnState =
73
74
  IOColors[IOSelectionTickLegacyVisualParams.bgColorOnState];
74
- const backgroundColorProp = isExperimental
75
+
76
+ const backgroundColor = isExperimental
75
77
  ? backgroundColorOnState
76
78
  : legacyBackgroundColorOnState;
77
79
 
@@ -133,9 +135,7 @@ export const AnimatedRadio = ({
133
135
  style={[
134
136
  styles.radioCircle,
135
137
  radioButtonSizeStyle,
136
- {
137
- backgroundColor: backgroundColorProp
138
- },
138
+ { backgroundColor },
139
139
  animatedCheckboxSquare
140
140
  ]}
141
141
  />
@@ -144,7 +144,7 @@ export const AnimatedRadio = ({
144
144
  <AnimatedTick
145
145
  size={size}
146
146
  progress={tickAnimationProgress}
147
- stroke={IOColors[IOSelectionTickVisualParams.tickColor]}
147
+ stroke={IOColors[theme["selection-tick"]]}
148
148
  />
149
149
  </View>
150
150
  )}
@@ -1,8 +1,7 @@
1
1
  import React from "react";
2
2
  import { Platform, Switch, SwitchProps } from "react-native";
3
- import { useIOExperimentalDesign } from "../../core";
3
+ import { useIOExperimentalDesign, useIOTheme } from "../../core";
4
4
  import { IOColors } from "../../core/IOColors";
5
- import { IOSwitchVisualParams } from "../../core/IOStyles";
6
5
 
7
6
  type OwnProps = Pick<
8
7
  SwitchProps,
@@ -25,10 +24,11 @@ export const NativeSwitch = ({
25
24
  value,
26
25
  ...accessibility
27
26
  }: OwnProps) => {
27
+ const theme = useIOTheme();
28
28
  const { isExperimental } = useIOExperimentalDesign();
29
29
  const trackColor = {
30
- false: IOColors[IOSwitchVisualParams.bgColorOffState],
31
- true: IOColors[IOSwitchVisualParams.bgColorOnState]
30
+ false: IOColors[theme["switch-background-off"]],
31
+ true: IOColors[theme["switch-background-on"]]
32
32
  };
33
33
 
34
34
  // TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
@@ -45,10 +45,10 @@ export const NativeSwitch = ({
45
45
  accessibilityRole="switch"
46
46
  accessibilityState={{ checked: value, disabled: accessibility.disabled }}
47
47
  trackColor={trackColorComponent}
48
- thumbColor={IOColors[IOSwitchVisualParams.bgCircle]}
48
+ thumbColor={IOColors[theme["switch-thumb-color"]]}
49
49
  ios_backgroundColor={
50
50
  isExperimental
51
- ? IOColors[IOSwitchVisualParams.bgColorOffState]
51
+ ? IOColors[theme["switch-background-off"]]
52
52
  : bgLegacyTrackColorAndroid
53
53
  }
54
54
  onValueChange={onValueChange}
@@ -1,3 +1 @@
1
- export * from "./SwitchLabel";
2
- export * from "./AnimatedSwitch";
3
1
  export * from "./NativeSwitch";
@@ -1,5 +1,11 @@
1
1
  import * as React from "react";
2
- import { useCallback, useMemo, useState } from "react";
2
+ import {
3
+ useCallback,
4
+ useMemo,
5
+ useState,
6
+ forwardRef,
7
+ useImperativeHandle
8
+ } from "react";
3
9
  import { AccessibilityInfo, View } from "react-native";
4
10
  import Animated from "react-native-reanimated";
5
11
  import { useIOTheme } from "../../core";
@@ -28,6 +34,14 @@ type TextInputValidationProps = Omit<
28
34
  * In case of a dynamic `errorMessage`, use the `onValidate` function with a `ValidationWithOptions` object as the return value to ensure that screen readers announce the correct value.
29
35
  */
30
36
  errorMessage: string;
37
+ /**
38
+ * Determines the validation mode. If "onBlur", validation occurs on blur. If "onContinue", validation occurs when an external button is pressed.
39
+ */
40
+ validationMode?: "onBlur" | "onContinue";
41
+ /**
42
+ * A string that will be read by screen readers when the field is not valid.
43
+ */
44
+ accessibilityErrorLabel?: string;
31
45
  };
32
46
 
33
47
  function isValidationWithOptions(
@@ -42,107 +56,136 @@ function isValidationWithOptions(
42
56
 
43
57
  const feedbackIconSize: IOIconSizeScale = 24;
44
58
 
45
- export const TextInputValidation = ({
46
- onValidate,
47
- errorMessage,
48
- value,
49
- bottomMessage,
50
- onBlur,
51
- onFocus,
52
- ...props
53
- }: TextInputValidationProps) => {
54
- const theme = useIOTheme();
55
- const [isValid, setIsValid] = useState<boolean | undefined>(undefined);
56
- const [errMessage, setErrMessage] = useState(errorMessage);
57
-
58
- const getErrorFeedback = useCallback((isValid: boolean, message: string) => {
59
- setIsValid(isValid);
60
- setErrMessage(message);
61
-
62
- if (!isValid) {
63
- triggerHaptic("notificationError");
64
- AccessibilityInfo.announceForAccessibilityWithOptions(message, {
65
- queue: true
66
- });
67
- } else {
68
- triggerHaptic("notificationSuccess");
69
- }
70
- }, []);
71
-
72
- const onBlurHandler = useCallback(() => {
73
- const validation = onValidate(value);
74
-
75
- if (isValidationWithOptions(validation)) {
76
- getErrorFeedback(validation.isValid, validation.errorMessage);
77
- } else {
78
- getErrorFeedback(validation, errorMessage);
79
- }
80
- onBlur?.();
81
- }, [value, errorMessage, onBlur, onValidate, getErrorFeedback]);
82
-
83
- const onFocusHandler = useCallback(() => {
84
- setIsValid(undefined);
85
- onFocus?.();
86
- }, [onFocus]);
87
-
88
- const labelError = useMemo(
89
- () => (isValid === false && errMessage ? errMessage : bottomMessage),
90
- [isValid, errMessage, bottomMessage]
91
- );
59
+ export const TextInputValidation = forwardRef<
60
+ {
61
+ validateInput: () => void;
62
+ },
63
+ TextInputValidationProps
64
+ >(
65
+ (
66
+ {
67
+ onValidate,
68
+ errorMessage,
69
+ value,
70
+ bottomMessage,
71
+ onBlur,
72
+ onFocus,
73
+ validationMode = "onBlur",
74
+ accessibilityErrorLabel,
75
+ ...props
76
+ },
77
+ ref
78
+ ) => {
79
+ const theme = useIOTheme();
80
+ const [isValid, setIsValid] = useState<boolean | undefined>(undefined);
81
+ const [errMessage, setErrMessage] = useState(errorMessage);
82
+
83
+ const getErrorFeedback = useCallback(
84
+ (isValid: boolean, message: string) => {
85
+ setIsValid(isValid);
86
+ setErrMessage(message);
87
+
88
+ if (!isValid) {
89
+ triggerHaptic("notificationError");
90
+ AccessibilityInfo.announceForAccessibilityWithOptions(
91
+ accessibilityErrorLabel ?? message,
92
+ {
93
+ queue: true
94
+ }
95
+ );
96
+ } else {
97
+ triggerHaptic("notificationSuccess");
98
+ }
99
+ },
100
+ [accessibilityErrorLabel]
101
+ );
92
102
 
93
- const labelErrorColor: IOColors | undefined = useMemo(
94
- () => (isValid === false && errMessage ? theme.errorText : undefined),
95
- [isValid, errMessage, theme.errorText]
96
- );
103
+ const validateInput = useCallback(() => {
104
+ const validation = onValidate(value);
97
105
 
98
- const feedbackIconAttrMap: Record<
99
- string,
100
- { name: IOIcons; color: IOColors }
101
- > = useMemo(
102
- () => ({
103
- valid: {
104
- name: "success",
105
- color: theme.successIcon
106
- },
107
- notValid: {
108
- name: "errorFilled",
109
- color: theme.errorIcon
106
+ if (isValidationWithOptions(validation)) {
107
+ getErrorFeedback(validation.isValid, validation.errorMessage);
108
+ } else {
109
+ getErrorFeedback(validation, errorMessage);
110
110
  }
111
- }),
112
- [theme]
113
- );
111
+ }, [value, errorMessage, onValidate, getErrorFeedback]);
112
+
113
+ // Expose the validateInput function to the parent component
114
+ useImperativeHandle(ref, () => ({
115
+ validateInput
116
+ }));
114
117
 
115
- const feedbackIcon = useMemo(() => {
116
- const validationStatus = isValid ? "valid" : "notValid";
117
-
118
- return isValid !== undefined ? (
119
- <Animated.View
120
- entering={enterTransitionInputIcon}
121
- exiting={exitTransitionInputIcon}
122
- >
123
- <Icon
124
- name={feedbackIconAttrMap[validationStatus].name}
125
- color={feedbackIconAttrMap[validationStatus].color}
126
- size={feedbackIconSize}
127
- />
128
- </Animated.View>
129
- ) : (
130
- <View style={{ width: feedbackIconSize, height: feedbackIconSize }} />
118
+ const onBlurHandler = useCallback(() => {
119
+ if (validationMode === "onBlur") {
120
+ validateInput();
121
+ }
122
+ onBlur?.();
123
+ }, [validationMode, validateInput, onBlur]);
124
+
125
+ const onFocusHandler = useCallback(() => {
126
+ setIsValid(undefined);
127
+ onFocus?.();
128
+ }, [onFocus]);
129
+
130
+ const labelError = useMemo(
131
+ () => (isValid === false && errMessage ? errMessage : bottomMessage),
132
+ [isValid, errMessage, bottomMessage]
131
133
  );
132
- }, [feedbackIconAttrMap, isValid]);
133
134
 
134
- return (
135
- <TextInputBase
136
- {...props}
137
- value={value}
138
- status={isValid === false ? "error" : undefined}
139
- bottomMessage={labelError}
140
- bottomMessageColor={labelErrorColor}
141
- rightElement={feedbackIcon}
142
- onBlur={onBlurHandler}
143
- onFocus={onFocusHandler}
144
- />
145
- );
146
- };
135
+ const labelErrorColor: IOColors | undefined = useMemo(
136
+ () => (isValid === false && errMessage ? theme.errorText : undefined),
137
+ [isValid, errMessage, theme.errorText]
138
+ );
139
+
140
+ const feedbackIconAttrMap: Record<
141
+ string,
142
+ { name: IOIcons; color: IOColors }
143
+ > = useMemo(
144
+ () => ({
145
+ valid: {
146
+ name: "success",
147
+ color: theme.successIcon
148
+ },
149
+ notValid: {
150
+ name: "errorFilled",
151
+ color: theme.errorIcon
152
+ }
153
+ }),
154
+ [theme]
155
+ );
156
+
157
+ const feedbackIcon = useMemo(() => {
158
+ const validationStatus = isValid ? "valid" : "notValid";
159
+
160
+ return isValid !== undefined ? (
161
+ <Animated.View
162
+ entering={enterTransitionInputIcon}
163
+ exiting={exitTransitionInputIcon}
164
+ >
165
+ <Icon
166
+ name={feedbackIconAttrMap[validationStatus].name}
167
+ color={feedbackIconAttrMap[validationStatus].color}
168
+ size={feedbackIconSize}
169
+ />
170
+ </Animated.View>
171
+ ) : (
172
+ <View style={{ width: feedbackIconSize, height: feedbackIconSize }} />
173
+ );
174
+ }, [feedbackIconAttrMap, isValid]);
175
+
176
+ return (
177
+ <TextInputBase
178
+ {...props}
179
+ value={value}
180
+ status={isValid === false ? "error" : undefined}
181
+ bottomMessage={labelError}
182
+ bottomMessageColor={labelErrorColor}
183
+ rightElement={feedbackIcon}
184
+ onBlur={onBlurHandler}
185
+ onFocus={onFocusHandler}
186
+ />
187
+ );
188
+ }
189
+ );
147
190
 
148
191
  export default TextInputValidation;
@@ -6,7 +6,6 @@ import { IOText, IOTextProps, TypographicStyleProps } from "../IOText";
6
6
  /**
7
7
  * `MdH1` typographic style
8
8
  */
9
-
10
9
  export const MdH1 = forwardRef<View, TypographicStyleProps>(
11
10
  ({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
12
11
  const theme = useIOTheme();
@@ -18,7 +17,7 @@ export const MdH1 = forwardRef<View, TypographicStyleProps>(
18
17
  weight: "Semibold",
19
18
  size: 20,
20
19
  lineHeight: 24,
21
- color: customColor ?? theme["textHeading-tertiary"]
20
+ color: customColor ?? theme["textHeading-default"]
22
21
  };
23
22
 
24
23
  return (
@@ -15,9 +15,9 @@ export const MdH2 = forwardRef<View, TypographicStyleProps>(
15
15
  ...props,
16
16
  font: isExperimental ? "Titillio" : "TitilliumSansPro",
17
17
  weight: "Semibold",
18
- size: 16,
18
+ size: 18,
19
19
  lineHeight: 24,
20
- color: customColor ?? theme["textHeading-tertiary"]
20
+ color: customColor ?? theme["textHeading-default"]
21
21
  };
22
22
 
23
23
  return (
@@ -14,10 +14,10 @@ export const MdH3 = forwardRef<View, TypographicStyleProps>(
14
14
  const MdH3Props: IOTextProps = {
15
15
  ...props,
16
16
  font: isExperimental ? "Titillio" : "TitilliumSansPro",
17
- weight: "Regular",
17
+ weight: "Semibold",
18
18
  size: 16,
19
19
  lineHeight: 24,
20
- color: customColor ?? theme["textHeading-tertiary"]
20
+ color: customColor ?? theme["textHeading-default"]
21
21
  };
22
22
 
23
23
  return (
@@ -40,6 +40,7 @@ export const IOColors = asIOColors({
40
40
  "blueIO-600": "#0932B6",
41
41
  "blueIO-500": "#0B3EE3",
42
42
  "blueIO-400": "#3C65E9",
43
+ "blueIO-300": "#6D8BEE",
43
44
  "blueIO-200": "#9DB2F4",
44
45
  "blueIO-150": "#B6C5F7",
45
46
  "blueIO-100": "#CED8F9",
@@ -152,6 +153,8 @@ export const IOColorsTints = asIOColors({
152
153
  "blueIO-850": IOColors["blueIO-850"],
153
154
  "blueIO-600": IOColors["blueIO-600"],
154
155
  "blueIO-500": IOColors["blueIO-500"],
156
+ "blueIO-400": IOColors["blueIO-400"],
157
+ "blueIO-300": IOColors["blueIO-300"],
155
158
  "blueIO-200": IOColors["blueIO-200"],
156
159
  "blueIO-150": IOColors["blueIO-150"],
157
160
  "blueIO-100": IOColors["blueIO-100"],
@@ -227,6 +230,7 @@ const themeKeys = [
227
230
  "neutralButton-pressed",
228
231
  "neutralButton-disabled",
229
232
  "buttonText-default",
233
+ "buttonText-danger",
230
234
  "buttonText-disabled",
231
235
  "listItem-pressed",
232
236
  // Typography
@@ -246,6 +250,13 @@ const themeKeys = [
246
250
  "textInputLabel-default",
247
251
  "textInputValue-default",
248
252
  "textInputValue-disabled",
253
+ // Selection (Radio, Checkbox, Switch)
254
+ "switch-background-off",
255
+ "switch-background-on",
256
+ "switch-thumb-color",
257
+ "selection-border-off",
258
+ "selection-background-on",
259
+ "selection-tick",
249
260
  // Layout
250
261
  "divider-header",
251
262
  "divider-default",
@@ -289,6 +300,7 @@ export const IOThemeLight: IOTheme = {
289
300
  "neutralButton-pressed": "grey-850",
290
301
  "neutralButton-disabled": "grey-450",
291
302
  "buttonText-default": "white",
303
+ "buttonText-danger": "white",
292
304
  "buttonText-disabled": "grey-700",
293
305
  "listItem-pressed": "grey-50",
294
306
  // Typography
@@ -307,6 +319,13 @@ export const IOThemeLight: IOTheme = {
307
319
  "textInputLabel-default": "grey-700",
308
320
  "textInputValue-default": "black",
309
321
  "textInputValue-disabled": "grey-850",
322
+ // Selection (Radio, Checkbox, Switch)
323
+ "switch-background-off": "grey-700",
324
+ "switch-background-on": "blueIO-500",
325
+ "switch-thumb-color": "white",
326
+ "selection-border-off": "grey-650",
327
+ "selection-background-on": "blueIO-500",
328
+ "selection-tick": "white",
310
329
  // Layout
311
330
  "divider-header": "grey-100",
312
331
  "divider-default": "grey-200",
@@ -335,7 +354,8 @@ export const IOThemeLightLegacy: IOTheme = {
335
354
  ...IOThemeLight,
336
355
  "appBackground-accent": "blue-500",
337
356
  "interactiveElem-default": "blue-500",
338
- "pictogram-hands": "blue-500"
357
+ "pictogram-hands": "blue-500",
358
+ "selection-tick": "white"
339
359
  };
340
360
 
341
361
  export const IOThemeDark: IOTheme = {
@@ -344,14 +364,15 @@ export const IOThemeDark: IOTheme = {
344
364
  "appBackground-primary": "black",
345
365
  "appBackground-secondary": "grey-850",
346
366
  "appBackground-tertiary": "grey-700",
347
- "interactiveElem-default": "blueIO-400",
348
- "interactiveElem-pressed": "blueIO-500",
367
+ "interactiveElem-default": "blueIO-300",
368
+ "interactiveElem-pressed": "blueIO-400",
349
369
  "interactiveElem-disabled": "grey-700",
350
370
  "interactiveOutline-disabled": "grey-450",
351
371
  "neutralButton-default": "white",
352
372
  "neutralButton-pressed": "grey-100",
353
373
  "neutralButton-disabled": "grey-850",
354
- "buttonText-default": "white",
374
+ "buttonText-default": "black",
375
+ "buttonText-danger": "white",
355
376
  "buttonText-disabled": "grey-300",
356
377
  "listItem-pressed": "grey-850",
357
378
  // Typography
@@ -360,7 +381,7 @@ export const IOThemeDark: IOTheme = {
360
381
  "textHeading-tertiary": "grey-450",
361
382
  "textBody-default": "white",
362
383
  "textBody-secondary": "grey-100",
363
- "textBody-tertiary": "grey-450",
384
+ "textBody-tertiary": "grey-300",
364
385
  // Design System related
365
386
  "cardBorder-default": "grey-850",
366
387
  "icon-default": "grey-450",
@@ -370,6 +391,13 @@ export const IOThemeDark: IOTheme = {
370
391
  "textInputLabel-default": "grey-450",
371
392
  "textInputValue-default": "white",
372
393
  "textInputValue-disabled": "grey-100",
394
+ // Selection (Radio, Checkbox, Switch)
395
+ "switch-background-off": "grey-850",
396
+ "switch-background-on": "blueIO-300",
397
+ "switch-thumb-color": "white",
398
+ "selection-border-off": "grey-450",
399
+ "selection-background-on": "blueIO-300",
400
+ "selection-tick": "black",
373
401
  // Tab Item
374
402
  "tab-item-border-default": "grey-700",
375
403
  "tab-item-foreground-default": "grey-200",
@@ -311,19 +311,6 @@ export const IOModuleStyles = StyleSheet.create({
311
311
  interface IOSelectionTickVisualParams {
312
312
  size: IOIconSizeScale;
313
313
  borderWidth: number;
314
- borderColorOffState: IOColors;
315
- bgColorOnState: IOColors;
316
- tickColor: IOColors;
317
- }
318
-
319
- interface IOSwitchVisualParams {
320
- width: number;
321
- height: number;
322
- bgColorOffState: IOColors;
323
- bgColorOnState: IOColors;
324
- tickColor: IOColors;
325
- bgCircle: IOColors;
326
- padding: number;
327
314
  }
328
315
 
329
316
  interface IOSelectionTickLegacyVisualParams {
@@ -333,21 +320,7 @@ interface IOSelectionTickLegacyVisualParams {
333
320
 
334
321
  export const IOSelectionTickVisualParams: IOSelectionTickVisualParams = {
335
322
  size: 24,
336
- borderWidth: 2,
337
- borderColorOffState: "grey-650",
338
- bgColorOnState: "blueIO-500",
339
- tickColor: "white"
340
- };
341
-
342
- export const IOSwitchVisualParams: IOSwitchVisualParams = {
343
- width: 40,
344
- height: 28,
345
- bgColorOffState: "grey-700",
346
- bgColorOnState: "blueIO-500",
347
- tickColor: "blueIO-500",
348
- bgCircle: "white",
349
- // Space between the circle and the main shape
350
- padding: 2
323
+ borderWidth: 2
351
324
  };
352
325
 
353
326
  export const IOSelectionTickLegacyVisualParams: IOSelectionTickLegacyVisualParams =