@pagopa/io-app-design-system 4.5.1 → 4.5.3

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 (98) hide show
  1. package/lib/commonjs/components/accordion/AccordionItem.js +1 -1
  2. package/lib/commonjs/components/accordion/AccordionItem.js.map +1 -1
  3. package/lib/commonjs/components/buttons/ButtonLink.js +25 -25
  4. package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
  5. package/lib/commonjs/components/buttons/ButtonOutline.js +41 -97
  6. package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
  7. package/lib/commonjs/components/buttons/ButtonSolid.js +70 -63
  8. package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
  9. package/lib/commonjs/components/buttons/IconButton.js +29 -27
  10. package/lib/commonjs/components/buttons/IconButton.js.map +1 -1
  11. package/lib/commonjs/components/buttons/IconButtonSolid.js +27 -27
  12. package/lib/commonjs/components/buttons/IconButtonSolid.js.map +1 -1
  13. package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +5 -7
  14. package/lib/commonjs/components/icons/svg/IconProductIOAppBlueBg.js +8 -20
  15. package/lib/commonjs/components/icons/svg/IconProductIOAppBlueBg.js.map +1 -1
  16. package/lib/commonjs/components/icons/svg/originals/IconProductIOAppBlueBg.svg +12 -9
  17. package/lib/commonjs/components/layout/HeaderFirstLevel.js +2 -2
  18. package/lib/commonjs/components/layout/HeaderFirstLevel.js.map +1 -1
  19. package/lib/commonjs/components/layout/HeaderSecondLevel.js +24 -14
  20. package/lib/commonjs/components/layout/HeaderSecondLevel.js.map +1 -1
  21. package/lib/commonjs/components/listitems/ListItemInfo.js +1 -1
  22. package/lib/commonjs/components/listitems/ListItemInfo.js.map +1 -1
  23. package/lib/commonjs/components/listitems/ListItemInfoCopy.js +1 -1
  24. package/lib/commonjs/components/listitems/ListItemInfoCopy.js.map +1 -1
  25. package/lib/commonjs/components/listitems/ListItemNav.js +4 -3
  26. package/lib/commonjs/components/listitems/ListItemNav.js.map +1 -1
  27. package/lib/commonjs/core/IOColors.js +17 -3
  28. package/lib/commonjs/core/IOColors.js.map +1 -1
  29. package/lib/module/components/accordion/AccordionItem.js +1 -1
  30. package/lib/module/components/accordion/AccordionItem.js.map +1 -1
  31. package/lib/module/components/buttons/ButtonLink.js +26 -26
  32. package/lib/module/components/buttons/ButtonLink.js.map +1 -1
  33. package/lib/module/components/buttons/ButtonOutline.js +42 -98
  34. package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
  35. package/lib/module/components/buttons/ButtonSolid.js +73 -66
  36. package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
  37. package/lib/module/components/buttons/IconButton.js +30 -28
  38. package/lib/module/components/buttons/IconButton.js.map +1 -1
  39. package/lib/module/components/buttons/IconButtonSolid.js +28 -28
  40. package/lib/module/components/buttons/IconButtonSolid.js.map +1 -1
  41. package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +5 -7
  42. package/lib/module/components/icons/svg/IconProductIOAppBlueBg.js +9 -21
  43. package/lib/module/components/icons/svg/IconProductIOAppBlueBg.js.map +1 -1
  44. package/lib/module/components/icons/svg/originals/IconProductIOAppBlueBg.svg +12 -9
  45. package/lib/module/components/layout/HeaderFirstLevel.js +2 -2
  46. package/lib/module/components/layout/HeaderFirstLevel.js.map +1 -1
  47. package/lib/module/components/layout/HeaderSecondLevel.js +26 -16
  48. package/lib/module/components/layout/HeaderSecondLevel.js.map +1 -1
  49. package/lib/module/components/listitems/ListItemInfo.js +1 -1
  50. package/lib/module/components/listitems/ListItemInfo.js.map +1 -1
  51. package/lib/module/components/listitems/ListItemInfoCopy.js +1 -1
  52. package/lib/module/components/listitems/ListItemInfoCopy.js.map +1 -1
  53. package/lib/module/components/listitems/ListItemNav.js +4 -3
  54. package/lib/module/components/listitems/ListItemNav.js.map +1 -1
  55. package/lib/module/core/IOColors.js +17 -3
  56. package/lib/module/core/IOColors.js.map +1 -1
  57. package/lib/typescript/components/buttons/ButtonLink.d.ts +1 -1
  58. package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
  59. package/lib/typescript/components/buttons/ButtonOutline.d.ts +2 -2
  60. package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
  61. package/lib/typescript/components/buttons/ButtonSolid.d.ts +1 -1
  62. package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
  63. package/lib/typescript/components/buttons/IconButton.d.ts +2 -1
  64. package/lib/typescript/components/buttons/IconButton.d.ts.map +1 -1
  65. package/lib/typescript/components/buttons/IconButtonSolid.d.ts.map +1 -1
  66. package/lib/typescript/components/icons/svg/IconProductIOAppBlueBg.d.ts.map +1 -1
  67. package/lib/typescript/components/layout/HeaderFirstLevel.d.ts +2 -2
  68. package/lib/typescript/components/layout/HeaderFirstLevel.d.ts.map +1 -1
  69. package/lib/typescript/components/layout/HeaderSecondLevel.d.ts +1 -1
  70. package/lib/typescript/components/layout/HeaderSecondLevel.d.ts.map +1 -1
  71. package/lib/typescript/components/listitems/ListItemNav.d.ts.map +1 -1
  72. package/lib/typescript/core/IOColors.d.ts +1 -1
  73. package/lib/typescript/core/IOColors.d.ts.map +1 -1
  74. package/lib/typescript/core/IOStyles.d.ts +2 -2
  75. package/lib/typescript/utils/fonts.d.ts +1 -1
  76. package/package.json +1 -1
  77. package/src/components/accordion/AccordionItem.tsx +1 -1
  78. package/src/components/buttons/ButtonLink.tsx +37 -30
  79. package/src/components/buttons/ButtonOutline.tsx +51 -108
  80. package/src/components/buttons/ButtonSolid.tsx +94 -78
  81. package/src/components/buttons/IconButton.tsx +45 -29
  82. package/src/components/buttons/IconButtonSolid.tsx +35 -31
  83. package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +5 -7
  84. package/src/components/icons/svg/IconProductIOAppBlueBg.tsx +12 -13
  85. package/src/components/icons/svg/originals/IconProductIOAppBlueBg.svg +12 -9
  86. package/src/components/layout/HeaderFirstLevel.tsx +4 -4
  87. package/src/components/layout/HeaderSecondLevel.tsx +43 -23
  88. package/src/components/listitems/ListItemInfo.tsx +1 -1
  89. package/src/components/listitems/ListItemInfoCopy.tsx +1 -1
  90. package/src/components/listitems/ListItemNav.tsx +5 -4
  91. package/src/core/IOColors.ts +25 -4
  92. package/lib/commonjs/components/layout/BlockButtons.js +0 -85
  93. package/lib/commonjs/components/layout/BlockButtons.js.map +0 -1
  94. package/lib/module/components/layout/BlockButtons.js +0 -76
  95. package/lib/module/components/layout/BlockButtons.js.map +0 -1
  96. package/lib/typescript/components/layout/BlockButtons.d.ts +0 -54
  97. package/lib/typescript/components/layout/BlockButtons.d.ts.map +0 -1
  98. package/src/components/layout/BlockButtons.tsx +0 -143
@@ -9,8 +9,10 @@ import {
9
9
  IOColors,
10
10
  IOIconButtonStyles,
11
11
  IOStyles,
12
+ IOThemeLight,
12
13
  hexToRgba,
13
- useIOExperimentalDesign
14
+ useIOExperimentalDesign,
15
+ useIOTheme
14
16
  } from "../../core";
15
17
  import { useScaleAnimation } from "../../hooks";
16
18
  import { WithTestID } from "../../utils/types";
@@ -29,6 +31,7 @@ export type IconButton = WithTestID<{
29
31
  accessibilityLabel: string;
30
32
  accessibilityHint?: string;
31
33
  onPress: (event: GestureResponderEvent) => void;
34
+ persistentColorMode?: boolean;
32
35
  }>;
33
36
 
34
37
  type ColorStates = {
@@ -70,38 +73,12 @@ const mapLegacyColorStates: Record<
70
73
  }
71
74
  };
72
75
 
73
- const mapColorStates: Record<NonNullable<IconButton["color"]>, ColorStates> = {
74
- // Primary button
75
- primary: {
76
- icon: {
77
- default: IOColors["blueIO-500"],
78
- pressed: IOColors["blueIO-600"],
79
- disabled: hexToRgba(IOColors["blueIO-500"], 0.25)
80
- }
81
- },
82
- // Neutral button
83
- neutral: {
84
- icon: {
85
- default: IOColors.black,
86
- pressed: IOColors["grey-850"],
87
- disabled: IOColors["grey-450"]
88
- }
89
- },
90
- // Contrast button
91
- contrast: {
92
- icon: {
93
- default: IOColors.white,
94
- pressed: hexToRgba(IOColors.white, 0.85),
95
- disabled: hexToRgba(IOColors.white, 0.25)
96
- }
97
- }
98
- };
99
-
100
76
  const AnimatedIconClassComponent =
101
77
  Animated.createAnimatedComponent(IconClassComponent);
102
78
 
103
79
  export const IconButton = ({
104
80
  color = "primary",
81
+ persistentColorMode = false,
105
82
  icon,
106
83
  iconSize = 24,
107
84
  disabled = false,
@@ -110,15 +87,54 @@ export const IconButton = ({
110
87
  accessibilityHint,
111
88
  testID
112
89
  }: IconButton) => {
90
+ const theme = useIOTheme();
113
91
  const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
114
92
  useScaleAnimation("exaggerated");
115
93
  const reducedMotion = useReducedMotion();
116
94
 
117
95
  const { isExperimental } = useIOExperimentalDesign();
118
96
 
97
+ const mapColorStates = useMemo<
98
+ Record<NonNullable<IconButton["color"]>, ColorStates>
99
+ >(
100
+ () => ({
101
+ // Primary button
102
+ primary: {
103
+ icon: {
104
+ default: IOColors[theme["interactiveElem-default"]],
105
+ pressed: IOColors[theme["interactiveElem-pressed"]],
106
+ disabled: IOColors[theme["interactiveElem-disabled"]]
107
+ }
108
+ },
109
+ // Neutral button
110
+ neutral: {
111
+ icon: {
112
+ default: persistentColorMode
113
+ ? IOColors[IOThemeLight["neutralButton-default"]]
114
+ : IOColors[theme["neutralButton-default"]],
115
+ pressed: persistentColorMode
116
+ ? IOColors[IOThemeLight["neutralButton-pressed"]]
117
+ : IOColors[theme["neutralButton-pressed"]],
118
+ disabled: persistentColorMode
119
+ ? IOColors[IOThemeLight["neutralButton-disabled"]]
120
+ : IOColors[theme["neutralButton-disabled"]]
121
+ }
122
+ },
123
+ // Contrast button
124
+ contrast: {
125
+ icon: {
126
+ default: IOColors.white,
127
+ pressed: hexToRgba(IOColors.white, 0.85),
128
+ disabled: hexToRgba(IOColors.white, 0.25)
129
+ }
130
+ }
131
+ }),
132
+ [persistentColorMode, theme]
133
+ );
134
+
119
135
  const colorMap = useMemo(
120
136
  () => (isExperimental ? mapColorStates : mapLegacyColorStates),
121
- [isExperimental]
137
+ [isExperimental, mapColorStates]
122
138
  );
123
139
 
124
140
  // Animate the <Icon> color prop
@@ -8,7 +8,8 @@ import Animated, {
8
8
  import {
9
9
  IOButtonStyles,
10
10
  IOIconButtonStyles,
11
- useIOExperimentalDesign
11
+ useIOExperimentalDesign,
12
+ useIOTheme
12
13
  } from "../../core";
13
14
  import { IOColors, hexToRgba } from "../../core/IOColors";
14
15
  import { useScaleAnimation } from "../../hooks";
@@ -36,35 +37,6 @@ type ColorStates = {
36
37
  };
37
38
  };
38
39
 
39
- const mapColorStates: Record<
40
- NonNullable<IconButtonSolid["color"]>,
41
- ColorStates
42
- > = {
43
- // Primary button
44
- primary: {
45
- background: {
46
- default: IOColors["blueIO-500"],
47
- pressed: IOColors["blueIO-600"],
48
- disabled: IOColors["grey-100"]
49
- },
50
- icon: {
51
- default: IOColors.white,
52
- disabled: IOColors["grey-450"]
53
- }
54
- },
55
- contrast: {
56
- background: {
57
- default: IOColors.white,
58
- pressed: IOColors["blueIO-50"],
59
- disabled: hexToRgba(IOColors.white, 0.25)
60
- },
61
- icon: {
62
- default: IOColors["blueIO-500"],
63
- disabled: IOColors["blueIO-500"]
64
- }
65
- }
66
- };
67
-
68
40
  // TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
69
41
  const mapLegacyColorStates: Record<
70
42
  NonNullable<IconButtonSolid["color"]>,
@@ -104,15 +76,47 @@ export const IconButtonSolid = ({
104
76
  accessibilityHint,
105
77
  testID
106
78
  }: IconButtonSolid) => {
79
+ const theme = useIOTheme();
107
80
  const { isExperimental } = useIOExperimentalDesign();
108
81
 
109
82
  const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
110
83
  useScaleAnimation("exaggerated");
111
84
  const reducedMotion = useReducedMotion();
112
85
 
86
+ const mapColorStates = React.useMemo<
87
+ Record<NonNullable<IconButtonSolid["color"]>, ColorStates>
88
+ >(
89
+ () => ({
90
+ // Primary button
91
+ primary: {
92
+ background: {
93
+ default: IOColors[theme["interactiveElem-default"]],
94
+ pressed: IOColors[theme["interactiveElem-pressed"]],
95
+ disabled: IOColors[theme["interactiveElem-disabled"]]
96
+ },
97
+ icon: {
98
+ default: IOColors[theme["buttonText-default"]],
99
+ disabled: IOColors[theme["buttonText-disabled"]]
100
+ }
101
+ },
102
+ contrast: {
103
+ background: {
104
+ default: IOColors.white,
105
+ pressed: IOColors["blueIO-50"],
106
+ disabled: hexToRgba(IOColors.white, 0.25)
107
+ },
108
+ icon: {
109
+ default: IOColors["blueIO-500"],
110
+ disabled: IOColors["blueIO-500"]
111
+ }
112
+ }
113
+ }),
114
+ [theme]
115
+ );
116
+
113
117
  const colorMap = React.useMemo(
114
118
  () => (isExperimental ? mapColorStates : mapLegacyColorStates),
115
- [isExperimental]
119
+ [isExperimental, mapColorStates]
116
120
  );
117
121
 
118
122
  const backgroundColorAnimationStyle = useAnimatedStyle(() => ({
@@ -176,7 +176,7 @@ exports[`Test Buttons Components - Experimental Enabled ButtonOutline Snapshot 1
176
176
  },
177
177
  false,
178
178
  {
179
- "backgroundColor": "rgba(231,236,252,0)",
179
+ "backgroundColor": "rgba(9,50,182,0)",
180
180
  "borderColor": "#0B3EE3",
181
181
  },
182
182
  {
@@ -282,15 +282,14 @@ exports[`Test Buttons Components - Experimental Enabled ButtonSolid Snapshot 1`]
282
282
  "textAlignVertical": "center",
283
283
  },
284
284
  {
285
+ "backgroundColor": "#0B3EE3",
285
286
  "overflow": "hidden",
286
287
  },
287
288
  false,
288
289
  {
289
290
  "height": 48,
290
291
  },
291
- {
292
- "backgroundColor": "#0B3EE3",
293
- },
292
+ {},
294
293
  {
295
294
  "transform": [
296
295
  {
@@ -1024,15 +1023,14 @@ exports[`Test Buttons Components ButtonSolid Snapshot 1`] = `
1024
1023
  "textAlignVertical": "center",
1025
1024
  },
1026
1025
  {
1026
+ "backgroundColor": "#0073E6",
1027
1027
  "overflow": "hidden",
1028
1028
  },
1029
1029
  false,
1030
1030
  {
1031
1031
  "height": 40,
1032
1032
  },
1033
- {
1034
- "backgroundColor": "#0073E6",
1035
- },
1033
+ {},
1036
1034
  {
1037
1035
  "transform": [
1038
1036
  {
@@ -1,21 +1,20 @@
1
1
  import React from "react";
2
- import { Svg, Path, G, Mask, Rect } from "react-native-svg";
2
+ import { Path, Svg } from "react-native-svg";
3
+ import { IOColors } from "../../../core";
3
4
  import { SVGIconProps } from "../types";
4
5
 
5
6
  const IconProductIOAppBlueBg = ({ size, style, ...props }: SVGIconProps) => (
6
7
  <Svg width={size} height={size} viewBox="0 0 24 24" style={style} {...props}>
7
- <Rect width={size} height={size} fill="#0B3EE3" rx="4" />
8
- <Mask id="a" width={size} height={size} x="6" y="7">
9
- <Path
10
- fill="#fff"
11
- fillRule="evenodd"
12
- clipRule="evenodd"
13
- d="M7.25 7c.69036 0 1.25.55964 1.25 1.25S7.94036 9.5 7.25 9.5 6 8.94036 6 8.25 6.55964 7 7.25 7Zm10.5 6c0 2.2091-1.7909 4-3.8095 4-2.3996 0-4.1905-1.7909-4.1905-4 0-2.2091 1.7909-4 4.1905-4 2.0186 0 3.8095 1.7909 3.8095 4Zm-9.5-1.25c0-.5523-.44772-1-1-1s-1 .4477-1 1V16c0 .5523.44772 1 1 1s1-.4477 1-1v-4.25Zm6.4826.8302h.5326v-.524h-.5287v-.6337h-.5785v2.1082c0 .3331.0459.5606.1417.6824.092.1259.2682.1869.5287.1869.0996 0 .249-.0244.4406-.0691l-.0268-.4874-.3295.0081c-.0575 0-.0996-.0122-.1264-.0406-.0268-.0285-.0422-.061-.046-.0975-.0038-.0406-.0077-.1016-.0077-.195v-.9383Zm-1.7431-.52v2.287h.5785v-2.287h-.5785Zm-.8683-.0568c.1011 0 .1867.034.2528.1021.0661.0681.0972.1514.0972.2536 0 .1021-.0311.1816-.0972.2497-.0623.0605-.1439.0946-.2489.0946-.1011 0-.1867-.0341-.2528-.1022-.0661-.0681-.1011-.1513-.1011-.2497 0-.0984.035-.1816.0972-.2497.0661-.0682.1517-.0984.2528-.0984Z"
14
- />
15
- </Mask>
16
- <G mask="url(#a)">
17
- <Path fill="#fff" d="M-13-13h50v50h-50z" />
18
- </G>
8
+ <Path
9
+ d="M0 9.6c0-3.36 0-5.04.654-6.324A6 6 0 0 1 3.276.654C4.56 0 6.24 0 9.6 0h4.8c3.36 0 5.04 0 6.324.654a6 6 0 0 1 2.622 2.622C24 4.56 24 6.24 24 9.6v4.8c0 3.36 0 5.04-.654 6.324a6 6 0 0 1-2.622 2.622C19.44 24 17.76 24 14.4 24H9.6c-3.36 0-5.04 0-6.324-.654a6 6 0 0 1-2.622-2.622C0 19.44 0 17.76 0 14.4V9.6Z"
10
+ fill={IOColors["blueIO-500"]}
11
+ />
12
+ <Path
13
+ fillRule="evenodd"
14
+ clipRule="evenodd"
15
+ d="M7.21 6.4a1.35 1.35 0 1 1 0 2.7 1.35 1.35 0 0 1 0-2.7Zm11.34 6.48c0 2.386-1.934 4.32-4.114 4.32-2.592 0-4.526-1.934-4.526-4.32s1.934-4.32 4.526-4.32c2.18 0 4.114 1.934 4.114 4.32ZM8.29 11.53a1.08 1.08 0 1 0-2.16 0v4.59a1.08 1.08 0 0 0 2.16 0v-4.59Zm7.001.897h.576v-.566h-.571v-.685h-.625v2.277c0 .36.05.606.153.737.1.136.29.202.57.202.108 0 .27-.026.477-.075l-.03-.526-.355.009c-.062 0-.108-.013-.137-.044a.177.177 0 0 1-.05-.105 2.24 2.24 0 0 1-.008-.211v-1.013Zm-1.882-.562v2.47h.624v-2.47h-.624Zm-.938-.062a.366.366 0 0 1 .378.385c0 .11-.034.196-.105.27a.37.37 0 0 1-.269.101.375.375 0 0 1-.382-.38c0-.106.038-.196.105-.27a.363.363 0 0 1 .273-.106Z"
16
+ fill={IOColors.white}
17
+ />
19
18
  </Svg>
20
19
  );
21
20
 
@@ -1,9 +1,12 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
2
- <rect width="24" height="24" fill="#0B3EE3" rx="4"/>
3
- <mask id="a" width="12" height="10" x="6" y="7" maskUnits="userSpaceOnUse" style="mask-type:luminance">
4
- <path fill="#fff" fill-rule="evenodd" d="M7.25 7c.69036 0 1.25.55964 1.25 1.25S7.94036 9.5 7.25 9.5 6 8.94036 6 8.25 6.55964 7 7.25 7Zm10.5 6c0 2.2091-1.7909 4-3.8095 4-2.3996 0-4.1905-1.7909-4.1905-4 0-2.2091 1.7909-4 4.1905-4 2.0186 0 3.8095 1.7909 3.8095 4Zm-9.5-1.25c0-.5523-.44772-1-1-1s-1 .4477-1 1V16c0 .5523.44772 1 1 1s1-.4477 1-1v-4.25Zm6.4826.8302h.5326v-.524h-.5287v-.6337h-.5785v2.1082c0 .3331.0459.5606.1417.6824.092.1259.2682.1869.5287.1869.0996 0 .249-.0244.4406-.0691l-.0268-.4874-.3295.0081c-.0575 0-.0996-.0122-.1264-.0406-.0268-.0285-.0422-.061-.046-.0975-.0038-.0406-.0077-.1016-.0077-.195v-.9383Zm-1.7431-.52v2.287h.5785v-2.287h-.5785Zm-.8683-.0568c.1011 0 .1867.034.2528.1021.0661.0681.0972.1514.0972.2536 0 .1021-.0311.1816-.0972.2497-.0623.0605-.1439.0946-.2489.0946-.1011 0-.1867-.0341-.2528-.1022-.0661-.0681-.1011-.1513-.1011-.2497 0-.0984.035-.1816.0972-.2497.0661-.0682.1517-.0984.2528-.0984Z" clip-rule="evenodd"/>
5
- </mask>
6
- <g mask="url(#a)">
7
- <path fill="#fff" d="M-13-13h50v50h-50z"/>
8
- </g>
9
- </svg>
1
+ <svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
+ <path
3
+ d="M0 9.6c0-3.36 0-5.04.654-6.324A6 6 0 0 1 3.276.654C4.56 0 6.24 0 9.6 0h4.8c3.36 0 5.04 0 6.324.654a6 6 0 0 1 2.622 2.622C24 4.56 24 6.24 24 9.6v4.8c0 3.36 0 5.04-.654 6.324a6 6 0 0 1-2.622 2.622C19.44 24 17.76 24 14.4 24H9.6c-3.36 0-5.04 0-6.324-.654a6 6 0 0 1-2.622-2.622C0 19.44 0 17.76 0 14.4V9.6Z"
4
+ fill="#0B3EE3"
5
+ />
6
+ <path
7
+ fill-rule="evenodd"
8
+ clip-rule="evenodd"
9
+ d="M7.21 6.4a1.35 1.35 0 1 1 0 2.7 1.35 1.35 0 0 1 0-2.7Zm11.34 6.48c0 2.386-1.934 4.32-4.114 4.32-2.592 0-4.526-1.934-4.526-4.32s1.934-4.32 4.526-4.32c2.18 0 4.114 1.934 4.114 4.32ZM8.29 11.53a1.08 1.08 0 1 0-2.16 0v4.59a1.08 1.08 0 0 0 2.16 0v-4.59Zm7.001.897h.576v-.566h-.571v-.685h-.625v2.277c0 .36.05.606.153.737.1.136.29.202.57.202.108 0 .27-.026.477-.075l-.03-.526-.355.009c-.062 0-.108-.013-.137-.044a.177.177 0 0 1-.05-.105 2.24 2.24 0 0 1-.008-.211v-1.013Zm-1.882-.562v2.47h.624v-2.47h-.624Zm-.938-.062a.366.366 0 0 1 .378.385c0 .11-.034.196-.105.27a.37.37 0 0 1-.269.101.375.375 0 0 1-.382-.38c0-.106.038-.196.105-.27a.363.363 0 0 1 .273-.106Z"
10
+ fill="#fff"
11
+ />
12
+ </svg>
@@ -28,8 +28,8 @@ import { HeaderActionProps } from "./common";
28
28
 
29
29
  export type HeaderFirstLevel = WithTestID<{
30
30
  title: string;
31
- firstAction: HeaderActionProps;
32
- secondAction: HeaderActionProps;
31
+ firstAction?: HeaderActionProps;
32
+ secondAction?: HeaderActionProps;
33
33
  thirdAction?: HeaderActionProps;
34
34
  animatedRef?: AnimatedRef<Animated.ScrollView>;
35
35
  animatedFlatListRef?: AnimatedRef<Animated.FlatList<any>>;
@@ -134,8 +134,8 @@ export const HeaderFirstLevel = ({
134
134
  </View>
135
135
  <HStack space={16} style={{ flexShrink: 0 }}>
136
136
  {thirdAction && <IconButton {...thirdAction} color={"primary"} />}
137
- <IconButton {...secondAction} color={"primary"} />
138
- <IconButton {...firstAction} color={"primary"} />
137
+ {secondAction && <IconButton {...secondAction} color={"primary"} />}
138
+ {firstAction && <IconButton {...firstAction} color={"primary"} />}
139
139
  </HStack>
140
140
  </View>
141
141
  </Animated.View>
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { ComponentProps, useEffect, useLayoutEffect } from "react";
2
+ import { createRef, useEffect, useLayoutEffect, useMemo } from "react";
3
3
  import {
4
4
  AccessibilityInfo,
5
5
  ColorValue,
@@ -24,13 +24,14 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
24
24
  import {
25
25
  IOColors,
26
26
  IOSpringValues,
27
+ IOThemeDark,
28
+ IOThemeLight,
27
29
  IOVisualCostants,
28
30
  alertEdgeToEdgeInsetTransitionConfig,
29
31
  hexToRgba,
30
32
  iconBtnSizeSmall,
31
33
  useIOExperimentalDesign,
32
- useIOTheme,
33
- useIOThemeContext
34
+ useIOTheme
34
35
  } from "../../core";
35
36
  import type { IOSpacer, IOSpacingScale } from "../../core/IOSpacing";
36
37
  import { WithTestID } from "../../utils/types";
@@ -48,7 +49,7 @@ type ScrollValues = {
48
49
  type DiscreteTransitionProps =
49
50
  | {
50
51
  enableDiscreteTransition: true;
51
- animatedRef: AnimatedRef<Animated.ScrollView>;
52
+ animatedRef: AnimatedRef<Animated.ScrollView | Animated.FlatList<any>>;
52
53
  }
53
54
  | {
54
55
  enableDiscreteTransition?: false;
@@ -139,7 +140,7 @@ export const HeaderSecondLevel = ({
139
140
  backTestID,
140
141
  title,
141
142
  type,
142
- variant = "neutral",
143
+ variant,
143
144
  backgroundColor,
144
145
  transparent = false,
145
146
  ignoreSafeAreaMargin = false,
@@ -151,29 +152,35 @@ export const HeaderSecondLevel = ({
151
152
  thirdAction
152
153
  }: HeaderSecondLevel) => {
153
154
  const scrollOffset = useScrollViewOffset(
154
- animatedRef as AnimatedRef<Animated.ScrollView>
155
+ (animatedRef as AnimatedRef<Animated.ScrollView>) ||
156
+ (animatedRef as AnimatedRef<Animated.FlatList<any>>)
155
157
  );
156
- const titleRef = React.createRef<View>();
158
+
159
+ const titleRef = createRef<View>();
157
160
 
158
161
  const { isExperimental } = useIOExperimentalDesign();
159
162
  const theme = useIOTheme();
160
- const { themeType } = useIOThemeContext();
161
163
  const insets = useSafeAreaInsets();
162
- const isTitleAccessible = React.useMemo(() => !!title.trim(), [title]);
164
+ const isTitleAccessible = useMemo(() => !!title.trim(), [title]);
163
165
  const paddingTop = useSharedValue(ignoreSafeAreaMargin ? 0 : insets.top);
164
166
 
165
167
  const AnimatedIOText = Animated.createAnimatedComponent(IOText);
166
168
 
167
- const iconButtonColorDefault: ComponentProps<typeof IconButton>["color"] =
168
- themeType === "dark" ? "contrast" : "neutral";
169
+ // If the variant is not set, set a fallback color
170
+ const defaultIconColor = variant ?? "neutral";
169
171
 
170
- const iconButtonColor: ComponentProps<typeof IconButton>["color"] =
171
- variant === "contrast" ? "contrast" : iconButtonColorDefault;
172
+ /* We apply the same logic of `persistentColorMode`
173
+ to the title color: if variant is set, the color will
174
+ be persistent, otherwise it will vary depending
175
+ on the color scheme. */
176
+ const titleColorVariant =
177
+ variant === "contrast"
178
+ ? IOColors[IOThemeDark["textHeading-default"]]
179
+ : IOColors[IOThemeLight["textHeading-default"]];
172
180
 
173
- const titleColor: ColorValue =
174
- variant === "neutral"
175
- ? IOColors[theme["textHeading-default"]]
176
- : IOColors.white;
181
+ const titleColor: ColorValue = variant
182
+ ? titleColorVariant
183
+ : IOColors[theme["textHeading-default"]];
177
184
 
178
185
  /* Visual attributes when there are transitions between states */
179
186
  const HEADER_DEFAULT_BG_COLOR: IOColors = theme["appBackground-primary"];
@@ -186,9 +193,7 @@ export const HeaderSecondLevel = ({
186
193
  : headerBgColorSolidState;
187
194
 
188
195
  const borderColorDefault = IOColors[theme["divider-default"]];
189
-
190
196
  const borderColorSolidState = backgroundColor ?? borderColorDefault;
191
-
192
197
  const borderColorTransparentState = hexToRgba(borderColorSolidState, 0);
193
198
 
194
199
  useLayoutEffect(() => {
@@ -277,7 +282,10 @@ export const HeaderSecondLevel = ({
277
282
  android: "backAndroid",
278
283
  default: "backiOS"
279
284
  })}
280
- color={iconButtonColor}
285
+ color={defaultIconColor}
286
+ /* If we specify a variant, we probably want to
287
+ make it persistent in both light and dark modes. */
288
+ persistentColorMode={!!variant}
281
289
  onPress={goBack}
282
290
  accessibilityLabel={backAccessibilityLabel}
283
291
  testID={backTestID}
@@ -312,13 +320,25 @@ export const HeaderSecondLevel = ({
312
320
  </View>
313
321
  <HStack allowScaleSpacing space={16} style={{ flexShrink: 0 }}>
314
322
  {type === "threeActions" && (
315
- <IconButton {...thirdAction} color={iconButtonColor} />
323
+ <IconButton
324
+ {...thirdAction}
325
+ color={defaultIconColor}
326
+ persistentColorMode={!!variant}
327
+ />
316
328
  )}
317
329
  {(type === "twoActions" || type === "threeActions") && (
318
- <IconButton {...secondAction} color={iconButtonColor} />
330
+ <IconButton
331
+ {...secondAction}
332
+ color={defaultIconColor}
333
+ persistentColorMode={!!variant}
334
+ />
319
335
  )}
320
336
  {type !== "base" ? (
321
- <IconButton {...firstAction} color={iconButtonColor} />
337
+ <IconButton
338
+ {...firstAction}
339
+ color={defaultIconColor}
340
+ persistentColorMode={!!variant}
341
+ />
322
342
  ) : (
323
343
  <HSpacer size={iconBtnSizeSmall as IOSpacer} />
324
344
  )}
@@ -154,7 +154,7 @@ export const ListItemInfo = ({
154
154
  <Icon
155
155
  allowFontScaling
156
156
  name={icon}
157
- color="grey-450"
157
+ color={theme["icon-decorative"]}
158
158
  size={IOListItemVisualParams.iconSize}
159
159
  />
160
160
  )}
@@ -106,7 +106,7 @@ export const ListItemInfoCopy = ({
106
106
  <Icon
107
107
  allowFontScaling
108
108
  name={icon}
109
- color="grey-450"
109
+ color={theme["icon-decorative"]}
110
110
  size={IOListItemVisualParams.iconSize}
111
111
  />
112
112
  )}
@@ -81,7 +81,7 @@ export const ListItemNav = ({
81
81
  description,
82
82
  onPress,
83
83
  icon,
84
- iconColor = "grey-450",
84
+ iconColor,
85
85
  avatarProps: avatar,
86
86
  paymentLogoUri,
87
87
  accessibilityLabel,
@@ -96,6 +96,9 @@ export const ListItemNav = ({
96
96
  useListItemAnimation();
97
97
  const theme = useIOTheme();
98
98
 
99
+ const defaultIconColor = iconColor ?? theme["icon-decorative"];
100
+ const interactiveColor = theme["interactiveElem-default"];
101
+
99
102
  const { dynamicFontScale, hugeFontEnabled } = useIOFontDynamicScale();
100
103
 
101
104
  const listItemNavContent = (
@@ -151,8 +154,6 @@ export const ListItemNav = ({
151
154
  </>
152
155
  );
153
156
 
154
- const interactiveColor = theme["interactiveElem-default"];
155
-
156
157
  const handleOnPress = (event: GestureResponderEvent) => {
157
158
  if (!loading) {
158
159
  onPress(event);
@@ -188,7 +189,7 @@ export const ListItemNav = ({
188
189
  <Icon
189
190
  allowFontScaling
190
191
  name={icon}
191
- color={iconColor}
192
+ color={defaultIconColor}
192
193
  size={IOListItemVisualParams.iconSize}
193
194
  />
194
195
  <HSpacer
@@ -85,7 +85,7 @@ export const IOColors = asIOColors({
85
85
  /* Temporary scale based on legacy Blue */
86
86
  "blue-600": "#0353A3",
87
87
  "blue-500": "#0073E6",
88
- "blue-50": "#EFF7FF",
88
+ "blue-50": "#EFF7FF"
89
89
  });
90
90
 
91
91
  export type IOColors = keyof typeof IOColors;
@@ -206,7 +206,7 @@ export const IOColorsExtra = {
206
206
  "blueItalia-600": IOColors["blueItalia-600"],
207
207
  "blueItalia-500": IOColors["blueItalia-500"],
208
208
  "blueItalia-100": IOColors["blueItalia-100"],
209
- "blueItalia-50": IOColors["blueItalia-50"],
209
+ "blueItalia-50": IOColors["blueItalia-50"]
210
210
  };
211
211
 
212
212
  export type IOColorsExtra = keyof typeof IOColorsExtra;
@@ -223,6 +223,13 @@ const themeKeys = [
223
223
  "appBackground-accent",
224
224
  "interactiveElem-default",
225
225
  "interactiveElem-pressed",
226
+ "interactiveElem-disabled",
227
+ "interactiveOutline-disabled",
228
+ "neutralButton-default",
229
+ "neutralButton-pressed",
230
+ "neutralButton-disabled",
231
+ "buttonText-default",
232
+ "buttonText-disabled",
226
233
  "listItem-pressed",
227
234
  // Typography
228
235
  "textHeading-default",
@@ -272,6 +279,13 @@ export const IOThemeLight: IOTheme = {
272
279
  "appBackground-accent": "blueIO-500",
273
280
  "interactiveElem-default": "blueIO-500",
274
281
  "interactiveElem-pressed": "blueIO-600",
282
+ "interactiveElem-disabled": "grey-300",
283
+ "interactiveOutline-disabled": "grey-650",
284
+ "neutralButton-default": "black",
285
+ "neutralButton-pressed": "grey-850",
286
+ "neutralButton-disabled": "grey-450",
287
+ "buttonText-default": "white",
288
+ "buttonText-disabled": "grey-700",
275
289
  "listItem-pressed": "grey-50",
276
290
  // Typography
277
291
  "textHeading-default": "black",
@@ -322,10 +336,17 @@ export const IOThemeDark: IOTheme = {
322
336
  "appBackground-secondary": "grey-850",
323
337
  "appBackground-tertiary": "grey-700",
324
338
  "interactiveElem-default": "blueIO-450",
325
- "interactiveElem-pressed": "blueIO-600",
339
+ "interactiveElem-pressed": "blueIO-500",
340
+ "interactiveElem-disabled": "grey-700",
341
+ "interactiveOutline-disabled": "grey-450",
342
+ "neutralButton-default": "white",
343
+ "neutralButton-pressed": "grey-100",
344
+ "neutralButton-disabled": "grey-850",
345
+ "buttonText-default": "white",
346
+ "buttonText-disabled": "grey-300",
326
347
  "listItem-pressed": "grey-850",
327
348
  // Typography
328
- "textHeading-default": "grey-200",
349
+ "textHeading-default": "white",
329
350
  "textHeading-secondary": "grey-300",
330
351
  "textHeading-tertiary": "grey-450",
331
352
  "textBody-default": "white",