@pagopa/io-app-design-system 4.5.1 → 4.5.2
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.
- package/lib/commonjs/components/accordion/AccordionItem.js +1 -1
- package/lib/commonjs/components/accordion/AccordionItem.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonLink.js +25 -25
- package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonOutline.js +41 -97
- package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonSolid.js +70 -63
- package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButton.js +28 -27
- package/lib/commonjs/components/buttons/IconButton.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButtonSolid.js +27 -27
- package/lib/commonjs/components/buttons/IconButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +5 -7
- package/lib/commonjs/components/icons/svg/IconProductIOAppBlueBg.js +8 -20
- package/lib/commonjs/components/icons/svg/IconProductIOAppBlueBg.js.map +1 -1
- package/lib/commonjs/components/icons/svg/originals/IconProductIOAppBlueBg.svg +12 -9
- package/lib/commonjs/components/layout/HeaderFirstLevel.js +2 -2
- package/lib/commonjs/components/layout/HeaderFirstLevel.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemInfo.js +1 -1
- package/lib/commonjs/components/listitems/ListItemInfo.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemInfoCopy.js +1 -1
- package/lib/commonjs/components/listitems/ListItemInfoCopy.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemNav.js +4 -3
- package/lib/commonjs/components/listitems/ListItemNav.js.map +1 -1
- package/lib/commonjs/core/IOColors.js +16 -2
- package/lib/commonjs/core/IOColors.js.map +1 -1
- package/lib/module/components/accordion/AccordionItem.js +1 -1
- package/lib/module/components/accordion/AccordionItem.js.map +1 -1
- package/lib/module/components/buttons/ButtonLink.js +26 -26
- package/lib/module/components/buttons/ButtonLink.js.map +1 -1
- package/lib/module/components/buttons/ButtonOutline.js +42 -98
- package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/module/components/buttons/ButtonSolid.js +73 -66
- package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/IconButton.js +29 -28
- package/lib/module/components/buttons/IconButton.js.map +1 -1
- package/lib/module/components/buttons/IconButtonSolid.js +28 -28
- package/lib/module/components/buttons/IconButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +5 -7
- package/lib/module/components/icons/svg/IconProductIOAppBlueBg.js +9 -21
- package/lib/module/components/icons/svg/IconProductIOAppBlueBg.js.map +1 -1
- package/lib/module/components/icons/svg/originals/IconProductIOAppBlueBg.svg +12 -9
- package/lib/module/components/layout/HeaderFirstLevel.js +2 -2
- package/lib/module/components/layout/HeaderFirstLevel.js.map +1 -1
- package/lib/module/components/listitems/ListItemInfo.js +1 -1
- package/lib/module/components/listitems/ListItemInfo.js.map +1 -1
- package/lib/module/components/listitems/ListItemInfoCopy.js +1 -1
- package/lib/module/components/listitems/ListItemInfoCopy.js.map +1 -1
- package/lib/module/components/listitems/ListItemNav.js +4 -3
- package/lib/module/components/listitems/ListItemNav.js.map +1 -1
- package/lib/module/core/IOColors.js +16 -2
- package/lib/module/core/IOColors.js.map +1 -1
- package/lib/typescript/components/buttons/ButtonLink.d.ts +1 -1
- package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonOutline.d.ts +2 -2
- package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonSolid.d.ts +1 -1
- package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IconButton.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IconButtonSolid.d.ts.map +1 -1
- package/lib/typescript/components/icons/svg/IconProductIOAppBlueBg.d.ts.map +1 -1
- package/lib/typescript/components/layout/HeaderFirstLevel.d.ts +2 -2
- package/lib/typescript/components/layout/HeaderFirstLevel.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemNav.d.ts.map +1 -1
- package/lib/typescript/core/IOColors.d.ts +1 -1
- package/lib/typescript/core/IOColors.d.ts.map +1 -1
- package/lib/typescript/core/IOStyles.d.ts +2 -2
- package/lib/typescript/utils/fonts.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/accordion/AccordionItem.tsx +1 -1
- package/src/components/buttons/ButtonLink.tsx +37 -30
- package/src/components/buttons/ButtonOutline.tsx +51 -108
- package/src/components/buttons/ButtonSolid.tsx +94 -78
- package/src/components/buttons/IconButton.tsx +36 -29
- package/src/components/buttons/IconButtonSolid.tsx +35 -31
- package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +5 -7
- package/src/components/icons/svg/IconProductIOAppBlueBg.tsx +12 -13
- package/src/components/icons/svg/originals/IconProductIOAppBlueBg.svg +12 -9
- package/src/components/layout/HeaderFirstLevel.tsx +4 -4
- package/src/components/listitems/ListItemInfo.tsx +1 -1
- package/src/components/listitems/ListItemInfoCopy.tsx +1 -1
- package/src/components/listitems/ListItemNav.tsx +5 -4
- package/src/core/IOColors.ts +24 -3
- package/lib/commonjs/components/layout/BlockButtons.js +0 -85
- package/lib/commonjs/components/layout/BlockButtons.js.map +0 -1
- package/lib/module/components/layout/BlockButtons.js +0 -76
- package/lib/module/components/layout/BlockButtons.js.map +0 -1
- package/lib/typescript/components/layout/BlockButtons.d.ts +0 -54
- package/lib/typescript/components/layout/BlockButtons.d.ts.map +0 -1
- package/src/components/layout/BlockButtons.tsx +0 -143
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
ComponentProps,
|
|
3
|
+
forwardRef,
|
|
4
|
+
useCallback,
|
|
5
|
+
useEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
useRef
|
|
8
|
+
} from "react";
|
|
2
9
|
import {
|
|
10
|
+
ColorValue,
|
|
3
11
|
GestureResponderEvent,
|
|
4
12
|
Pressable,
|
|
5
|
-
StyleSheet,
|
|
6
13
|
View
|
|
7
14
|
} from "react-native";
|
|
8
15
|
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
@@ -18,7 +25,8 @@ import {
|
|
|
18
25
|
enterTransitionInnerContent,
|
|
19
26
|
enterTransitionInnerContentSmall,
|
|
20
27
|
exitTransitionInnerContent,
|
|
21
|
-
useIOExperimentalDesign
|
|
28
|
+
useIOExperimentalDesign,
|
|
29
|
+
useIOTheme
|
|
22
30
|
} from "../../core";
|
|
23
31
|
import { useScaleAnimation } from "../../hooks";
|
|
24
32
|
import { WithTestID } from "../../utils/types";
|
|
@@ -29,37 +37,23 @@ import { ButtonText } from "../typography/ButtonText";
|
|
|
29
37
|
export type ButtonSolidColor = "primary" | "danger" | "contrast";
|
|
30
38
|
|
|
31
39
|
type ColorStates = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
background: {
|
|
41
|
+
default: string;
|
|
42
|
+
pressed: string;
|
|
43
|
+
disabled: string;
|
|
44
|
+
};
|
|
45
|
+
foreground: {
|
|
35
46
|
default: IOColors;
|
|
36
47
|
disabled: IOColors;
|
|
37
48
|
};
|
|
38
49
|
};
|
|
39
50
|
|
|
40
|
-
// Disabled state
|
|
41
|
-
// TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
|
|
42
|
-
const colorPrimaryLegacyButtonDisabled: IOColors = "grey-200";
|
|
43
|
-
const legacyStyles = StyleSheet.create({
|
|
44
|
-
backgroundDisabled: {
|
|
45
|
-
backgroundColor: IOColors[colorPrimaryLegacyButtonDisabled]
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const colorPrimaryButtonDisabled: IOColors = "grey-200";
|
|
50
51
|
const ICON_MARGIN = 8;
|
|
51
52
|
const DISABLED_OPACITY = 0.5;
|
|
52
53
|
|
|
53
54
|
// Icon size
|
|
54
55
|
const iconSize: IOIconSizeScale = 20;
|
|
55
56
|
|
|
56
|
-
const styles = StyleSheet.create({
|
|
57
|
-
backgroundDisabled: {
|
|
58
|
-
backgroundColor: IOColors[colorPrimaryButtonDisabled],
|
|
59
|
-
opacity: DISABLED_OPACITY
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
57
|
export type ButtonSolidProps = WithTestID<
|
|
64
58
|
{
|
|
65
59
|
/**
|
|
@@ -87,39 +81,6 @@ export type ButtonSolidProps = WithTestID<
|
|
|
87
81
|
>
|
|
88
82
|
>;
|
|
89
83
|
|
|
90
|
-
const mapColorStates: Record<
|
|
91
|
-
NonNullable<ButtonSolidProps["color"]>,
|
|
92
|
-
ColorStates
|
|
93
|
-
> = {
|
|
94
|
-
// Primary button
|
|
95
|
-
primary: {
|
|
96
|
-
default: IOColors["blueIO-500"],
|
|
97
|
-
pressed: IOColors["blueIO-600"],
|
|
98
|
-
label: {
|
|
99
|
-
default: "white",
|
|
100
|
-
disabled: "grey-700"
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
// Danger button
|
|
104
|
-
danger: {
|
|
105
|
-
default: IOColors["error-600"],
|
|
106
|
-
pressed: IOColors["error-500"],
|
|
107
|
-
label: {
|
|
108
|
-
default: "white",
|
|
109
|
-
disabled: "grey-700"
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
// Contrast button
|
|
113
|
-
contrast: {
|
|
114
|
-
default: IOColors.white,
|
|
115
|
-
pressed: IOColors["blueIO-50"],
|
|
116
|
-
label: {
|
|
117
|
-
default: "blueIO-500",
|
|
118
|
-
disabled: "grey-700"
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
84
|
// TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
|
|
124
85
|
const mapLegacyColorStates: Record<
|
|
125
86
|
NonNullable<ButtonSolidProps["color"]>,
|
|
@@ -127,34 +88,43 @@ const mapLegacyColorStates: Record<
|
|
|
127
88
|
> = {
|
|
128
89
|
// Primary button
|
|
129
90
|
primary: {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
91
|
+
background: {
|
|
92
|
+
default: IOColors["blue-500"],
|
|
93
|
+
pressed: IOColors["blue-600"],
|
|
94
|
+
disabled: IOColors["grey-200"]
|
|
95
|
+
},
|
|
96
|
+
foreground: {
|
|
133
97
|
default: "white",
|
|
134
98
|
disabled: "white"
|
|
135
99
|
}
|
|
136
100
|
},
|
|
137
101
|
// Danger button
|
|
138
102
|
danger: {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
103
|
+
background: {
|
|
104
|
+
default: IOColors["error-600"],
|
|
105
|
+
pressed: IOColors["error-500"],
|
|
106
|
+
disabled: IOColors["grey-200"]
|
|
107
|
+
},
|
|
108
|
+
foreground: {
|
|
142
109
|
default: "white",
|
|
143
110
|
disabled: "white"
|
|
144
111
|
}
|
|
145
112
|
},
|
|
146
113
|
// Contrast button
|
|
147
114
|
contrast: {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
115
|
+
background: {
|
|
116
|
+
default: IOColors.white,
|
|
117
|
+
pressed: IOColors["blue-50"],
|
|
118
|
+
disabled: IOColors["grey-200"]
|
|
119
|
+
},
|
|
120
|
+
foreground: {
|
|
151
121
|
default: "blue-500",
|
|
152
122
|
disabled: "white"
|
|
153
123
|
}
|
|
154
124
|
}
|
|
155
125
|
};
|
|
156
126
|
|
|
157
|
-
export const ButtonSolid =
|
|
127
|
+
export const ButtonSolid = forwardRef<View, ButtonSolidProps>(
|
|
158
128
|
(
|
|
159
129
|
{
|
|
160
130
|
color = "primary",
|
|
@@ -171,17 +141,62 @@ export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
|
|
|
171
141
|
},
|
|
172
142
|
ref
|
|
173
143
|
) => {
|
|
144
|
+
const theme = useIOTheme();
|
|
174
145
|
const { isExperimental } = useIOExperimentalDesign();
|
|
175
146
|
const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
|
|
176
147
|
useScaleAnimation();
|
|
177
148
|
const reducedMotion = useReducedMotion();
|
|
178
149
|
|
|
179
|
-
const
|
|
150
|
+
const mapColorStates = useMemo<
|
|
151
|
+
Record<NonNullable<ButtonSolidProps["color"]>, ColorStates>
|
|
152
|
+
>(
|
|
153
|
+
() => ({
|
|
154
|
+
// Primary button
|
|
155
|
+
primary: {
|
|
156
|
+
background: {
|
|
157
|
+
default: IOColors[theme["interactiveElem-default"]],
|
|
158
|
+
pressed: IOColors[theme["interactiveElem-pressed"]],
|
|
159
|
+
disabled: IOColors[theme["interactiveElem-disabled"]]
|
|
160
|
+
},
|
|
161
|
+
foreground: {
|
|
162
|
+
default: theme["buttonText-default"],
|
|
163
|
+
disabled: theme["buttonText-disabled"]
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
// Danger button
|
|
167
|
+
danger: {
|
|
168
|
+
background: {
|
|
169
|
+
default: IOColors["error-600"],
|
|
170
|
+
pressed: IOColors["error-500"],
|
|
171
|
+
disabled: IOColors[theme["interactiveElem-disabled"]]
|
|
172
|
+
},
|
|
173
|
+
foreground: {
|
|
174
|
+
default: theme["buttonText-default"],
|
|
175
|
+
disabled: theme["buttonText-disabled"]
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
// Contrast button
|
|
179
|
+
contrast: {
|
|
180
|
+
background: {
|
|
181
|
+
default: IOColors.white,
|
|
182
|
+
pressed: IOColors["blueIO-50"],
|
|
183
|
+
disabled: IOColors["blueIO-50"]
|
|
184
|
+
},
|
|
185
|
+
foreground: {
|
|
186
|
+
default: "blueIO-500",
|
|
187
|
+
disabled: "blueIO-500"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}),
|
|
191
|
+
[theme]
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
const colorMap = useMemo(
|
|
180
195
|
() => (isExperimental ? mapColorStates : mapLegacyColorStates),
|
|
181
|
-
[isExperimental]
|
|
196
|
+
[isExperimental, mapColorStates]
|
|
182
197
|
);
|
|
183
198
|
|
|
184
|
-
const buttonStyles =
|
|
199
|
+
const buttonStyles = useMemo(
|
|
185
200
|
() => (isExperimental ? IOButtonStyles : IOButtonLegacyStyles),
|
|
186
201
|
[isExperimental]
|
|
187
202
|
);
|
|
@@ -203,7 +218,7 @@ export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
|
|
|
203
218
|
const backgroundColor = interpolateColor(
|
|
204
219
|
progress.value,
|
|
205
220
|
[0, 1],
|
|
206
|
-
[colorMap[color].default, colorMap[color].pressed]
|
|
221
|
+
[colorMap[color].background.default, colorMap[color].background.pressed]
|
|
207
222
|
);
|
|
208
223
|
|
|
209
224
|
return { backgroundColor };
|
|
@@ -222,10 +237,15 @@ export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
|
|
|
222
237
|
[loading, onPress]
|
|
223
238
|
);
|
|
224
239
|
|
|
240
|
+
// Background
|
|
241
|
+
const backgroundColor: ColorValue = disabled
|
|
242
|
+
? colorMap[color]?.background?.disabled
|
|
243
|
+
: colorMap[color]?.background?.default;
|
|
244
|
+
|
|
225
245
|
// Label & Icons colors
|
|
226
246
|
const foregroundColor: IOColors = disabled
|
|
227
|
-
? colorMap[color]?.
|
|
228
|
-
: colorMap[color]?.
|
|
247
|
+
? colorMap[color]?.foreground?.disabled
|
|
248
|
+
: colorMap[color]?.foreground?.default;
|
|
229
249
|
|
|
230
250
|
return (
|
|
231
251
|
<Pressable
|
|
@@ -249,14 +269,10 @@ export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
|
|
|
249
269
|
<Animated.View
|
|
250
270
|
style={[
|
|
251
271
|
buttonStyles.button,
|
|
252
|
-
{ overflow: "hidden" },
|
|
272
|
+
{ backgroundColor, overflow: "hidden" },
|
|
253
273
|
isExperimental && fullWidth && { paddingHorizontal: 16 },
|
|
254
274
|
buttonStyles.buttonSizeDefault,
|
|
255
|
-
disabled
|
|
256
|
-
? isExperimental
|
|
257
|
-
? styles.backgroundDisabled
|
|
258
|
-
: legacyStyles.backgroundDisabled
|
|
259
|
-
: { backgroundColor: colorMap[color]?.default },
|
|
275
|
+
disabled ? { opacity: DISABLED_OPACITY } : {},
|
|
260
276
|
/* Prevent Reanimated from overriding background colors
|
|
261
277
|
if button is disabled */
|
|
262
278
|
!disabled && !reducedMotion && scaleAnimatedStyle,
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
IOIconButtonStyles,
|
|
11
11
|
IOStyles,
|
|
12
12
|
hexToRgba,
|
|
13
|
-
useIOExperimentalDesign
|
|
13
|
+
useIOExperimentalDesign,
|
|
14
|
+
useIOTheme
|
|
14
15
|
} from "../../core";
|
|
15
16
|
import { useScaleAnimation } from "../../hooks";
|
|
16
17
|
import { WithTestID } from "../../utils/types";
|
|
@@ -70,33 +71,6 @@ const mapLegacyColorStates: Record<
|
|
|
70
71
|
}
|
|
71
72
|
};
|
|
72
73
|
|
|
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
74
|
const AnimatedIconClassComponent =
|
|
101
75
|
Animated.createAnimatedComponent(IconClassComponent);
|
|
102
76
|
|
|
@@ -110,15 +84,48 @@ export const IconButton = ({
|
|
|
110
84
|
accessibilityHint,
|
|
111
85
|
testID
|
|
112
86
|
}: IconButton) => {
|
|
87
|
+
const theme = useIOTheme();
|
|
113
88
|
const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
|
|
114
89
|
useScaleAnimation("exaggerated");
|
|
115
90
|
const reducedMotion = useReducedMotion();
|
|
116
91
|
|
|
117
92
|
const { isExperimental } = useIOExperimentalDesign();
|
|
118
93
|
|
|
94
|
+
const mapColorStates = useMemo<
|
|
95
|
+
Record<NonNullable<IconButton["color"]>, ColorStates>
|
|
96
|
+
>(
|
|
97
|
+
() => ({
|
|
98
|
+
// Primary button
|
|
99
|
+
primary: {
|
|
100
|
+
icon: {
|
|
101
|
+
default: IOColors[theme["interactiveElem-default"]],
|
|
102
|
+
pressed: IOColors[theme["interactiveElem-pressed"]],
|
|
103
|
+
disabled: IOColors[theme["interactiveElem-disabled"]]
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
// Neutral button
|
|
107
|
+
neutral: {
|
|
108
|
+
icon: {
|
|
109
|
+
default: IOColors[theme["neutralButton-default"]],
|
|
110
|
+
pressed: IOColors[theme["neutralButton-pressed"]],
|
|
111
|
+
disabled: IOColors[theme["neutralButton-disabled"]]
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
// Contrast button
|
|
115
|
+
contrast: {
|
|
116
|
+
icon: {
|
|
117
|
+
default: IOColors.white,
|
|
118
|
+
pressed: hexToRgba(IOColors.white, 0.85),
|
|
119
|
+
disabled: hexToRgba(IOColors.white, 0.25)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}),
|
|
123
|
+
[theme]
|
|
124
|
+
);
|
|
125
|
+
|
|
119
126
|
const colorMap = useMemo(
|
|
120
127
|
() => (isExperimental ? mapColorStates : mapLegacyColorStates),
|
|
121
|
-
[isExperimental]
|
|
128
|
+
[isExperimental, mapColorStates]
|
|
122
129
|
);
|
|
123
130
|
|
|
124
131
|
// 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(
|
|
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 {
|
|
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
|
-
<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
32
|
-
secondAction
|
|
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>
|
|
@@ -81,7 +81,7 @@ export const ListItemNav = ({
|
|
|
81
81
|
description,
|
|
82
82
|
onPress,
|
|
83
83
|
icon,
|
|
84
|
-
iconColor
|
|
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={
|
|
192
|
+
color={defaultIconColor}
|
|
192
193
|
size={IOListItemVisualParams.iconSize}
|
|
193
194
|
/>
|
|
194
195
|
<HSpacer
|