@pagopa/io-app-design-system 1.29.0 → 1.31.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 (113) hide show
  1. package/lib/commonjs/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +24 -12
  2. package/lib/commonjs/components/avatar/Avatar.js +2 -0
  3. package/lib/commonjs/components/avatar/Avatar.js.map +1 -1
  4. package/lib/commonjs/components/avatar/__test__/__snapshots__/avatar.test.tsx.snap +4 -0
  5. package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +92 -18
  6. package/lib/commonjs/components/buttons/ButtonSolid.js +4 -2
  7. package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
  8. package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +96 -50
  9. package/lib/commonjs/components/checkbox/AnimatedCheckbox.js +3 -2
  10. package/lib/commonjs/components/checkbox/AnimatedCheckbox.js.map +1 -1
  11. package/lib/commonjs/components/checkbox/AnimatedMessageCheckbox.js +11 -7
  12. package/lib/commonjs/components/checkbox/AnimatedMessageCheckbox.js.map +1 -1
  13. package/lib/commonjs/components/checkbox/CheckboxLabel.js +5 -0
  14. package/lib/commonjs/components/checkbox/CheckboxLabel.js.map +1 -1
  15. package/lib/commonjs/components/image/Image.js +3 -1
  16. package/lib/commonjs/components/image/Image.js.map +1 -1
  17. package/lib/commonjs/components/listitems/ListItemNav.js +2 -1
  18. package/lib/commonjs/components/listitems/ListItemNav.js.map +1 -1
  19. package/lib/commonjs/components/listitems/ListItemRadio.js +6 -0
  20. package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -1
  21. package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +154 -68
  22. package/lib/commonjs/components/logos/LogoPaymentCard.js +7 -2
  23. package/lib/commonjs/components/logos/LogoPaymentCard.js.map +1 -1
  24. package/lib/commonjs/components/modules/ModuleIDP.js +1 -0
  25. package/lib/commonjs/components/modules/ModuleIDP.js.map +1 -1
  26. package/lib/commonjs/components/radio/AnimatedRadio.js +1 -0
  27. package/lib/commonjs/components/radio/AnimatedRadio.js.map +1 -1
  28. package/lib/commonjs/components/radio/RadioButtonLabel.js +8 -3
  29. package/lib/commonjs/components/radio/RadioButtonLabel.js.map +1 -1
  30. package/lib/commonjs/components/switch/AnimatedSwitch.js +3 -2
  31. package/lib/commonjs/components/switch/AnimatedSwitch.js.map +1 -1
  32. package/lib/commonjs/components/switch/SwitchLabel.js +7 -2
  33. package/lib/commonjs/components/switch/SwitchLabel.js.map +1 -1
  34. package/lib/commonjs/components/textInput/TextInputBase.js +17 -12
  35. package/lib/commonjs/components/textInput/TextInputBase.js.map +1 -1
  36. package/lib/commonjs/core/IOStyles.js +1 -1
  37. package/lib/commonjs/core/IOStyles.js.map +1 -1
  38. package/lib/module/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +24 -12
  39. package/lib/module/components/avatar/Avatar.js +2 -0
  40. package/lib/module/components/avatar/Avatar.js.map +1 -1
  41. package/lib/module/components/avatar/__test__/__snapshots__/avatar.test.tsx.snap +4 -0
  42. package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +92 -18
  43. package/lib/module/components/buttons/ButtonSolid.js +4 -2
  44. package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
  45. package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +96 -50
  46. package/lib/module/components/checkbox/AnimatedCheckbox.js +3 -2
  47. package/lib/module/components/checkbox/AnimatedCheckbox.js.map +1 -1
  48. package/lib/module/components/checkbox/AnimatedMessageCheckbox.js +11 -7
  49. package/lib/module/components/checkbox/AnimatedMessageCheckbox.js.map +1 -1
  50. package/lib/module/components/checkbox/CheckboxLabel.js +5 -0
  51. package/lib/module/components/checkbox/CheckboxLabel.js.map +1 -1
  52. package/lib/module/components/image/Image.js +3 -1
  53. package/lib/module/components/image/Image.js.map +1 -1
  54. package/lib/module/components/listitems/ListItemNav.js +2 -1
  55. package/lib/module/components/listitems/ListItemNav.js.map +1 -1
  56. package/lib/module/components/listitems/ListItemRadio.js +6 -0
  57. package/lib/module/components/listitems/ListItemRadio.js.map +1 -1
  58. package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +154 -68
  59. package/lib/module/components/logos/LogoPaymentCard.js +9 -4
  60. package/lib/module/components/logos/LogoPaymentCard.js.map +1 -1
  61. package/lib/module/components/modules/ModuleIDP.js +1 -0
  62. package/lib/module/components/modules/ModuleIDP.js.map +1 -1
  63. package/lib/module/components/radio/AnimatedRadio.js +1 -0
  64. package/lib/module/components/radio/AnimatedRadio.js.map +1 -1
  65. package/lib/module/components/radio/RadioButtonLabel.js +8 -3
  66. package/lib/module/components/radio/RadioButtonLabel.js.map +1 -1
  67. package/lib/module/components/switch/AnimatedSwitch.js +5 -4
  68. package/lib/module/components/switch/AnimatedSwitch.js.map +1 -1
  69. package/lib/module/components/switch/SwitchLabel.js +7 -2
  70. package/lib/module/components/switch/SwitchLabel.js.map +1 -1
  71. package/lib/module/components/textInput/TextInputBase.js +18 -13
  72. package/lib/module/components/textInput/TextInputBase.js.map +1 -1
  73. package/lib/module/core/IOStyles.js +1 -1
  74. package/lib/module/core/IOStyles.js.map +1 -1
  75. package/lib/typescript/components/avatar/Avatar.d.ts.map +1 -1
  76. package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
  77. package/lib/typescript/components/checkbox/AnimatedCheckbox.d.ts.map +1 -1
  78. package/lib/typescript/components/checkbox/AnimatedMessageCheckbox.d.ts.map +1 -1
  79. package/lib/typescript/components/checkbox/CheckboxLabel.d.ts.map +1 -1
  80. package/lib/typescript/components/image/Image.d.ts.map +1 -1
  81. package/lib/typescript/components/listitems/ListItemNav.d.ts.map +1 -1
  82. package/lib/typescript/components/listitems/ListItemRadio.d.ts.map +1 -1
  83. package/lib/typescript/components/logos/LogoPaymentCard.d.ts +5 -3
  84. package/lib/typescript/components/logos/LogoPaymentCard.d.ts.map +1 -1
  85. package/lib/typescript/components/modules/ModuleIDP.d.ts.map +1 -1
  86. package/lib/typescript/components/radio/AnimatedRadio.d.ts.map +1 -1
  87. package/lib/typescript/components/radio/RadioButtonLabel.d.ts.map +1 -1
  88. package/lib/typescript/components/switch/AnimatedSwitch.d.ts.map +1 -1
  89. package/lib/typescript/components/switch/SwitchLabel.d.ts.map +1 -1
  90. package/lib/typescript/components/textInput/TextInputBase.d.ts +2 -1
  91. package/lib/typescript/components/textInput/TextInputBase.d.ts.map +1 -1
  92. package/package.json +4 -3
  93. package/src/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +24 -12
  94. package/src/components/avatar/Avatar.tsx +2 -0
  95. package/src/components/avatar/__test__/__snapshots__/avatar.test.tsx.snap +4 -0
  96. package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +92 -18
  97. package/src/components/buttons/ButtonSolid.tsx +3 -1
  98. package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +96 -50
  99. package/src/components/checkbox/AnimatedCheckbox.tsx +2 -1
  100. package/src/components/checkbox/AnimatedMessageCheckbox.tsx +9 -7
  101. package/src/components/checkbox/CheckboxLabel.tsx +5 -0
  102. package/src/components/image/Image.tsx +6 -1
  103. package/src/components/listitems/ListItemNav.tsx +2 -1
  104. package/src/components/listitems/ListItemRadio.tsx +10 -1
  105. package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +154 -68
  106. package/src/components/logos/LogoPaymentCard.tsx +15 -6
  107. package/src/components/modules/ModuleIDP.tsx +5 -1
  108. package/src/components/radio/AnimatedRadio.tsx +1 -0
  109. package/src/components/radio/RadioButtonLabel.tsx +7 -2
  110. package/src/components/switch/AnimatedSwitch.tsx +9 -8
  111. package/src/components/switch/SwitchLabel.tsx +6 -1
  112. package/src/components/textInput/TextInputBase.tsx +20 -14
  113. package/src/core/IOStyles.ts +1 -1
@@ -9,6 +9,7 @@ import {
9
9
  } from "react-native";
10
10
  import Animated, {
11
11
  Easing,
12
+ WithTimingConfig,
12
13
  useAnimatedStyle,
13
14
  useSharedValue,
14
15
  withTiming
@@ -17,7 +18,8 @@ import {
17
18
  IOColors,
18
19
  IOSpacingScale,
19
20
  IOStyles,
20
- useIOExperimentalDesign
21
+ useIOExperimentalDesign,
22
+ useIOTheme
21
23
  } from "../../core";
22
24
  import { makeFontStyleObject } from "../../utils/fonts";
23
25
  import { RNTextInputProps, getInputPropsByType } from "../../utils/textInput";
@@ -45,6 +47,7 @@ type InputTextProps = WithTestID<{
45
47
  isPassword?: boolean;
46
48
  onBlur?: () => void;
47
49
  onFocus?: () => void;
50
+ autoFocus?: boolean;
48
51
  }>;
49
52
 
50
53
  const inputMarginTop: IOSpacingScale = 8;
@@ -157,8 +160,11 @@ export const TextInputBase = ({
157
160
  bottomMessageColor,
158
161
  onBlur,
159
162
  onFocus,
160
- isPassword
163
+ isPassword,
164
+ autoFocus
161
165
  }: InputTextProps) => {
166
+ const theme = useIOTheme();
167
+
162
168
  const labelSharedValue = useSharedValue<boolean>(false);
163
169
  const [inputStatus, setInputStatus] = React.useState<InputStatus>(
164
170
  disabled ? "disabled" : "initial"
@@ -175,7 +181,7 @@ export const TextInputBase = ({
175
181
  const boxStyle: ViewStyle = useMemo(() => {
176
182
  if (inputStatus === "focused") {
177
183
  return {
178
- borderColor: IOColors["blueIO-500"],
184
+ borderColor: IOColors[theme["interactiveElem-default"]],
179
185
  borderWidth: 2
180
186
  };
181
187
  }
@@ -189,20 +195,17 @@ export const TextInputBase = ({
189
195
  borderColor: IOColors["grey-200"],
190
196
  borderWidth: 1
191
197
  };
192
- }, [inputStatus]);
198
+ }, [inputStatus, theme]);
199
+
200
+ const easingConf: WithTimingConfig = {
201
+ duration: 300,
202
+ easing: Easing.elastic(0.85)
203
+ };
193
204
 
194
205
  const animatedLabelProps = useAnimatedStyle(() => ({
195
- fontSize: withTiming(labelSharedValue.value ? 12 : 16, {
196
- duration: 300,
197
- easing: Easing.elastic(0.85)
198
- }),
206
+ fontSize: withTiming(labelSharedValue.value ? 12 : 16, easingConf),
199
207
  transform: [
200
- {
201
- translateY: withTiming(labelSharedValue.value ? -14 : 0, {
202
- duration: 300,
203
- easing: Easing.elastic(0.85)
204
- })
205
- }
208
+ { translateY: withTiming(labelSharedValue.value ? -14 : 0, easingConf) }
206
209
  ]
207
210
  }));
208
211
 
@@ -292,6 +295,8 @@ export const TextInputBase = ({
292
295
  labelSharedValue.value = true;
293
296
  onFocus?.();
294
297
  }}
298
+ selectionColor={IOColors[theme["interactiveElem-default"]]} // Caret iOS
299
+ cursorColor={IOColors[theme["interactiveElem-default"]]} // Caret Android
295
300
  maxLength={counterLimit}
296
301
  onBlur={onBlurHandler}
297
302
  value={inputValue}
@@ -302,6 +307,7 @@ export const TextInputBase = ({
302
307
  ? styles.textInputStyleFont
303
308
  : styles.textInputStyleLegacyFont
304
309
  ]}
310
+ autoFocus={autoFocus}
305
311
  />
306
312
  {/** Left value is due to the absolute position of the label in order to let it
307
313
  * translate to top on focus
@@ -370,7 +370,7 @@ export const IOSelectionListItemVisualParams: IOSelectionListItemVisualParams =
370
370
  paddingHorizontal: IOVisualCostants.appMarginDefault,
371
371
  iconMargin: 8,
372
372
  iconSize: 24,
373
- actionMargin: 16,
373
+ actionMargin: 8,
374
374
  descriptionMargin: 4
375
375
  };
376
376