@pagopa/io-app-design-system 4.5.4 → 4.5.5

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 (39) hide show
  1. package/lib/commonjs/components/layout/HeaderSecondLevel.js +3 -2
  2. package/lib/commonjs/components/layout/HeaderSecondLevel.js.map +1 -1
  3. package/lib/commonjs/components/tabs/TabItem.js +66 -74
  4. package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
  5. package/lib/commonjs/components/textInput/TextInputValidation.js +2 -2
  6. package/lib/commonjs/components/textInput/TextInputValidation.js.map +1 -1
  7. package/lib/commonjs/core/IOColors.js +13 -3
  8. package/lib/commonjs/core/IOColors.js.map +1 -1
  9. package/lib/module/components/layout/HeaderSecondLevel.js +3 -2
  10. package/lib/module/components/layout/HeaderSecondLevel.js.map +1 -1
  11. package/lib/module/components/tabs/TabItem.js +69 -78
  12. package/lib/module/components/tabs/TabItem.js.map +1 -1
  13. package/lib/module/components/textInput/TextInputValidation.js +2 -2
  14. package/lib/module/components/textInput/TextInputValidation.js.map +1 -1
  15. package/lib/module/core/IOColors.js +13 -3
  16. package/lib/module/core/IOColors.js.map +1 -1
  17. package/lib/typescript/components/layout/HeaderSecondLevel.d.ts +2 -1
  18. package/lib/typescript/components/layout/HeaderSecondLevel.d.ts.map +1 -1
  19. package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -1
  20. package/lib/typescript/components/typography/BodyMonospace.d.ts +1 -1
  21. package/lib/typescript/components/typography/ButtonText.d.ts +1 -1
  22. package/lib/typescript/components/typography/Caption.d.ts +1 -1
  23. package/lib/typescript/components/typography/H1.d.ts +1 -1
  24. package/lib/typescript/components/typography/H2.d.ts +1 -1
  25. package/lib/typescript/components/typography/H3.d.ts +1 -1
  26. package/lib/typescript/components/typography/H4.d.ts +1 -1
  27. package/lib/typescript/components/typography/H5.d.ts +1 -1
  28. package/lib/typescript/components/typography/H6.d.ts +1 -1
  29. package/lib/typescript/components/typography/Hero.d.ts +1 -1
  30. package/lib/typescript/components/typography/markdown/MdH1.d.ts +1 -1
  31. package/lib/typescript/components/typography/markdown/MdH2.d.ts +1 -1
  32. package/lib/typescript/components/typography/markdown/MdH3.d.ts +1 -1
  33. package/lib/typescript/core/IOColors.d.ts +1 -3
  34. package/lib/typescript/core/IOColors.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/src/components/layout/HeaderSecondLevel.tsx +8 -2
  37. package/src/components/tabs/TabItem.tsx +115 -114
  38. package/src/components/textInput/TextInputValidation.tsx +2 -2
  39. package/src/core/IOColors.ts +17 -3
@@ -8,6 +8,6 @@ export declare const MdH1: React.ForwardRefExoticComponent<Omit<IOTextProps, "st
8
8
  textStyle?: import("../IOText").IOTextStyle | undefined;
9
9
  style?: import("../IOText").IOTextStyle | undefined;
10
10
  } & {
11
- color?: "white" | "grey-50" | "grey-100" | "grey-200" | "grey-300" | "grey-450" | "grey-650" | "grey-700" | "grey-850" | "black" | "blueIO-850" | "blueIO-600" | "blueIO-500" | "blueIO-400" | "blueIO-450" | "blueIO-200" | "blueIO-150" | "blueIO-100" | "blueIO-50" | "hanPurple-850" | "hanPurple-500" | "hanPurple-250" | "hanPurple-100" | "hanPurple-50" | "turquoise-850" | "turquoise-500" | "turquoise-450" | "turquoise-300" | "turquoise-150" | "turquoise-100" | "turquoise-50" | "error-850" | "error-600" | "error-500" | "error-400" | "error-100" | "warning-850" | "warning-700" | "warning-500" | "warning-400" | "warning-100" | "success-850" | "success-700" | "success-500" | "success-400" | "success-100" | "info-850" | "info-700" | "info-500" | "info-400" | "info-100" | "blueItalia-850" | "blueItalia-600" | "blueItalia-500" | "blueItalia-100" | "blueItalia-50" | "blue-600" | "blue-500" | "blue-50" | undefined;
11
+ color?: "white" | "grey-50" | "grey-100" | "grey-200" | "grey-300" | "grey-450" | "grey-650" | "grey-700" | "grey-850" | "black" | "blueIO-850" | "blueIO-600" | "blueIO-500" | "blueIO-400" | "blueIO-200" | "blueIO-150" | "blueIO-100" | "blueIO-50" | "hanPurple-850" | "hanPurple-500" | "hanPurple-250" | "hanPurple-100" | "hanPurple-50" | "turquoise-850" | "turquoise-500" | "turquoise-450" | "turquoise-300" | "turquoise-150" | "turquoise-100" | "turquoise-50" | "error-850" | "error-600" | "error-500" | "error-400" | "error-100" | "warning-850" | "warning-700" | "warning-500" | "warning-400" | "warning-100" | "success-850" | "success-700" | "success-500" | "success-400" | "success-100" | "info-850" | "info-700" | "info-500" | "info-400" | "info-100" | "blueItalia-850" | "blueItalia-600" | "blueItalia-500" | "blueItalia-100" | "blueItalia-50" | "blue-600" | "blue-500" | "blue-50" | undefined;
12
12
  } & React.RefAttributes<View>>;
13
13
  //# sourceMappingURL=MdH1.d.ts.map
@@ -8,6 +8,6 @@ export declare const MdH2: React.ForwardRefExoticComponent<Omit<IOTextProps, "st
8
8
  textStyle?: import("../IOText").IOTextStyle | undefined;
9
9
  style?: import("../IOText").IOTextStyle | undefined;
10
10
  } & {
11
- color?: "white" | "grey-50" | "grey-100" | "grey-200" | "grey-300" | "grey-450" | "grey-650" | "grey-700" | "grey-850" | "black" | "blueIO-850" | "blueIO-600" | "blueIO-500" | "blueIO-400" | "blueIO-450" | "blueIO-200" | "blueIO-150" | "blueIO-100" | "blueIO-50" | "hanPurple-850" | "hanPurple-500" | "hanPurple-250" | "hanPurple-100" | "hanPurple-50" | "turquoise-850" | "turquoise-500" | "turquoise-450" | "turquoise-300" | "turquoise-150" | "turquoise-100" | "turquoise-50" | "error-850" | "error-600" | "error-500" | "error-400" | "error-100" | "warning-850" | "warning-700" | "warning-500" | "warning-400" | "warning-100" | "success-850" | "success-700" | "success-500" | "success-400" | "success-100" | "info-850" | "info-700" | "info-500" | "info-400" | "info-100" | "blueItalia-850" | "blueItalia-600" | "blueItalia-500" | "blueItalia-100" | "blueItalia-50" | "blue-600" | "blue-500" | "blue-50" | undefined;
11
+ color?: "white" | "grey-50" | "grey-100" | "grey-200" | "grey-300" | "grey-450" | "grey-650" | "grey-700" | "grey-850" | "black" | "blueIO-850" | "blueIO-600" | "blueIO-500" | "blueIO-400" | "blueIO-200" | "blueIO-150" | "blueIO-100" | "blueIO-50" | "hanPurple-850" | "hanPurple-500" | "hanPurple-250" | "hanPurple-100" | "hanPurple-50" | "turquoise-850" | "turquoise-500" | "turquoise-450" | "turquoise-300" | "turquoise-150" | "turquoise-100" | "turquoise-50" | "error-850" | "error-600" | "error-500" | "error-400" | "error-100" | "warning-850" | "warning-700" | "warning-500" | "warning-400" | "warning-100" | "success-850" | "success-700" | "success-500" | "success-400" | "success-100" | "info-850" | "info-700" | "info-500" | "info-400" | "info-100" | "blueItalia-850" | "blueItalia-600" | "blueItalia-500" | "blueItalia-100" | "blueItalia-50" | "blue-600" | "blue-500" | "blue-50" | undefined;
12
12
  } & React.RefAttributes<View>>;
13
13
  //# sourceMappingURL=MdH2.d.ts.map
@@ -8,6 +8,6 @@ export declare const MdH3: React.ForwardRefExoticComponent<Omit<IOTextProps, "st
8
8
  textStyle?: import("../IOText").IOTextStyle | undefined;
9
9
  style?: import("../IOText").IOTextStyle | undefined;
10
10
  } & {
11
- color?: "white" | "grey-50" | "grey-100" | "grey-200" | "grey-300" | "grey-450" | "grey-650" | "grey-700" | "grey-850" | "black" | "blueIO-850" | "blueIO-600" | "blueIO-500" | "blueIO-400" | "blueIO-450" | "blueIO-200" | "blueIO-150" | "blueIO-100" | "blueIO-50" | "hanPurple-850" | "hanPurple-500" | "hanPurple-250" | "hanPurple-100" | "hanPurple-50" | "turquoise-850" | "turquoise-500" | "turquoise-450" | "turquoise-300" | "turquoise-150" | "turquoise-100" | "turquoise-50" | "error-850" | "error-600" | "error-500" | "error-400" | "error-100" | "warning-850" | "warning-700" | "warning-500" | "warning-400" | "warning-100" | "success-850" | "success-700" | "success-500" | "success-400" | "success-100" | "info-850" | "info-700" | "info-500" | "info-400" | "info-100" | "blueItalia-850" | "blueItalia-600" | "blueItalia-500" | "blueItalia-100" | "blueItalia-50" | "blue-600" | "blue-500" | "blue-50" | undefined;
11
+ color?: "white" | "grey-50" | "grey-100" | "grey-200" | "grey-300" | "grey-450" | "grey-650" | "grey-700" | "grey-850" | "black" | "blueIO-850" | "blueIO-600" | "blueIO-500" | "blueIO-400" | "blueIO-200" | "blueIO-150" | "blueIO-100" | "blueIO-50" | "hanPurple-850" | "hanPurple-500" | "hanPurple-250" | "hanPurple-100" | "hanPurple-50" | "turquoise-850" | "turquoise-500" | "turquoise-450" | "turquoise-300" | "turquoise-150" | "turquoise-100" | "turquoise-50" | "error-850" | "error-600" | "error-500" | "error-400" | "error-100" | "warning-850" | "warning-700" | "warning-500" | "warning-400" | "warning-100" | "success-850" | "success-700" | "success-500" | "success-400" | "success-100" | "info-850" | "info-700" | "info-500" | "info-400" | "info-100" | "blueItalia-850" | "blueItalia-600" | "blueItalia-500" | "blueItalia-100" | "blueItalia-50" | "blue-600" | "blue-500" | "blue-50" | undefined;
12
12
  } & React.RefAttributes<View>>;
13
13
  //# sourceMappingURL=MdH3.d.ts.map
@@ -16,7 +16,6 @@ export declare const IOColors: {
16
16
  "blueIO-600": string;
17
17
  "blueIO-500": string;
18
18
  "blueIO-400": string;
19
- "blueIO-450": string;
20
19
  "blueIO-200": string;
21
20
  "blueIO-150": string;
22
21
  "blueIO-100": string;
@@ -105,7 +104,6 @@ export declare const IOColorsTints: {
105
104
  "blueIO-850": string;
106
105
  "blueIO-600": string;
107
106
  "blueIO-500": string;
108
- "blueIO-450": string;
109
107
  "blueIO-200": string;
110
108
  "blueIO-150": string;
111
109
  "blueIO-100": string;
@@ -151,7 +149,7 @@ export declare const IOColorsExtra: {
151
149
  "blueItalia-50": string;
152
150
  };
153
151
  export type IOColorsExtra = keyof typeof IOColorsExtra;
154
- declare const themeKeys: readonly ["appBackground-primary", "appBackground-secondary", "appBackground-tertiary", "appBackground-accent", "interactiveElem-default", "interactiveElem-pressed", "interactiveElem-disabled", "interactiveOutline-disabled", "neutralButton-default", "neutralButton-pressed", "neutralButton-disabled", "buttonText-default", "buttonText-disabled", "listItem-pressed", "textHeading-default", "textHeading-secondary", "textHeading-tertiary", "textBody-default", "textBody-secondary", "textBody-tertiary", "cardBorder-default", "textInputBorder-default", "icon-default", "icon-decorative", "textInputBorder-default", "textInputLabel-default", "textInputValue-default", "textInputValue-disabled", "divider-header", "divider-default", "divider-bottomBar", "pdfViewer-background", "errorIcon", "errorText", "successIcon", "successText", "warningIcon", "infoIcon", "pictogram-hands", "pictogram-tint-main", "pictogram-tint-secondary", "pictogram-tint-tertiary"];
152
+ declare const themeKeys: readonly ["appBackground-primary", "appBackground-secondary", "appBackground-tertiary", "appBackground-accent", "interactiveElem-default", "interactiveElem-pressed", "interactiveElem-disabled", "interactiveOutline-disabled", "neutralButton-default", "neutralButton-pressed", "neutralButton-disabled", "buttonText-default", "buttonText-disabled", "listItem-pressed", "textHeading-default", "textHeading-secondary", "textHeading-tertiary", "textBody-default", "textBody-secondary", "textBody-tertiary", "cardBorder-default", "textInputBorder-default", "icon-default", "icon-decorative", "textInputBorder-default", "textInputLabel-default", "textInputValue-default", "textInputValue-disabled", "divider-header", "divider-default", "divider-bottomBar", "pdfViewer-background", "tab-item-border-default", "tab-item-foreground-default", "tab-item-foreground-selected", "tab-item-background-selected", "errorIcon", "errorText", "successIcon", "successText", "warningIcon", "infoIcon", "pictogram-hands", "pictogram-tint-main", "pictogram-tint-secondary", "pictogram-tint-tertiary"];
155
153
  export type IOTheme = {
156
154
  [K in (typeof themeKeys)[number]]: IOColors;
157
155
  };
@@ -1 +1 @@
1
- {"version":3,"file":"IOColors.d.ts","sourceRoot":"","sources":["../../../src/core/IOColors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,cAAc,MAAM,8BAA8B,CAAC;AAyB/D,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-app-design-system",
3
- "version": "4.5.4",
3
+ "version": "4.5.5",
4
4
  "description": "The library defining the core components of the design system of @pagopa/io-app",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -78,6 +78,9 @@ type CommonProps = WithTestID<{
78
78
  variant?: "neutral" | "contrast";
79
79
  backgroundColor?: string;
80
80
  ignoreSafeAreaMargin?: boolean;
81
+ // Prevents screen readers from focusing on the title when other elements are focused
82
+ // (e.g. when an input text is throwing an error)
83
+ ignoreAccessibilityCheck?: boolean;
81
84
  }>;
82
85
 
83
86
  interface Base extends CommonProps {
@@ -151,7 +154,8 @@ export const HeaderSecondLevel = ({
151
154
  testID,
152
155
  firstAction,
153
156
  secondAction,
154
- thirdAction
157
+ thirdAction,
158
+ ignoreAccessibilityCheck = false
155
159
  }: HeaderSecondLevel) => {
156
160
  const scrollOffset = useScrollViewOffset(
157
161
  (animatedRef as AnimatedRef<Animated.ScrollView>) ||
@@ -299,7 +303,9 @@ export const HeaderSecondLevel = ({
299
303
  ref={titleRef}
300
304
  accessibilityElementsHidden={!isTitleAccessible}
301
305
  importantForAccessibility={
302
- isTitleAccessible ? "yes" : "no-hide-descendants"
306
+ isTitleAccessible && !ignoreAccessibilityCheck
307
+ ? "yes"
308
+ : "no-hide-descendants"
303
309
  }
304
310
  accessible={isTitleAccessible}
305
311
  accessibilityLabel={title}
@@ -1,27 +1,29 @@
1
- import React, { useEffect, useMemo } from "react";
1
+ import React, { useCallback, useMemo } from "react";
2
2
  import { GestureResponderEvent, Pressable, StyleSheet } from "react-native";
3
+ import ReactNativeHapticFeedback from "react-native-haptic-feedback";
3
4
  import Animated, {
4
- SharedValue,
5
5
  interpolateColor,
6
6
  useAnimatedStyle,
7
7
  useDerivedValue,
8
8
  useReducedMotion,
9
- useSharedValue,
10
9
  withSpring
11
10
  } from "react-native-reanimated";
12
11
  import {
13
12
  IOColors,
14
13
  IOSpringValues,
15
14
  hexToRgba,
16
- useIOExperimentalDesign
15
+ useIOExperimentalDesign,
16
+ useIOTheme
17
17
  } from "../../core";
18
18
  import { useScaleAnimation } from "../../hooks";
19
19
  import { WithTestID } from "../../utils/types";
20
20
  import { IOIcons, Icon } from "../icons";
21
- import { BodySmall } from "../typography";
21
+ import { IOText } from "../typography";
22
22
 
23
23
  type ColorMode = "light" | "dark";
24
24
 
25
+ type TabItemState = "default" | "selected" | "disabled";
26
+
25
27
  export type TabItem = WithTestID<{
26
28
  label: string;
27
29
  color?: ColorMode;
@@ -42,12 +44,10 @@ type ColorStates = {
42
44
  border: {
43
45
  default: string;
44
46
  selected: string;
45
- disabled: string;
46
47
  };
47
48
  background: {
48
49
  default: string;
49
50
  selected: string;
50
- pressed: string;
51
51
  };
52
52
  foreground: {
53
53
  default: IOColors;
@@ -56,42 +56,7 @@ type ColorStates = {
56
56
  };
57
57
  };
58
58
 
59
- const mapColorStates: Record<NonNullable<TabItem["color"]>, ColorStates> = {
60
- light: {
61
- border: {
62
- default: IOColors["grey-300"],
63
- selected: IOColors["blueIO-500"],
64
- disabled: IOColors["grey-300"]
65
- },
66
- background: {
67
- default: IOColors.white,
68
- selected: IOColors["blueIO-50"],
69
- pressed: IOColors.white
70
- },
71
- foreground: {
72
- default: "black",
73
- selected: "blueIO-500",
74
- disabled: "grey-700"
75
- }
76
- },
77
- dark: {
78
- border: {
79
- default: hexToRgba(IOColors.white, 0),
80
- selected: IOColors.white,
81
- disabled: hexToRgba(IOColors.white, 0.5)
82
- },
83
- background: {
84
- default: hexToRgba(IOColors.white, 0),
85
- selected: IOColors.white,
86
- pressed: IOColors.white
87
- },
88
- foreground: {
89
- default: "white",
90
- selected: "black",
91
- disabled: "white"
92
- }
93
- }
94
- };
59
+ const DISABLED_OPACITY = 0.5;
95
60
 
96
61
  const mapLegacyColorStates: Record<
97
62
  NonNullable<TabItem["color"]>,
@@ -99,14 +64,12 @@ const mapLegacyColorStates: Record<
99
64
  > = {
100
65
  light: {
101
66
  border: {
102
- default: IOColors["grey-300"],
103
- selected: IOColors["blue-500"],
104
- disabled: hexToRgba(IOColors.white)
67
+ default: IOColors["grey-450"],
68
+ selected: IOColors["blue-500"]
105
69
  },
106
70
  background: {
107
71
  default: IOColors.white,
108
- selected: hexToRgba(IOColors["blue-500"], 0.1),
109
- pressed: IOColors.white
72
+ selected: hexToRgba(IOColors["blue-500"], 0.1)
110
73
  },
111
74
  foreground: {
112
75
  default: "black",
@@ -117,13 +80,11 @@ const mapLegacyColorStates: Record<
117
80
  dark: {
118
81
  border: {
119
82
  default: hexToRgba(IOColors.white, 0),
120
- selected: IOColors.white,
121
- disabled: hexToRgba(IOColors.white, 0.5)
83
+ selected: IOColors.white
122
84
  },
123
85
  background: {
124
- default: "#ffffff00",
125
- selected: IOColors.white,
126
- pressed: IOColors.white
86
+ default: hexToRgba(IOColors.white, 0.1),
87
+ selected: IOColors.white
127
88
  },
128
89
  foreground: {
129
90
  default: "white",
@@ -146,77 +107,113 @@ const TabItem = ({
146
107
  icon,
147
108
  iconSelected
148
109
  }: TabItem) => {
149
- const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
150
- useScaleAnimation();
110
+ const { onPressIn, onPressOut, scaleAnimatedStyle } =
111
+ useScaleAnimation("medium");
112
+ const theme = useIOTheme();
151
113
  const reducedMotion = useReducedMotion();
152
114
 
153
115
  const { isExperimental } = useIOExperimentalDesign();
154
- const colors = useMemo(
155
- () =>
156
- isExperimental ? mapColorStates[color] : mapLegacyColorStates[color],
157
- [isExperimental, color]
158
- );
159
116
 
160
- const foregroundColor = useMemo(
161
- () =>
162
- colors.foreground[
163
- selected ? "selected" : disabled ? "disabled" : "default"
164
- ],
165
- [colors.foreground, selected, disabled]
117
+ const mapColorStates: Record<
118
+ NonNullable<TabItem["color"]>,
119
+ ColorStates
120
+ > = useMemo(
121
+ () => ({
122
+ light: {
123
+ border: {
124
+ default: IOColors[theme["tab-item-border-default"]],
125
+ selected: hexToRgba(
126
+ IOColors[theme["tab-item-foreground-selected"]],
127
+ 0.5
128
+ )
129
+ },
130
+ background: {
131
+ default: hexToRgba(
132
+ IOColors[theme["tab-item-background-selected"]],
133
+ 0
134
+ ),
135
+ selected: hexToRgba(
136
+ IOColors[theme["tab-item-background-selected"]],
137
+ 0.25
138
+ ),
139
+ pressed: IOColors[theme["appBackground-primary"]]
140
+ },
141
+ foreground: {
142
+ default: theme["tab-item-foreground-default"],
143
+ selected: theme["tab-item-foreground-selected"],
144
+ disabled: "grey-700"
145
+ }
146
+ },
147
+ dark: {
148
+ border: {
149
+ default: hexToRgba(IOColors.white, 0),
150
+ selected: IOColors.white
151
+ },
152
+ background: {
153
+ default: hexToRgba(IOColors.white, 0.1),
154
+ selected: IOColors.white,
155
+ pressed: IOColors.white
156
+ },
157
+ foreground: {
158
+ default: "white",
159
+ selected: "black",
160
+ disabled: "white"
161
+ }
162
+ }
163
+ }),
164
+ [theme]
166
165
  );
167
166
 
168
- const borderColor = useMemo(
167
+ const colors = useMemo(
169
168
  () =>
170
- colors.border[selected ? "selected" : disabled ? "disabled" : "default"],
171
- [colors.border, selected, disabled]
169
+ isExperimental ? mapColorStates[color] : mapLegacyColorStates[color],
170
+ [isExperimental, mapColorStates, color]
172
171
  );
173
172
 
174
- const opaquePressedBackgroundColor = hexToRgba(
175
- colors.background.pressed,
176
- 0.1
177
- );
173
+ const itemState: TabItemState = selected
174
+ ? "selected"
175
+ : disabled
176
+ ? "disabled"
177
+ : "default";
178
178
 
179
- const isSelected: SharedValue<number> = useSharedValue(0);
180
- const progressSelected = useDerivedValue(() =>
181
- withSpring(isSelected.value, IOSpringValues.selection)
179
+ const foregroundColor = useMemo(
180
+ () => colors.foreground[itemState],
181
+ [colors.foreground, itemState]
182
182
  );
183
183
 
184
- useEffect(() => {
185
- // eslint-disable-next-line functional/immutable-data
186
- isSelected.value = selected ? 1 : 0;
187
- }, [isSelected, selected]);
184
+ const selectedStateTransition = useDerivedValue(() =>
185
+ withSpring(selected ? 1 : 0, IOSpringValues.selection)
186
+ );
188
187
 
189
188
  // Interpolate animation values from `pressed` values
190
- const animatedStyle = useAnimatedStyle(() => {
191
- // Link color states to the pressed states
192
- const pressedBackgroundColor = interpolateColor(
193
- progress.value,
194
- [0, 1],
195
- [colors.background.default, opaquePressedBackgroundColor]
196
- );
197
-
198
- const selectedBackgroundColor = interpolateColor(
199
- progressSelected.value,
200
- [0, 1],
201
- [opaquePressedBackgroundColor, colors.background.selected]
202
- );
203
-
204
- const selectedBorderColor = interpolateColor(
205
- progressSelected.value,
206
- [0, 1],
207
- [colors.border.default, colors.border.selected]
208
- );
209
-
210
- return {
211
- backgroundColor: selected
212
- ? selectedBackgroundColor
213
- : pressedBackgroundColor,
214
- borderColor: selected ? selectedBorderColor : borderColor
215
- };
216
- }, [progress, progressSelected, selected]);
189
+ const animatedStyle = useAnimatedStyle(
190
+ () => ({
191
+ backgroundColor: interpolateColor(
192
+ selectedStateTransition.value,
193
+ [0, 1],
194
+ [colors.background.default, colors.background.selected]
195
+ ),
196
+ borderColor: interpolateColor(
197
+ selectedStateTransition.value,
198
+ [0, 1],
199
+ [colors.border.default, colors.border.selected]
200
+ )
201
+ }),
202
+ [selectedStateTransition]
203
+ );
217
204
 
218
205
  const activeIcon = selected ? iconSelected ?? icon : icon;
219
206
 
207
+ const handleOnPress = useCallback(
208
+ (event: GestureResponderEvent) => {
209
+ if (onPress) {
210
+ ReactNativeHapticFeedback.trigger("impactLight");
211
+ onPress(event);
212
+ }
213
+ },
214
+ [onPress]
215
+ );
216
+
220
217
  return (
221
218
  <Pressable
222
219
  accessibilityLabel={accessibilityLabel}
@@ -224,7 +221,7 @@ const TabItem = ({
224
221
  accessibilityRole={"button"}
225
222
  accessibilityState={{ selected }}
226
223
  testID={testID}
227
- onPress={onPress}
224
+ onPress={handleOnPress}
228
225
  onPressIn={onPressIn}
229
226
  onPressOut={onPressOut}
230
227
  accessible={true}
@@ -234,18 +231,23 @@ const TabItem = ({
234
231
  style={[
235
232
  styles.container,
236
233
  { columnGap: 4 },
237
- !reducedMotion && scaleAnimatedStyle,
234
+ !disabled && !reducedMotion && scaleAnimatedStyle,
238
235
  animatedStyle,
239
236
  fullWidth && styles.fullWidth,
240
- disabled && styles.disabled
237
+ disabled && { opacity: DISABLED_OPACITY }
241
238
  ]}
242
239
  >
243
240
  {activeIcon && (
244
241
  <Icon name={activeIcon} color={foregroundColor} size={16} />
245
242
  )}
246
- <BodySmall weight="Semibold" color={foregroundColor}>
243
+ <IOText
244
+ size={14}
245
+ font={isExperimental ? "Titillio" : "TitilliumSansPro"}
246
+ weight="Semibold"
247
+ color={foregroundColor}
248
+ >
247
249
  {label}
248
- </BodySmall>
250
+ </IOText>
249
251
  </Animated.View>
250
252
  </Pressable>
251
253
  );
@@ -265,8 +267,7 @@ const styles = StyleSheet.create({
265
267
  },
266
268
  fullWidth: {
267
269
  alignSelf: "auto"
268
- },
269
- disabled: { opacity: 0.5 }
270
+ }
270
271
  });
271
272
 
272
273
  export { TabItem };
@@ -86,12 +86,12 @@ export const TextInputValidation = ({
86
86
  }, [onFocus]);
87
87
 
88
88
  const labelError = useMemo(
89
- () => (!isValid && errMessage ? errMessage : bottomMessage),
89
+ () => (isValid === false && errMessage ? errMessage : bottomMessage),
90
90
  [isValid, errMessage, bottomMessage]
91
91
  );
92
92
 
93
93
  const labelErrorColor: IOColors | undefined = useMemo(
94
- () => (!isValid && errMessage ? theme.errorText : undefined),
94
+ () => (isValid === false && errMessage ? theme.errorText : undefined),
95
95
  [isValid, errMessage, theme.errorText]
96
96
  );
97
97
 
@@ -40,7 +40,6 @@ export const IOColors = asIOColors({
40
40
  "blueIO-600": "#0932B6",
41
41
  "blueIO-500": "#0B3EE3",
42
42
  "blueIO-400": "#3C65E9",
43
- "blueIO-450": "#2351E6" /* Dark mode */,
44
43
  "blueIO-200": "#9DB2F4",
45
44
  "blueIO-150": "#B6C5F7",
46
45
  "blueIO-100": "#CED8F9",
@@ -153,7 +152,6 @@ export const IOColorsTints = asIOColors({
153
152
  "blueIO-850": IOColors["blueIO-850"],
154
153
  "blueIO-600": IOColors["blueIO-600"],
155
154
  "blueIO-500": IOColors["blueIO-500"],
156
- "blueIO-450": IOColors["blueIO-450"],
157
155
  "blueIO-200": IOColors["blueIO-200"],
158
156
  "blueIO-150": IOColors["blueIO-150"],
159
157
  "blueIO-100": IOColors["blueIO-100"],
@@ -253,6 +251,12 @@ const themeKeys = [
253
251
  "divider-default",
254
252
  "divider-bottomBar",
255
253
  "pdfViewer-background",
254
+ // Tab Item
255
+ "tab-item-border-default",
256
+ "tab-item-foreground-default",
257
+ "tab-item-foreground-selected",
258
+ "tab-item-background-selected",
259
+
256
260
  // Status
257
261
  "errorIcon",
258
262
  "errorText",
@@ -308,6 +312,11 @@ export const IOThemeLight: IOTheme = {
308
312
  "divider-default": "grey-200",
309
313
  "divider-bottomBar": "grey-200",
310
314
  "pdfViewer-background": "grey-700",
315
+ // Tab Item
316
+ "tab-item-border-default": "grey-300",
317
+ "tab-item-foreground-default": "black",
318
+ "tab-item-foreground-selected": "blueIO-500",
319
+ "tab-item-background-selected": "blueIO-200",
311
320
  // Status
312
321
  errorIcon: "error-600",
313
322
  errorText: "error-600",
@@ -335,7 +344,7 @@ export const IOThemeDark: IOTheme = {
335
344
  "appBackground-primary": "black",
336
345
  "appBackground-secondary": "grey-850",
337
346
  "appBackground-tertiary": "grey-700",
338
- "interactiveElem-default": "blueIO-450",
347
+ "interactiveElem-default": "blueIO-400",
339
348
  "interactiveElem-pressed": "blueIO-500",
340
349
  "interactiveElem-disabled": "grey-700",
341
350
  "interactiveOutline-disabled": "grey-450",
@@ -361,6 +370,11 @@ export const IOThemeDark: IOTheme = {
361
370
  "textInputLabel-default": "grey-450",
362
371
  "textInputValue-default": "white",
363
372
  "textInputValue-disabled": "grey-100",
373
+ // Tab Item
374
+ "tab-item-border-default": "grey-700",
375
+ "tab-item-foreground-default": "grey-200",
376
+ "tab-item-foreground-selected": "blueIO-200",
377
+ "tab-item-background-selected": "blueIO-400",
364
378
  // Layout
365
379
  "divider-header": "grey-850",
366
380
  "divider-default": "grey-850",