@pagopa/io-app-design-system 1.2.0 → 1.3.1

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 (161) hide show
  1. package/lib/commonjs/components/accordion/RawAccordion.js.map +1 -1
  2. package/lib/commonjs/components/alert/Alert.js.map +1 -1
  3. package/lib/commonjs/components/avatar/__test__/avatar.test.js.map +1 -1
  4. package/lib/commonjs/components/badge/Badge.js.map +1 -1
  5. package/lib/commonjs/components/banner/Banner.js +1 -1
  6. package/lib/commonjs/components/banner/Banner.js.map +1 -1
  7. package/lib/commonjs/components/banner/__test__/banner.test.js.map +1 -1
  8. package/lib/commonjs/components/buttons/ButtonExtendedOutline.js.map +1 -1
  9. package/lib/commonjs/components/buttons/ButtonOutline.js +3 -3
  10. package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
  11. package/lib/commonjs/components/buttons/ButtonSolid.js +3 -3
  12. package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
  13. package/lib/commonjs/components/contentWrapper/ContentWrapper.js.map +1 -1
  14. package/lib/commonjs/components/listitems/ListItemAction.js.map +1 -1
  15. package/lib/commonjs/components/listitems/ListItemIDP.js.map +1 -1
  16. package/lib/commonjs/components/listitems/ListItemNavAlert.js.map +1 -1
  17. package/lib/commonjs/components/listitems/ListItemTransaction.js.map +1 -1
  18. package/lib/commonjs/components/listitems/PressableListItemsBase.js.map +1 -1
  19. package/lib/commonjs/components/listitems/__test__/listitem.test.js.map +1 -1
  20. package/lib/commonjs/components/listitems/hooks/useListItemSpringAnimation.js.map +1 -1
  21. package/lib/commonjs/components/pictograms/Pictogram.js +7 -3
  22. package/lib/commonjs/components/pictograms/Pictogram.js.map +1 -1
  23. package/lib/commonjs/components/pictograms/svg/PictogramFocusOn.js +56 -0
  24. package/lib/commonjs/components/pictograms/svg/PictogramFocusOn.js.map +1 -0
  25. package/lib/commonjs/components/pictograms/svg/originals/PictogramFocusOn.svg +19 -0
  26. package/lib/commonjs/components/spacer/Spacer.js.map +1 -1
  27. package/lib/commonjs/components/typography/Body.js.map +1 -1
  28. package/lib/commonjs/components/typography/Factory.js.map +1 -1
  29. package/lib/commonjs/components/typography/H1.js.map +1 -1
  30. package/lib/commonjs/components/typography/H2.js.map +1 -1
  31. package/lib/commonjs/components/typography/H4.js.map +1 -1
  32. package/lib/commonjs/components/typography/H5.js.map +1 -1
  33. package/lib/commonjs/components/typography/H6.js.map +1 -1
  34. package/lib/commonjs/components/typography/Label.js.map +1 -1
  35. package/lib/commonjs/components/typography/LabelSmall.js.map +1 -1
  36. package/lib/commonjs/components/typography/Monospace.js.map +1 -1
  37. package/lib/commonjs/components/typography/common.js +2 -2
  38. package/lib/commonjs/components/typography/common.js.map +1 -1
  39. package/lib/commonjs/utils/image.js.map +1 -1
  40. package/lib/module/components/accordion/RawAccordion.js.map +1 -1
  41. package/lib/module/components/alert/Alert.js.map +1 -1
  42. package/lib/module/components/avatar/__test__/avatar.test.js.map +1 -1
  43. package/lib/module/components/badge/Badge.js.map +1 -1
  44. package/lib/module/components/banner/Banner.js +1 -1
  45. package/lib/module/components/banner/Banner.js.map +1 -1
  46. package/lib/module/components/banner/__test__/banner.test.js.map +1 -1
  47. package/lib/module/components/buttons/ButtonExtendedOutline.js.map +1 -1
  48. package/lib/module/components/buttons/ButtonOutline.js +3 -3
  49. package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
  50. package/lib/module/components/buttons/ButtonSolid.js +3 -3
  51. package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
  52. package/lib/module/components/buttons/IconButtonContained.js.map +1 -1
  53. package/lib/module/components/buttons/IconButtonSolid.js.map +1 -1
  54. package/lib/module/components/contentWrapper/ContentWrapper.js.map +1 -1
  55. package/lib/module/components/listitems/ListItemAction.js.map +1 -1
  56. package/lib/module/components/listitems/ListItemIDP.js.map +1 -1
  57. package/lib/module/components/listitems/ListItemNavAlert.js.map +1 -1
  58. package/lib/module/components/listitems/ListItemTransaction.js.map +1 -1
  59. package/lib/module/components/listitems/PressableListItemsBase.js.map +1 -1
  60. package/lib/module/components/listitems/__test__/listitem.test.js.map +1 -1
  61. package/lib/module/components/listitems/hooks/useListItemSpringAnimation.js.map +1 -1
  62. package/lib/module/components/pictograms/Pictogram.js +7 -3
  63. package/lib/module/components/pictograms/Pictogram.js.map +1 -1
  64. package/lib/module/components/pictograms/svg/PictogramFocusOn.js +48 -0
  65. package/lib/module/components/pictograms/svg/PictogramFocusOn.js.map +1 -0
  66. package/lib/module/components/pictograms/svg/originals/PictogramFocusOn.svg +19 -0
  67. package/lib/module/components/spacer/Spacer.js.map +1 -1
  68. package/lib/module/components/typography/Body.js.map +1 -1
  69. package/lib/module/components/typography/Factory.js.map +1 -1
  70. package/lib/module/components/typography/H1.js.map +1 -1
  71. package/lib/module/components/typography/H2.js.map +1 -1
  72. package/lib/module/components/typography/H4.js.map +1 -1
  73. package/lib/module/components/typography/H5.js.map +1 -1
  74. package/lib/module/components/typography/H6.js.map +1 -1
  75. package/lib/module/components/typography/Label.js.map +1 -1
  76. package/lib/module/components/typography/LabelSmall.js.map +1 -1
  77. package/lib/module/components/typography/Monospace.js.map +1 -1
  78. package/lib/module/components/typography/common.js +2 -2
  79. package/lib/module/components/typography/common.js.map +1 -1
  80. package/lib/module/utils/image.js.map +1 -1
  81. package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
  82. package/lib/typescript/components/badge/Badge.d.ts.map +1 -1
  83. package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
  84. package/lib/typescript/components/buttons/ButtonExtendedOutline.d.ts.map +1 -1
  85. package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
  86. package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
  87. package/lib/typescript/components/buttons/IconButtonContained.d.ts.map +1 -1
  88. package/lib/typescript/components/contentWrapper/ContentWrapper.d.ts.map +1 -1
  89. package/lib/typescript/components/listitems/ListItemAction.d.ts.map +1 -1
  90. package/lib/typescript/components/listitems/ListItemIDP.d.ts +1 -1
  91. package/lib/typescript/components/listitems/ListItemIDP.d.ts.map +1 -1
  92. package/lib/typescript/components/listitems/ListItemNavAlert.d.ts.map +1 -1
  93. package/lib/typescript/components/listitems/ListItemTransaction.d.ts.map +1 -1
  94. package/lib/typescript/components/listitems/PressableListItemsBase.d.ts.map +1 -1
  95. package/lib/typescript/components/listitems/hooks/useListItemSpringAnimation.d.ts.map +1 -1
  96. package/lib/typescript/components/pictograms/Pictogram.d.ts +2 -0
  97. package/lib/typescript/components/pictograms/Pictogram.d.ts.map +1 -1
  98. package/lib/typescript/components/pictograms/svg/PictogramFocusOn.d.ts +5 -0
  99. package/lib/typescript/components/pictograms/svg/PictogramFocusOn.d.ts.map +1 -0
  100. package/lib/typescript/components/spacer/Spacer.d.ts.map +1 -1
  101. package/lib/typescript/components/typography/Body.d.ts.map +1 -1
  102. package/lib/typescript/components/typography/Factory.d.ts.map +1 -1
  103. package/lib/typescript/components/typography/H1.d.ts.map +1 -1
  104. package/lib/typescript/components/typography/H2.d.ts.map +1 -1
  105. package/lib/typescript/components/typography/H4.d.ts.map +1 -1
  106. package/lib/typescript/components/typography/H5.d.ts.map +1 -1
  107. package/lib/typescript/components/typography/H6.d.ts.map +1 -1
  108. package/lib/typescript/components/typography/Label.d.ts.map +1 -1
  109. package/lib/typescript/components/typography/LabelSmall.d.ts.map +1 -1
  110. package/lib/typescript/components/typography/Monospace.d.ts.map +1 -1
  111. package/lib/typescript/components/typography/common.d.ts +2 -2
  112. package/lib/typescript/components/typography/common.d.ts.map +1 -1
  113. package/lib/typescript/utils/image.d.ts.map +1 -1
  114. package/package.json +3 -2
  115. package/src/components/Advice/index.tsx +1 -1
  116. package/src/components/accordion/RawAccordion.tsx +3 -3
  117. package/src/components/alert/Alert.tsx +4 -1
  118. package/src/components/avatar/Avatar.tsx +1 -1
  119. package/src/components/avatar/__test__/avatar.test.tsx +7 -4
  120. package/src/components/avatar/index.tsx +1 -1
  121. package/src/components/badge/Badge.tsx +16 -11
  122. package/src/components/banner/Banner.tsx +206 -195
  123. package/src/components/banner/__test__/banner.test.tsx +11 -9
  124. package/src/components/banner/index.tsx +1 -1
  125. package/src/components/buttons/ButtonExtendedOutline.tsx +80 -80
  126. package/src/components/buttons/ButtonOutline.tsx +278 -280
  127. package/src/components/buttons/ButtonSolid.tsx +142 -141
  128. package/src/components/buttons/IconButtonContained.tsx +17 -17
  129. package/src/components/buttons/IconButtonSolid.tsx +11 -11
  130. package/src/components/contentWrapper/ContentWrapper.tsx +12 -12
  131. package/src/components/contentWrapper/index.tsx +1 -1
  132. package/src/components/divider/index.tsx +1 -1
  133. package/src/components/icons/index.tsx +1 -1
  134. package/src/components/listitems/ListItemAction.tsx +120 -119
  135. package/src/components/listitems/ListItemIDP.tsx +115 -115
  136. package/src/components/listitems/ListItemNavAlert.tsx +114 -110
  137. package/src/components/listitems/ListItemTransaction.tsx +2 -6
  138. package/src/components/listitems/PressableListItemsBase.tsx +29 -29
  139. package/src/components/listitems/__test__/listitem.test.tsx +53 -15
  140. package/src/components/listitems/hooks/useListItemSpringAnimation.ts +54 -52
  141. package/src/components/pictograms/Pictogram.tsx +6 -3
  142. package/src/components/pictograms/svg/PictogramFocusOn.tsx +39 -0
  143. package/src/components/pictograms/svg/originals/PictogramFocusOn.svg +19 -0
  144. package/src/components/spacer/Spacer.tsx +21 -18
  145. package/src/components/spacer/index.tsx +1 -1
  146. package/src/components/typography/Body.tsx +10 -10
  147. package/src/components/typography/Factory.tsx +38 -38
  148. package/src/components/typography/H1.tsx +19 -19
  149. package/src/components/typography/H2.tsx +19 -19
  150. package/src/components/typography/H4.tsx +12 -12
  151. package/src/components/typography/H5.tsx +24 -24
  152. package/src/components/typography/H6.tsx +10 -10
  153. package/src/components/typography/Label.tsx +16 -16
  154. package/src/components/typography/LabelSmall.tsx +27 -28
  155. package/src/components/typography/Monospace.tsx +14 -14
  156. package/src/components/typography/common.tsx +20 -20
  157. package/src/components/typography/index.tsx +0 -1
  158. package/src/index.tsx +0 -1
  159. package/src/json-import.d.ts +3 -4
  160. package/src/utils/dates.ts +1 -1
  161. package/src/utils/image.ts +22 -22
@@ -1,20 +1,22 @@
1
1
  import React, { useCallback } from "react";
2
- import {
3
- GestureResponderEvent,
4
- Pressable,
5
- StyleSheet
6
- } from "react-native";
2
+ import { GestureResponderEvent, Pressable, StyleSheet } from "react-native";
7
3
  import Animated, {
8
- Extrapolate,
9
- interpolate,
10
- interpolateColor,
11
- useAnimatedProps,
12
- useAnimatedStyle,
13
- useDerivedValue,
14
- useSharedValue,
15
- withSpring
4
+ Extrapolate,
5
+ interpolate,
6
+ interpolateColor,
7
+ useAnimatedProps,
8
+ useAnimatedStyle,
9
+ useDerivedValue,
10
+ useSharedValue,
11
+ withSpring
16
12
  } from "react-native-reanimated";
17
- import { IOButtonStyles, IOColors, IOScaleValues, IOSpringValues, hexToRgba } from "../../core/";
13
+ import {
14
+ IOButtonStyles,
15
+ IOColors,
16
+ IOScaleValues,
17
+ IOSpringValues,
18
+ hexToRgba
19
+ } from "../../core/";
18
20
  import { makeFontStyleObject } from "../../utils/fonts";
19
21
  import { WithTestID } from "../../utils/types";
20
22
  import { AnimatedIcon, IOIcons, IconClassComponent } from "../icons";
@@ -22,308 +24,304 @@ import { HSpacer } from "../spacer/Spacer";
22
24
 
23
25
  type ColorButtonOutline = "primary" | "neutral" | "contrast" | "danger";
24
26
  export type ButtonOutline = WithTestID<{
25
- color?: ColorButtonOutline;
26
- label: string;
27
- small?: boolean;
28
- fullWidth?: boolean;
29
- disabled?: boolean;
30
- // Icons
31
- icon?: IOIcons;
32
- iconPosition?: "start" | "end";
33
- // Accessibility
34
- accessibilityLabel: string;
35
- accessibilityHint?: string;
36
- onPress: (event: GestureResponderEvent) => void;
27
+ color?: ColorButtonOutline;
28
+ label: string;
29
+ small?: boolean;
30
+ fullWidth?: boolean;
31
+ disabled?: boolean;
32
+ // Icons
33
+ icon?: IOIcons;
34
+ iconPosition?: "start" | "end";
35
+ // Accessibility
36
+ accessibilityLabel: string;
37
+ accessibilityHint?: string;
38
+ onPress: (event: GestureResponderEvent) => void;
37
39
  }>;
38
40
 
39
41
  type ColorStates = {
40
- border: {
41
- default: string;
42
- pressed: string;
43
- disabled: string;
44
- };
45
- background: {
46
- default: string;
47
- pressed: string;
48
- disabled: string;
49
- };
50
- label: {
51
- default: string;
52
- pressed: string;
53
- disabled: string;
54
- };
42
+ border: {
43
+ default: string;
44
+ pressed: string;
45
+ disabled: string;
46
+ };
47
+ background: {
48
+ default: string;
49
+ pressed: string;
50
+ disabled: string;
51
+ };
52
+ label: {
53
+ default: string;
54
+ pressed: string;
55
+ disabled: string;
56
+ };
55
57
  };
56
58
 
57
59
  const mapColorStates: Record<
58
- NonNullable<ButtonOutline["color"]>,
59
- ColorStates
60
+ NonNullable<ButtonOutline["color"]>,
61
+ ColorStates
60
62
  > = {
61
- // Primary button
62
- primary: {
63
- border: {
64
- default: IOColors["blueIO-500"],
65
- pressed: IOColors["blueIO-600"],
66
- disabled: IOColors["grey-200"]
67
- },
68
- background: {
69
- default: hexToRgba(IOColors["blueIO-50"], 0),
70
- pressed: hexToRgba(IOColors["blueIO-50"], 1),
71
- disabled: "transparent"
72
- },
73
- label: {
74
- default: IOColors["blueIO-500"],
75
- pressed: IOColors["blueIO-600"],
76
- disabled: IOColors["grey-700"]
77
- }
63
+ // Primary button
64
+ primary: {
65
+ border: {
66
+ default: IOColors["blueIO-500"],
67
+ pressed: IOColors["blueIO-600"],
68
+ disabled: IOColors["grey-200"]
69
+ },
70
+ background: {
71
+ default: hexToRgba(IOColors["blueIO-50"], 0),
72
+ pressed: hexToRgba(IOColors["blueIO-50"], 1),
73
+ disabled: "transparent"
74
+ },
75
+ label: {
76
+ default: IOColors["blueIO-500"],
77
+ pressed: IOColors["blueIO-600"],
78
+ disabled: IOColors["grey-700"]
79
+ }
80
+ },
81
+ // Neutral button
82
+ neutral: {
83
+ border: {
84
+ default: IOColors.grey,
85
+ pressed: IOColors.bluegrey,
86
+ disabled: IOColors.bluegreyLight
87
+ },
88
+ background: {
89
+ default: IOColors.white,
90
+ pressed: IOColors.greyUltraLight,
91
+ disabled: "transparent"
92
+ },
93
+ label: {
94
+ default: IOColors.bluegrey,
95
+ pressed: IOColors.bluegreyDark,
96
+ disabled: IOColors.grey
97
+ }
98
+ },
99
+ // Contrast button
100
+ contrast: {
101
+ border: {
102
+ default: IOColors.white,
103
+ pressed: IOColors.white,
104
+ disabled: IOColors["blueIO-200"]
78
105
  },
79
- // Neutral button
80
- neutral: {
81
- border: {
82
- default: IOColors.grey,
83
- pressed: IOColors.bluegrey,
84
- disabled: IOColors.bluegreyLight
85
- },
86
- background: {
87
- default: IOColors.white,
88
- pressed: IOColors.greyUltraLight,
89
- disabled: "transparent"
90
- },
91
- label: {
92
- default: IOColors.bluegrey,
93
- pressed: IOColors.bluegreyDark,
94
- disabled: IOColors.grey
95
- }
106
+ background: {
107
+ default: hexToRgba(IOColors["blueIO-600"], 0),
108
+ pressed: IOColors["blueIO-600"],
109
+ disabled: "transparent"
110
+ },
111
+ label: {
112
+ default: IOColors.white,
113
+ pressed: IOColors.white,
114
+ disabled: IOColors["blueIO-200"]
115
+ }
116
+ },
117
+ // Danger button
118
+ danger: {
119
+ border: {
120
+ default: IOColors.red,
121
+ pressed: IOColors.red,
122
+ disabled: IOColors.bluegreyLight
96
123
  },
97
- // Contrast button
98
- contrast: {
99
- border: {
100
- default: IOColors.white,
101
- pressed: IOColors.white,
102
- disabled: IOColors["blueIO-200"]
103
- },
104
- background: {
105
- default: hexToRgba(IOColors["blueIO-600"], 0),
106
- pressed: IOColors["blueIO-600"],
107
- disabled: "transparent"
108
- },
109
- label: {
110
- default: IOColors.white,
111
- pressed: IOColors.white,
112
- disabled: IOColors["blueIO-200"]
113
- }
124
+ background: {
125
+ default: hexToRgba(IOColors.red, 0),
126
+ pressed: hexToRgba(IOColors.red, 0.15),
127
+ disabled: "transparent"
114
128
  },
115
- // Danger button
116
- danger: {
117
- border: {
118
- default: IOColors.red,
119
- pressed: IOColors.red,
120
- disabled: IOColors.bluegreyLight
121
- },
122
- background: {
123
- default: hexToRgba(IOColors.red, 0),
124
- pressed: hexToRgba(IOColors.red, 0.15),
125
- disabled: "transparent"
126
- },
127
- label: {
128
- default: IOColors.red,
129
- pressed: IOColors.red,
130
- disabled: IOColors.grey
131
- }
129
+ label: {
130
+ default: IOColors.red,
131
+ pressed: IOColors.red,
132
+ disabled: IOColors.grey
132
133
  }
134
+ }
133
135
  };
134
136
 
135
137
  const DISABLED_OPACITY = 0.5;
136
138
 
137
139
  const IOButtonStylesLocal = StyleSheet.create({
138
- label: {
139
- ...makeFontStyleObject("Regular", false, "ReadexPro")
140
- },
141
- buttonWithBorder: {
142
- borderWidth: 2
143
- }
140
+ label: {
141
+ ...makeFontStyleObject("Regular", false, "ReadexPro")
142
+ },
143
+ buttonWithBorder: {
144
+ borderWidth: 2
145
+ }
144
146
  });
145
147
 
146
148
  export const ButtonOutline = ({
147
- color = "primary",
148
- label,
149
- small = false,
150
- fullWidth = false,
151
- disabled = false,
152
- icon,
153
- iconPosition = "start",
154
- onPress,
155
- accessibilityLabel,
156
- accessibilityHint,
157
- testID
158
- }:
159
- ButtonOutline) => {
160
- const isPressed: Animated.SharedValue<number> = useSharedValue(0);
149
+ color = "primary",
150
+ label,
151
+ small = false,
152
+ fullWidth = false,
153
+ disabled = false,
154
+ icon,
155
+ iconPosition = "start",
156
+ onPress,
157
+ accessibilityLabel,
158
+ accessibilityHint,
159
+ testID
160
+ }: ButtonOutline) => {
161
+ const isPressed: Animated.SharedValue<number> = useSharedValue(0);
161
162
 
162
- // Scaling transformation applied when the button is pressed
163
- const animationScaleValue = IOScaleValues?.basicButton?.pressedState;
163
+ // Scaling transformation applied when the button is pressed
164
+ const animationScaleValue = IOScaleValues?.basicButton?.pressedState;
164
165
 
165
- // Using a spring-based animation for our interpolations
166
- const progressPressed = useDerivedValue(() =>
167
- withSpring(isPressed.value, IOSpringValues.button)
168
- );
166
+ // Using a spring-based animation for our interpolations
167
+ const progressPressed = useDerivedValue(() =>
168
+ withSpring(isPressed.value, IOSpringValues.button)
169
+ );
169
170
 
170
- // Interpolate animation values from `isPressed` values
171
- const pressedAnimationStyle = useAnimatedStyle(() => {
172
- // Link color states to the pressed states
173
- const backgroundColor = interpolateColor(
174
- progressPressed.value,
175
- [0, 1],
176
- [
177
- mapColorStates[color].background.default,
178
- mapColorStates[color].background.pressed
179
- ]
180
- );
171
+ // Interpolate animation values from `isPressed` values
172
+ const pressedAnimationStyle = useAnimatedStyle(() => {
173
+ // Link color states to the pressed states
174
+ const backgroundColor = interpolateColor(
175
+ progressPressed.value,
176
+ [0, 1],
177
+ [
178
+ mapColorStates[color].background.default,
179
+ mapColorStates[color].background.pressed
180
+ ]
181
+ );
181
182
 
182
- const borderColor = interpolateColor(
183
- progressPressed.value,
184
- [0, 1],
185
- [
186
- mapColorStates[color].border.default,
187
- mapColorStates[color].border.pressed
188
- ]
189
- );
183
+ const borderColor = interpolateColor(
184
+ progressPressed.value,
185
+ [0, 1],
186
+ [
187
+ mapColorStates[color].border.default,
188
+ mapColorStates[color].border.pressed
189
+ ]
190
+ );
190
191
 
191
- // Scale down button slightly when pressed
192
- const scale = interpolate(
193
- progressPressed.value,
194
- [0, 1],
195
- [1, animationScaleValue],
196
- Extrapolate.CLAMP
197
- );
192
+ // Scale down button slightly when pressed
193
+ const scale = interpolate(
194
+ progressPressed.value,
195
+ [0, 1],
196
+ [1, animationScaleValue],
197
+ Extrapolate.CLAMP
198
+ );
198
199
 
199
- return {
200
- borderColor,
201
- backgroundColor,
202
- transform: [{ scale }]
203
- };
204
- });
200
+ return {
201
+ borderColor,
202
+ backgroundColor,
203
+ transform: [{ scale }]
204
+ };
205
+ });
205
206
 
206
- const pressedColorLabelAnimationStyle = useAnimatedStyle(() => {
207
- // Link color states to the pressed states
207
+ const pressedColorLabelAnimationStyle = useAnimatedStyle(() => {
208
+ // Link color states to the pressed states
208
209
 
209
- const labelColor = interpolateColor(
210
- progressPressed.value,
211
- [0, 1],
212
- [
213
- mapColorStates[color].border.default,
214
- mapColorStates[color].border.pressed
215
- ]
216
- );
210
+ const labelColor = interpolateColor(
211
+ progressPressed.value,
212
+ [0, 1],
213
+ [
214
+ mapColorStates[color].border.default,
215
+ mapColorStates[color].border.pressed
216
+ ]
217
+ );
217
218
 
218
- return {
219
- color: labelColor
220
- };
221
- });
219
+ return {
220
+ color: labelColor
221
+ };
222
+ });
222
223
 
223
- // Animate the <Icon> color prop
224
- const pressedColorIconAnimationStyle = useAnimatedProps(() => {
225
- const iconColor = interpolateColor(
226
- progressPressed.value,
227
- [0, 1],
228
- [
229
- mapColorStates[color].label.default,
230
- mapColorStates[color].label.pressed
231
- ]
232
- );
233
- return { color: iconColor };
234
- });
224
+ // Animate the <Icon> color prop
225
+ const pressedColorIconAnimationStyle = useAnimatedProps(() => {
226
+ const iconColor = interpolateColor(
227
+ progressPressed.value,
228
+ [0, 1],
229
+ [mapColorStates[color].label.default, mapColorStates[color].label.pressed]
230
+ );
231
+ return { color: iconColor };
232
+ });
235
233
 
236
- const AnimatedIconClassComponent =
237
- Animated.createAnimatedComponent(IconClassComponent);
234
+ const AnimatedIconClassComponent =
235
+ Animated.createAnimatedComponent(IconClassComponent);
238
236
 
239
- const onPressIn = useCallback(() => {
240
- // eslint-disable-next-line functional/immutable-data
241
- isPressed.value = 1;
242
- }, [isPressed]);
243
- const onPressOut = useCallback(() => {
244
- // eslint-disable-next-line functional/immutable-data
245
- isPressed.value = 0;
246
- }, [isPressed]);
237
+ const onPressIn = useCallback(() => {
238
+ // eslint-disable-next-line functional/immutable-data
239
+ isPressed.value = 1;
240
+ }, [isPressed]);
241
+ const onPressOut = useCallback(() => {
242
+ // eslint-disable-next-line functional/immutable-data
243
+ isPressed.value = 0;
244
+ }, [isPressed]);
247
245
 
248
- const Button = () => (
249
- <Pressable
250
- accessibilityLabel={accessibilityLabel}
251
- accessibilityHint={accessibilityHint}
252
- accessibilityRole={"button"}
253
- testID={testID}
254
- onPress={onPress}
255
- onPressIn={onPressIn}
256
- onPressOut={onPressOut}
257
- accessible={true}
258
- disabled={disabled}
259
- style={!fullWidth ? IOButtonStyles.dimensionsDefault : {}}
260
- >
261
- <Animated.View
262
- style={[
263
- IOButtonStyles.button,
264
- IOButtonStylesLocal.buttonWithBorder,
265
- iconPosition === "end" && { flexDirection: "row-reverse" },
266
- small
267
- ? IOButtonStyles.buttonSizeSmall
268
- : IOButtonStyles.buttonSizeDefault,
269
- disabled
270
- ? {
271
- backgroundColor: mapColorStates[color]?.background?.disabled,
272
- borderColor: mapColorStates[color]?.border?.disabled,
273
- opacity: DISABLED_OPACITY
274
- }
275
- : {
276
- backgroundColor: mapColorStates[color]?.background?.default,
277
- borderColor: mapColorStates[color]?.border.default
278
- },
279
- /* Prevent Reanimated from overriding background colors
246
+ const Button = () => (
247
+ <Pressable
248
+ accessibilityLabel={accessibilityLabel}
249
+ accessibilityHint={accessibilityHint}
250
+ accessibilityRole={"button"}
251
+ testID={testID}
252
+ onPress={onPress}
253
+ onPressIn={onPressIn}
254
+ onPressOut={onPressOut}
255
+ accessible={true}
256
+ disabled={disabled}
257
+ style={!fullWidth ? IOButtonStyles.dimensionsDefault : {}}
258
+ >
259
+ <Animated.View
260
+ style={[
261
+ IOButtonStyles.button,
262
+ IOButtonStylesLocal.buttonWithBorder,
263
+ iconPosition === "end" && { flexDirection: "row-reverse" },
264
+ small
265
+ ? IOButtonStyles.buttonSizeSmall
266
+ : IOButtonStyles.buttonSizeDefault,
267
+ disabled
268
+ ? {
269
+ backgroundColor: mapColorStates[color]?.background?.disabled,
270
+ borderColor: mapColorStates[color]?.border?.disabled,
271
+ opacity: DISABLED_OPACITY
272
+ }
273
+ : {
274
+ backgroundColor: mapColorStates[color]?.background?.default,
275
+ borderColor: mapColorStates[color]?.border.default
276
+ },
277
+ /* Prevent Reanimated from overriding background colors
280
278
  if button is disabled */
281
- !disabled && pressedAnimationStyle
282
- ]}
283
- >
284
- {icon && (
285
- <>
286
- {!disabled ? (
287
- <AnimatedIconClassComponent
288
- name={icon}
289
- animatedProps={pressedColorIconAnimationStyle}
290
- color={mapColorStates[color]?.label?.default}
291
- />
292
- ) : (
293
- <AnimatedIcon
294
- name={icon}
295
- color={mapColorStates[color]?.label?.disabled}
296
- />
297
- )}
298
- <HSpacer size={8} />
299
- </>
300
- )}
301
- <Animated.Text
302
- style={[
303
- IOButtonStylesLocal.label,
304
- IOButtonStyles.label,
305
- small
306
- ? IOButtonStyles.labelSizeSmall
307
- : IOButtonStyles.labelSizeDefault,
308
- disabled
309
- ? { color: mapColorStates[color]?.label?.disabled }
310
- : { color: mapColorStates[color]?.label?.default },
311
- !disabled && pressedColorLabelAnimationStyle
312
- ]}
313
- numberOfLines={1}
314
- ellipsizeMode="tail"
315
- /* A11y-related props:
279
+ !disabled && pressedAnimationStyle
280
+ ]}
281
+ >
282
+ {icon && (
283
+ <>
284
+ {!disabled ? (
285
+ <AnimatedIconClassComponent
286
+ name={icon}
287
+ animatedProps={pressedColorIconAnimationStyle}
288
+ color={mapColorStates[color]?.label?.default}
289
+ />
290
+ ) : (
291
+ <AnimatedIcon
292
+ name={icon}
293
+ color={mapColorStates[color]?.label?.disabled}
294
+ />
295
+ )}
296
+ <HSpacer size={8} />
297
+ </>
298
+ )}
299
+ <Animated.Text
300
+ style={[
301
+ IOButtonStylesLocal.label,
302
+ IOButtonStyles.label,
303
+ small
304
+ ? IOButtonStyles.labelSizeSmall
305
+ : IOButtonStyles.labelSizeDefault,
306
+ disabled
307
+ ? { color: mapColorStates[color]?.label?.disabled }
308
+ : { color: mapColorStates[color]?.label?.default },
309
+ !disabled && pressedColorLabelAnimationStyle
310
+ ]}
311
+ numberOfLines={1}
312
+ ellipsizeMode="tail"
313
+ /* A11y-related props:
316
314
  DON'T UNCOMMENT THEM */
317
- /* allowFontScaling
315
+ /* allowFontScaling
318
316
  maxFontSizeMultiplier={1.3} */
319
- >
320
- {label}
321
- </Animated.Text>
322
- </Animated.View>
323
- </Pressable>
324
- );
317
+ >
318
+ {label}
319
+ </Animated.Text>
320
+ </Animated.View>
321
+ </Pressable>
322
+ );
325
323
 
326
- return <Button />;
324
+ return <Button />;
327
325
  };
328
326
 
329
327
  export default ButtonOutline;