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

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 (122) hide show
  1. package/lib/commonjs/components/banner/Banner.js +3 -2
  2. package/lib/commonjs/components/banner/Banner.js.map +1 -1
  3. package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +56 -0
  4. package/lib/commonjs/components/buttons/ButtonLink.js +1 -1
  5. package/lib/commonjs/components/buttons/ButtonSolid.js +1 -1
  6. package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
  7. package/lib/commonjs/components/checkbox/AnimatedCheckbox.js +8 -5
  8. package/lib/commonjs/components/checkbox/AnimatedCheckbox.js.map +1 -1
  9. package/lib/commonjs/components/checkbox/AnimatedMessageCheckbox.js +4 -2
  10. package/lib/commonjs/components/checkbox/AnimatedMessageCheckbox.js.map +1 -1
  11. package/lib/commonjs/components/layout/HeaderSecondLevel.js +3 -2
  12. package/lib/commonjs/components/layout/HeaderSecondLevel.js.map +1 -1
  13. package/lib/commonjs/components/listitems/ListItemCheckbox.js +1 -1
  14. package/lib/commonjs/components/listitems/ListItemCheckbox.js.map +1 -1
  15. package/lib/commonjs/components/listitems/ListItemRadio.js +1 -1
  16. package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -1
  17. package/lib/commonjs/components/listitems/ListItemSwitch.js +1 -1
  18. package/lib/commonjs/components/listitems/ListItemSwitch.js.map +1 -1
  19. package/lib/commonjs/components/radio/AnimatedRadio.js +8 -5
  20. package/lib/commonjs/components/radio/AnimatedRadio.js.map +1 -1
  21. package/lib/commonjs/components/switch/NativeSwitch.js +5 -5
  22. package/lib/commonjs/components/switch/NativeSwitch.js.map +1 -1
  23. package/lib/commonjs/components/switch/index.js +0 -22
  24. package/lib/commonjs/components/switch/index.js.map +1 -1
  25. package/lib/commonjs/components/tabs/TabItem.js +66 -74
  26. package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
  27. package/lib/commonjs/components/textInput/TextInputValidation.js +2 -2
  28. package/lib/commonjs/components/textInput/TextInputValidation.js.map +1 -1
  29. package/lib/commonjs/core/IOColors.js +39 -7
  30. package/lib/commonjs/core/IOColors.js.map +1 -1
  31. package/lib/commonjs/core/IOStyles.js +2 -16
  32. package/lib/commonjs/core/IOStyles.js.map +1 -1
  33. package/lib/module/components/banner/Banner.js +3 -2
  34. package/lib/module/components/banner/Banner.js.map +1 -1
  35. package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +56 -0
  36. package/lib/module/components/buttons/ButtonLink.js +1 -1
  37. package/lib/module/components/buttons/ButtonSolid.js +1 -1
  38. package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
  39. package/lib/module/components/checkbox/AnimatedCheckbox.js +9 -6
  40. package/lib/module/components/checkbox/AnimatedCheckbox.js.map +1 -1
  41. package/lib/module/components/checkbox/AnimatedMessageCheckbox.js +6 -4
  42. package/lib/module/components/checkbox/AnimatedMessageCheckbox.js.map +1 -1
  43. package/lib/module/components/layout/HeaderSecondLevel.js +3 -2
  44. package/lib/module/components/layout/HeaderSecondLevel.js.map +1 -1
  45. package/lib/module/components/listitems/ListItemCheckbox.js +1 -1
  46. package/lib/module/components/listitems/ListItemCheckbox.js.map +1 -1
  47. package/lib/module/components/listitems/ListItemRadio.js +1 -1
  48. package/lib/module/components/listitems/ListItemRadio.js.map +1 -1
  49. package/lib/module/components/listitems/ListItemSwitch.js +1 -1
  50. package/lib/module/components/listitems/ListItemSwitch.js.map +1 -1
  51. package/lib/module/components/radio/AnimatedRadio.js +9 -6
  52. package/lib/module/components/radio/AnimatedRadio.js.map +1 -1
  53. package/lib/module/components/switch/NativeSwitch.js +6 -6
  54. package/lib/module/components/switch/NativeSwitch.js.map +1 -1
  55. package/lib/module/components/switch/index.js +0 -2
  56. package/lib/module/components/switch/index.js.map +1 -1
  57. package/lib/module/components/tabs/TabItem.js +69 -78
  58. package/lib/module/components/tabs/TabItem.js.map +1 -1
  59. package/lib/module/components/textInput/TextInputValidation.js +2 -2
  60. package/lib/module/components/textInput/TextInputValidation.js.map +1 -1
  61. package/lib/module/core/IOColors.js +39 -7
  62. package/lib/module/core/IOColors.js.map +1 -1
  63. package/lib/module/core/IOStyles.js +1 -14
  64. package/lib/module/core/IOStyles.js.map +1 -1
  65. package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
  66. package/lib/typescript/components/checkbox/AnimatedCheckbox.d.ts.map +1 -1
  67. package/lib/typescript/components/checkbox/AnimatedMessageCheckbox.d.ts.map +1 -1
  68. package/lib/typescript/components/layout/HeaderSecondLevel.d.ts +2 -1
  69. package/lib/typescript/components/layout/HeaderSecondLevel.d.ts.map +1 -1
  70. package/lib/typescript/components/switch/NativeSwitch.d.ts.map +1 -1
  71. package/lib/typescript/components/switch/index.d.ts +0 -2
  72. package/lib/typescript/components/switch/index.d.ts.map +1 -1
  73. package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -1
  74. package/lib/typescript/components/typography/BodyMonospace.d.ts +1 -1
  75. package/lib/typescript/components/typography/ButtonText.d.ts +1 -1
  76. package/lib/typescript/components/typography/Caption.d.ts +1 -1
  77. package/lib/typescript/components/typography/H1.d.ts +1 -1
  78. package/lib/typescript/components/typography/H2.d.ts +1 -1
  79. package/lib/typescript/components/typography/H3.d.ts +1 -1
  80. package/lib/typescript/components/typography/H4.d.ts +1 -1
  81. package/lib/typescript/components/typography/H5.d.ts +1 -1
  82. package/lib/typescript/components/typography/H6.d.ts +1 -1
  83. package/lib/typescript/components/typography/Hero.d.ts +1 -1
  84. package/lib/typescript/components/typography/markdown/MdH1.d.ts +1 -1
  85. package/lib/typescript/components/typography/markdown/MdH2.d.ts +1 -1
  86. package/lib/typescript/components/typography/markdown/MdH3.d.ts +1 -1
  87. package/lib/typescript/core/IOColors.d.ts +4 -3
  88. package/lib/typescript/core/IOColors.d.ts.map +1 -1
  89. package/lib/typescript/core/IOStyles.d.ts +0 -13
  90. package/lib/typescript/core/IOStyles.d.ts.map +1 -1
  91. package/package.json +1 -1
  92. package/src/components/banner/Banner.tsx +3 -2
  93. package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +56 -0
  94. package/src/components/buttons/ButtonLink.tsx +1 -1
  95. package/src/components/buttons/ButtonSolid.tsx +1 -1
  96. package/src/components/checkbox/AnimatedCheckbox.tsx +9 -10
  97. package/src/components/checkbox/AnimatedMessageCheckbox.tsx +5 -5
  98. package/src/components/layout/HeaderSecondLevel.tsx +8 -2
  99. package/src/components/listitems/ListItemCheckbox.tsx +1 -1
  100. package/src/components/listitems/ListItemRadio.tsx +1 -1
  101. package/src/components/listitems/ListItemSwitch.tsx +1 -1
  102. package/src/components/radio/AnimatedRadio.tsx +10 -10
  103. package/src/components/switch/NativeSwitch.tsx +6 -6
  104. package/src/components/switch/index.tsx +0 -2
  105. package/src/components/tabs/TabItem.tsx +115 -114
  106. package/src/components/textInput/TextInputValidation.tsx +2 -2
  107. package/src/core/IOColors.ts +48 -6
  108. package/src/core/IOStyles.ts +1 -28
  109. package/lib/commonjs/components/switch/AnimatedSwitch.js +0 -94
  110. package/lib/commonjs/components/switch/AnimatedSwitch.js.map +0 -1
  111. package/lib/commonjs/components/switch/SwitchLabel.js +0 -76
  112. package/lib/commonjs/components/switch/SwitchLabel.js.map +0 -1
  113. package/lib/module/components/switch/AnimatedSwitch.js +0 -85
  114. package/lib/module/components/switch/AnimatedSwitch.js.map +0 -1
  115. package/lib/module/components/switch/SwitchLabel.js +0 -68
  116. package/lib/module/components/switch/SwitchLabel.js.map +0 -1
  117. package/lib/typescript/components/switch/AnimatedSwitch.d.ts +0 -13
  118. package/lib/typescript/components/switch/AnimatedSwitch.d.ts.map +0 -1
  119. package/lib/typescript/components/switch/SwitchLabel.d.ts +0 -18
  120. package/lib/typescript/components/switch/SwitchLabel.d.ts.map +0 -1
  121. package/src/components/switch/AnimatedSwitch.tsx +0 -126
  122. package/src/components/switch/SwitchLabel.tsx +0 -80
@@ -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,7 @@ 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 */,
43
+ "blueIO-300": "#6D8BEE",
44
44
  "blueIO-200": "#9DB2F4",
45
45
  "blueIO-150": "#B6C5F7",
46
46
  "blueIO-100": "#CED8F9",
@@ -153,7 +153,8 @@ export const IOColorsTints = asIOColors({
153
153
  "blueIO-850": IOColors["blueIO-850"],
154
154
  "blueIO-600": IOColors["blueIO-600"],
155
155
  "blueIO-500": IOColors["blueIO-500"],
156
- "blueIO-450": IOColors["blueIO-450"],
156
+ "blueIO-400": IOColors["blueIO-400"],
157
+ "blueIO-300": IOColors["blueIO-300"],
157
158
  "blueIO-200": IOColors["blueIO-200"],
158
159
  "blueIO-150": IOColors["blueIO-150"],
159
160
  "blueIO-100": IOColors["blueIO-100"],
@@ -229,6 +230,7 @@ const themeKeys = [
229
230
  "neutralButton-pressed",
230
231
  "neutralButton-disabled",
231
232
  "buttonText-default",
233
+ "buttonText-danger",
232
234
  "buttonText-disabled",
233
235
  "listItem-pressed",
234
236
  // Typography
@@ -248,11 +250,24 @@ const themeKeys = [
248
250
  "textInputLabel-default",
249
251
  "textInputValue-default",
250
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",
251
260
  // Layout
252
261
  "divider-header",
253
262
  "divider-default",
254
263
  "divider-bottomBar",
255
264
  "pdfViewer-background",
265
+ // Tab Item
266
+ "tab-item-border-default",
267
+ "tab-item-foreground-default",
268
+ "tab-item-foreground-selected",
269
+ "tab-item-background-selected",
270
+
256
271
  // Status
257
272
  "errorIcon",
258
273
  "errorText",
@@ -285,6 +300,7 @@ export const IOThemeLight: IOTheme = {
285
300
  "neutralButton-pressed": "grey-850",
286
301
  "neutralButton-disabled": "grey-450",
287
302
  "buttonText-default": "white",
303
+ "buttonText-danger": "white",
288
304
  "buttonText-disabled": "grey-700",
289
305
  "listItem-pressed": "grey-50",
290
306
  // Typography
@@ -303,11 +319,23 @@ export const IOThemeLight: IOTheme = {
303
319
  "textInputLabel-default": "grey-700",
304
320
  "textInputValue-default": "black",
305
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",
306
329
  // Layout
307
330
  "divider-header": "grey-100",
308
331
  "divider-default": "grey-200",
309
332
  "divider-bottomBar": "grey-200",
310
333
  "pdfViewer-background": "grey-700",
334
+ // Tab Item
335
+ "tab-item-border-default": "grey-300",
336
+ "tab-item-foreground-default": "black",
337
+ "tab-item-foreground-selected": "blueIO-500",
338
+ "tab-item-background-selected": "blueIO-200",
311
339
  // Status
312
340
  errorIcon: "error-600",
313
341
  errorText: "error-600",
@@ -326,7 +354,8 @@ export const IOThemeLightLegacy: IOTheme = {
326
354
  ...IOThemeLight,
327
355
  "appBackground-accent": "blue-500",
328
356
  "interactiveElem-default": "blue-500",
329
- "pictogram-hands": "blue-500"
357
+ "pictogram-hands": "blue-500",
358
+ "selection-tick": "white"
330
359
  };
331
360
 
332
361
  export const IOThemeDark: IOTheme = {
@@ -335,14 +364,15 @@ export const IOThemeDark: IOTheme = {
335
364
  "appBackground-primary": "black",
336
365
  "appBackground-secondary": "grey-850",
337
366
  "appBackground-tertiary": "grey-700",
338
- "interactiveElem-default": "blueIO-450",
339
- "interactiveElem-pressed": "blueIO-500",
367
+ "interactiveElem-default": "blueIO-300",
368
+ "interactiveElem-pressed": "blueIO-400",
340
369
  "interactiveElem-disabled": "grey-700",
341
370
  "interactiveOutline-disabled": "grey-450",
342
371
  "neutralButton-default": "white",
343
372
  "neutralButton-pressed": "grey-100",
344
373
  "neutralButton-disabled": "grey-850",
345
- "buttonText-default": "white",
374
+ "buttonText-default": "black",
375
+ "buttonText-danger": "white",
346
376
  "buttonText-disabled": "grey-300",
347
377
  "listItem-pressed": "grey-850",
348
378
  // Typography
@@ -361,6 +391,18 @@ export const IOThemeDark: IOTheme = {
361
391
  "textInputLabel-default": "grey-450",
362
392
  "textInputValue-default": "white",
363
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",
401
+ // Tab Item
402
+ "tab-item-border-default": "grey-700",
403
+ "tab-item-foreground-default": "grey-200",
404
+ "tab-item-foreground-selected": "blueIO-200",
405
+ "tab-item-background-selected": "blueIO-400",
364
406
  // Layout
365
407
  "divider-header": "grey-850",
366
408
  "divider-default": "grey-850",
@@ -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 =
@@ -1,94 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.AnimatedSwitch = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactNative = require("react-native");
9
- var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
10
- var _IOAnimations = require("../../core/IOAnimations");
11
- var _IOColors = require("../../core/IOColors");
12
- var _IOStyles = require("../../core/IOStyles");
13
- var _AnimatedTick = require("../common/AnimatedTick");
14
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
- const SWITCH_CIRCLE_SIZE = _IOStyles.IOSwitchVisualParams.height - _IOStyles.IOSwitchVisualParams.padding * 2;
17
- const styles = _reactNative.StyleSheet.create({
18
- switchWrapper: {
19
- width: _IOStyles.IOSwitchVisualParams.width,
20
- height: _IOStyles.IOSwitchVisualParams.height
21
- },
22
- switchBackground: {
23
- position: "absolute",
24
- left: 0,
25
- top: 0,
26
- width: "100%",
27
- height: "100%",
28
- borderRadius: _IOStyles.IOSwitchVisualParams.width,
29
- backgroundColor: _IOColors.IOColors[_IOStyles.IOSwitchVisualParams.bgColorOffState]
30
- },
31
- switchCircle: {
32
- position: "absolute",
33
- left: _IOStyles.IOSwitchVisualParams.padding,
34
- top: _IOStyles.IOSwitchVisualParams.padding,
35
- backgroundColor: _IOColors.IOColors[_IOStyles.IOSwitchVisualParams.bgCircle],
36
- width: SWITCH_CIRCLE_SIZE,
37
- height: SWITCH_CIRCLE_SIZE,
38
- borderRadius: _IOStyles.IOSwitchVisualParams.width
39
- }
40
- });
41
-
42
- /**
43
- * An animated checkbox. This can be used to implement a
44
- * standard {@link CheckBox} or other composite components.
45
- */
46
- const AnimatedSwitch = ({
47
- checked,
48
- onPress,
49
- disabled
50
- }) => {
51
- const squareAnimationProgress = (0, _reactNativeReanimated.useSharedValue)(checked ? 1 : 0);
52
- const tickAnimationProgress = (0, _reactNativeReanimated.useSharedValue)(checked ? 1 : 0);
53
- (0, _react.useEffect)(() => {
54
- // eslint-disable-next-line functional/immutable-data
55
- squareAnimationProgress.value = (0, _reactNativeReanimated.withSpring)(checked ? 1 : 0, _IOAnimations.IOSpringValues.selection);
56
- // eslint-disable-next-line functional/immutable-data
57
- tickAnimationProgress.value = (0, _reactNativeReanimated.withTiming)(checked ? 1 : 0, {
58
- duration: 400,
59
- easing: _reactNativeReanimated.Easing.elastic(1)
60
- });
61
- }, [checked, squareAnimationProgress, tickAnimationProgress]);
62
- const animatedSwitchBg = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
63
- backgroundColor: (0, _reactNativeReanimated.interpolateColor)(squareAnimationProgress.value, [0, 1], [_IOColors.IOColors[_IOStyles.IOSwitchVisualParams.bgColorOffState], _IOColors.IOColors[_IOStyles.IOSwitchVisualParams.bgColorOnState]])
64
- }), [squareAnimationProgress]);
65
- const animatedSwitchCircle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
66
- const translateX = (0, _reactNativeReanimated.interpolate)(squareAnimationProgress.value, [0, 1], [0, _IOStyles.IOSwitchVisualParams.width - SWITCH_CIRCLE_SIZE - 2 * _IOStyles.IOSwitchVisualParams.padding]);
67
- return {
68
- transform: [{
69
- translateX
70
- }]
71
- };
72
- });
73
- const animatedSwitchTick = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
74
- opacity: tickAnimationProgress.value
75
- }));
76
- return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
77
- accessibilityRole: "switch",
78
- disabled: disabled,
79
- testID: "AnimatedSwitch",
80
- onPress: onPress,
81
- style: styles.switchWrapper
82
- }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
83
- style: [styles.switchBackground, animatedSwitchBg]
84
- }), /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
85
- style: [styles.switchCircle, animatedSwitchCircle]
86
- }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
87
- style: animatedSwitchTick
88
- }, /*#__PURE__*/_react.default.createElement(_AnimatedTick.AnimatedTick, {
89
- progress: tickAnimationProgress,
90
- stroke: _IOColors.IOColors[_IOStyles.IOSwitchVisualParams.tickColor]
91
- }))));
92
- };
93
- exports.AnimatedSwitch = AnimatedSwitch;
94
- //# sourceMappingURL=AnimatedSwitch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_IOAnimations","_IOColors","_IOStyles","_AnimatedTick","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","SWITCH_CIRCLE_SIZE","IOSwitchVisualParams","height","padding","styles","StyleSheet","create","switchWrapper","width","switchBackground","position","left","top","borderRadius","backgroundColor","IOColors","bgColorOffState","switchCircle","bgCircle","AnimatedSwitch","checked","onPress","disabled","squareAnimationProgress","useSharedValue","tickAnimationProgress","useEffect","value","withSpring","IOSpringValues","selection","withTiming","duration","easing","Easing","elastic","animatedSwitchBg","useAnimatedStyle","interpolateColor","bgColorOnState","animatedSwitchCircle","translateX","interpolate","transform","animatedSwitchTick","opacity","createElement","Pressable","accessibilityRole","testID","style","View","AnimatedTick","progress","stroke","tickColor","exports"],"sourceRoot":"../../../../src","sources":["components/switch/AnimatedSwitch.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AASA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAAsD,SAAAO,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAT,wBAAAa,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SA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