@pagopa/io-app-design-system 5.0.0-3 → 5.0.0-4
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 +23 -22
- package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonOutline.js +37 -65
- package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonSolid.js +50 -43
- package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButton.js +28 -26
- package/lib/commonjs/components/buttons/IconButton.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButtonSolid.js +26 -25
- package/lib/commonjs/components/buttons/IconButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +6 -8
- 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 +7 -9
- package/lib/commonjs/components/layout/HeaderFirstLevel.js.map +1 -1
- package/lib/commonjs/components/layout/HeaderSecondLevel.js +24 -14
- package/lib/commonjs/components/layout/HeaderSecondLevel.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 +17 -3
- 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 +24 -23
- package/lib/module/components/buttons/ButtonLink.js.map +1 -1
- package/lib/module/components/buttons/ButtonOutline.js +38 -66
- package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/module/components/buttons/ButtonSolid.js +53 -46
- package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/IconButton.js +29 -27
- package/lib/module/components/buttons/IconButton.js.map +1 -1
- package/lib/module/components/buttons/IconButtonSolid.js +27 -26
- package/lib/module/components/buttons/IconButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +6 -8
- 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 +8 -9
- package/lib/module/components/layout/HeaderFirstLevel.js.map +1 -1
- package/lib/module/components/layout/HeaderSecondLevel.js +26 -16
- package/lib/module/components/layout/HeaderSecondLevel.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 +17 -3
- 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 +1 -1
- package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IconButton.d.ts +2 -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 +3 -4
- package/lib/typescript/components/layout/HeaderFirstLevel.d.ts.map +1 -1
- package/lib/typescript/components/layout/HeaderSecondLevel.d.ts +1 -1
- package/lib/typescript/components/layout/HeaderSecondLevel.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/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 +34 -32
- package/src/components/buttons/ButtonOutline.tsx +48 -79
- package/src/components/buttons/ButtonSolid.tsx +73 -55
- package/src/components/buttons/IconButton.tsx +47 -28
- package/src/components/buttons/IconButtonSolid.tsx +33 -36
- package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +6 -8
- 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 +15 -9
- package/src/components/layout/HeaderSecondLevel.tsx +45 -23
- 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 +23 -2
- 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,67 +1,10 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import { Pressable, StyleSheet } from "react-native";
|
|
3
3
|
import Animated, { interpolateColor, useAnimatedProps, useAnimatedStyle, useReducedMotion } from "react-native-reanimated";
|
|
4
|
-
import { IOButtonStyles, IOColors, hexToRgba, useIONewTypeface } from "../../core/";
|
|
4
|
+
import { IOButtonStyles, IOColors, hexToRgba, useIONewTypeface, useIOTheme } from "../../core/";
|
|
5
5
|
import { useScaleAnimation } from "../../hooks";
|
|
6
6
|
import { AnimatedIcon, IconClassComponent } from "../icons";
|
|
7
7
|
import { IOText, buttonTextFontSize } from "../typography";
|
|
8
|
-
const mapColorStates = {
|
|
9
|
-
// Primary button
|
|
10
|
-
primary: {
|
|
11
|
-
border: {
|
|
12
|
-
default: IOColors["blueIO-500"],
|
|
13
|
-
pressed: IOColors["blueIO-600"],
|
|
14
|
-
disabled: IOColors["grey-200"]
|
|
15
|
-
},
|
|
16
|
-
background: {
|
|
17
|
-
default: hexToRgba(IOColors["blueIO-50"], 0),
|
|
18
|
-
pressed: hexToRgba(IOColors["blueIO-50"], 1),
|
|
19
|
-
disabled: "transparent"
|
|
20
|
-
},
|
|
21
|
-
label: {
|
|
22
|
-
default: IOColors["blueIO-500"],
|
|
23
|
-
pressed: IOColors["blueIO-600"],
|
|
24
|
-
disabled: IOColors["grey-700"]
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
// Contrast button
|
|
28
|
-
contrast: {
|
|
29
|
-
border: {
|
|
30
|
-
default: IOColors.white,
|
|
31
|
-
pressed: IOColors.white,
|
|
32
|
-
disabled: IOColors["blueIO-200"]
|
|
33
|
-
},
|
|
34
|
-
background: {
|
|
35
|
-
default: hexToRgba(IOColors["blueIO-600"], 0),
|
|
36
|
-
pressed: IOColors["blueIO-600"],
|
|
37
|
-
disabled: "transparent"
|
|
38
|
-
},
|
|
39
|
-
label: {
|
|
40
|
-
default: IOColors.white,
|
|
41
|
-
pressed: IOColors.white,
|
|
42
|
-
disabled: IOColors["blueIO-200"]
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
// Danger button
|
|
46
|
-
danger: {
|
|
47
|
-
border: {
|
|
48
|
-
default: IOColors["error-600"],
|
|
49
|
-
pressed: IOColors["error-600"],
|
|
50
|
-
disabled: IOColors["grey-200"]
|
|
51
|
-
},
|
|
52
|
-
background: {
|
|
53
|
-
default: hexToRgba(IOColors["error-600"], 0),
|
|
54
|
-
pressed: hexToRgba(IOColors["error-600"], 0.15),
|
|
55
|
-
disabled: "transparent"
|
|
56
|
-
},
|
|
57
|
-
label: {
|
|
58
|
-
default: IOColors["error-600"],
|
|
59
|
-
pressed: IOColors["error-600"],
|
|
60
|
-
disabled: IOColors["grey-450"]
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
|
|
65
8
|
// Icon size
|
|
66
9
|
const iconSize = 20;
|
|
67
10
|
const DISABLED_OPACITY = 0.5;
|
|
@@ -84,6 +27,7 @@ export const ButtonOutline = /*#__PURE__*/forwardRef(({
|
|
|
84
27
|
testID
|
|
85
28
|
}, ref) => {
|
|
86
29
|
var _mapColorStates$color, _mapColorStates$color2, _mapColorStates$color3, _mapColorStates$color4, _mapColorStates$color5, _mapColorStates$color6, _mapColorStates$color7;
|
|
30
|
+
const theme = useIOTheme();
|
|
87
31
|
const {
|
|
88
32
|
newTypefaceEnabled
|
|
89
33
|
} = useIONewTypeface();
|
|
@@ -95,24 +39,52 @@ export const ButtonOutline = /*#__PURE__*/forwardRef(({
|
|
|
95
39
|
} = useScaleAnimation();
|
|
96
40
|
const reducedMotion = useReducedMotion();
|
|
97
41
|
const AnimatedIOText = Animated.createAnimatedComponent(IOText);
|
|
42
|
+
const mapColorStates = {
|
|
43
|
+
// Primary button
|
|
44
|
+
primary: {
|
|
45
|
+
foreground: {
|
|
46
|
+
default: IOColors[theme["interactiveElem-default"]],
|
|
47
|
+
pressed: IOColors[theme["interactiveElem-pressed"]],
|
|
48
|
+
disabled: IOColors[theme["interactiveOutline-disabled"]]
|
|
49
|
+
},
|
|
50
|
+
background: {
|
|
51
|
+
default: hexToRgba(IOColors[theme["interactiveElem-pressed"]], 0),
|
|
52
|
+
pressed: hexToRgba(IOColors[theme["interactiveElem-pressed"]], 0.1),
|
|
53
|
+
disabled: "transparent"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
// Contrast button
|
|
57
|
+
contrast: {
|
|
58
|
+
foreground: {
|
|
59
|
+
default: IOColors.white,
|
|
60
|
+
pressed: IOColors.white,
|
|
61
|
+
disabled: IOColors["blueIO-200"]
|
|
62
|
+
},
|
|
63
|
+
background: {
|
|
64
|
+
default: hexToRgba(IOColors["blueIO-600"], 0),
|
|
65
|
+
pressed: hexToRgba(IOColors["blueIO-600"], 0.5),
|
|
66
|
+
disabled: "transparent"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
98
70
|
|
|
99
71
|
// Interpolate animation values from `isPressed` values
|
|
100
72
|
const pressedAnimationStyle = useAnimatedStyle(() => {
|
|
101
73
|
// Link color states to the pressed states
|
|
102
74
|
const backgroundColor = interpolateColor(progress.value, [0, 1], [mapColorStates[color].background.default, mapColorStates[color].background.pressed]);
|
|
103
|
-
const borderColor = interpolateColor(progress.value, [0, 1], [mapColorStates[color].
|
|
75
|
+
const borderColor = interpolateColor(progress.value, [0, 1], [mapColorStates[color].foreground.default, mapColorStates[color].foreground.pressed]);
|
|
104
76
|
return {
|
|
105
77
|
borderColor,
|
|
106
78
|
backgroundColor
|
|
107
79
|
};
|
|
108
80
|
});
|
|
109
81
|
const pressedColorLabelAnimationStyle = useAnimatedStyle(() => ({
|
|
110
|
-
color: interpolateColor(progress.value, [0, 1], [mapColorStates[color].
|
|
82
|
+
color: interpolateColor(progress.value, [0, 1], [mapColorStates[color].foreground.default, mapColorStates[color].foreground.pressed])
|
|
111
83
|
}));
|
|
112
84
|
|
|
113
85
|
// Animate the <Icon> color prop
|
|
114
86
|
const pressedColorIconAnimationStyle = useAnimatedProps(() => ({
|
|
115
|
-
color: interpolateColor(progress.value, [0, 1], [mapColorStates[color].
|
|
87
|
+
color: interpolateColor(progress.value, [0, 1], [mapColorStates[color].foreground.default, mapColorStates[color].foreground.pressed])
|
|
116
88
|
}));
|
|
117
89
|
const AnimatedIconClassComponent = Animated.createAnimatedComponent(IconClassComponent);
|
|
118
90
|
return /*#__PURE__*/React.createElement(Pressable, {
|
|
@@ -139,11 +111,11 @@ export const ButtonOutline = /*#__PURE__*/forwardRef(({
|
|
|
139
111
|
flexDirection: "row-reverse"
|
|
140
112
|
}, disabled ? {
|
|
141
113
|
backgroundColor: (_mapColorStates$color = mapColorStates[color]) === null || _mapColorStates$color === void 0 || (_mapColorStates$color = _mapColorStates$color.background) === null || _mapColorStates$color === void 0 ? void 0 : _mapColorStates$color.disabled,
|
|
142
|
-
borderColor: (_mapColorStates$color2 = mapColorStates[color]) === null || _mapColorStates$color2 === void 0 || (_mapColorStates$color2 = _mapColorStates$color2.
|
|
114
|
+
borderColor: (_mapColorStates$color2 = mapColorStates[color]) === null || _mapColorStates$color2 === void 0 || (_mapColorStates$color2 = _mapColorStates$color2.foreground) === null || _mapColorStates$color2 === void 0 ? void 0 : _mapColorStates$color2.disabled,
|
|
143
115
|
opacity: DISABLED_OPACITY
|
|
144
116
|
} : {
|
|
145
117
|
backgroundColor: (_mapColorStates$color3 = mapColorStates[color]) === null || _mapColorStates$color3 === void 0 || (_mapColorStates$color3 = _mapColorStates$color3.background) === null || _mapColorStates$color3 === void 0 ? void 0 : _mapColorStates$color3.default,
|
|
146
|
-
borderColor: (_mapColorStates$color4 = mapColorStates[color]) === null || _mapColorStates$color4 === void 0 ? void 0 : _mapColorStates$color4.
|
|
118
|
+
borderColor: (_mapColorStates$color4 = mapColorStates[color]) === null || _mapColorStates$color4 === void 0 ? void 0 : _mapColorStates$color4.foreground.default
|
|
147
119
|
},
|
|
148
120
|
/* Prevent Reanimated from overriding background colors
|
|
149
121
|
if button is disabled */
|
|
@@ -152,12 +124,12 @@ export const ButtonOutline = /*#__PURE__*/forwardRef(({
|
|
|
152
124
|
allowFontScaling: true,
|
|
153
125
|
name: icon,
|
|
154
126
|
animatedProps: pressedColorIconAnimationStyle,
|
|
155
|
-
color: (_mapColorStates$color5 = mapColorStates[color]) === null || _mapColorStates$color5 === void 0 || (_mapColorStates$color5 = _mapColorStates$color5.
|
|
127
|
+
color: (_mapColorStates$color5 = mapColorStates[color]) === null || _mapColorStates$color5 === void 0 || (_mapColorStates$color5 = _mapColorStates$color5.foreground) === null || _mapColorStates$color5 === void 0 ? void 0 : _mapColorStates$color5.default,
|
|
156
128
|
size: iconSize
|
|
157
129
|
}) : /*#__PURE__*/React.createElement(AnimatedIcon, {
|
|
158
130
|
allowFontScaling: true,
|
|
159
131
|
name: icon,
|
|
160
|
-
color: (_mapColorStates$color6 = mapColorStates[color]) === null || _mapColorStates$color6 === void 0 || (_mapColorStates$color6 = _mapColorStates$color6.
|
|
132
|
+
color: (_mapColorStates$color6 = mapColorStates[color]) === null || _mapColorStates$color6 === void 0 || (_mapColorStates$color6 = _mapColorStates$color6.foreground) === null || _mapColorStates$color6 === void 0 ? void 0 : _mapColorStates$color6.disabled,
|
|
161
133
|
size: iconSize
|
|
162
134
|
})), /*#__PURE__*/React.createElement(AnimatedIOText, {
|
|
163
135
|
font: newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
|
|
@@ -169,7 +141,7 @@ export const ButtonOutline = /*#__PURE__*/forwardRef(({
|
|
|
169
141
|
numberOfLines: 1,
|
|
170
142
|
ellipsizeMode: "tail",
|
|
171
143
|
style: [IOButtonStyles.label, disabled ? {
|
|
172
|
-
color: (_mapColorStates$color7 = mapColorStates[color]) === null || _mapColorStates$color7 === void 0 || (_mapColorStates$color7 = _mapColorStates$color7.
|
|
144
|
+
color: (_mapColorStates$color7 = mapColorStates[color]) === null || _mapColorStates$color7 === void 0 || (_mapColorStates$color7 = _mapColorStates$color7.foreground) === null || _mapColorStates$color7 === void 0 ? void 0 : _mapColorStates$color7.disabled
|
|
173
145
|
} : {
|
|
174
146
|
...pressedColorLabelAnimationStyle
|
|
175
147
|
}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","forwardRef","Pressable","StyleSheet","Animated","interpolateColor","useAnimatedProps","useAnimatedStyle","useReducedMotion","IOButtonStyles","IOColors","hexToRgba","useIONewTypeface","useScaleAnimation","AnimatedIcon","IconClassComponent","IOText","buttonTextFontSize","
|
|
1
|
+
{"version":3,"names":["React","forwardRef","Pressable","StyleSheet","Animated","interpolateColor","useAnimatedProps","useAnimatedStyle","useReducedMotion","IOButtonStyles","IOColors","hexToRgba","useIONewTypeface","useIOTheme","useScaleAnimation","AnimatedIcon","IconClassComponent","IOText","buttonTextFontSize","iconSize","DISABLED_OPACITY","ICON_MARGIN","IOButtonStylesLocal","create","buttonWithBorder","borderWidth","ButtonOutline","color","label","fullWidth","disabled","icon","iconPosition","onPress","accessibilityLabel","accessibilityHint","testID","ref","_mapColorStates$color","_mapColorStates$color2","_mapColorStates$color3","_mapColorStates$color4","_mapColorStates$color5","_mapColorStates$color6","_mapColorStates$color7","theme","newTypefaceEnabled","progress","onPressIn","onPressOut","scaleAnimatedStyle","reducedMotion","AnimatedIOText","createAnimatedComponent","mapColorStates","primary","foreground","default","pressed","background","contrast","white","pressedAnimationStyle","backgroundColor","value","borderColor","pressedColorLabelAnimationStyle","pressedColorIconAnimationStyle","AnimatedIconClassComponent","createElement","accessibilityRole","accessibilityState","accessible","style","dimensionsDefault","View","button","buttonSizeDefault","paddingHorizontal","columnGap","flexDirection","opacity","allowFontScaling","name","animatedProps","size","font","weight","accessibilityElementsHidden","importantForAccessibility","numberOfLines","ellipsizeMode"],"sourceRoot":"../../../../src","sources":["components/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AAK,EACpBE,QAAQ,GACJ;MAAEH,KAAK,GAAAiB,sBAAA,GAAEU,cAAc,CAAC3B,KAAK,CAAC,cAAAiB,sBAAA,gBAAAA,sBAAA,GAArBA,sBAAA,CAAuBY,UAAU,cAAAZ,sBAAA,uBAAjCA,sBAAA,CAAmCd;IAAS,CAAC,GACtD;MAAE,GAAGoC;IAAgC,CAAC;EAC1C,GAEDtC,KACa,CACH,CACN,CAAC;AAEhB,CACF,CAAC;AAED,eAAeF,aAAa"}
|
|
@@ -1,54 +1,18 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef } from "react";
|
|
2
|
-
import { Pressable
|
|
1
|
+
import React, { forwardRef, useCallback, useEffect, useRef } from "react";
|
|
2
|
+
import { Pressable } from "react-native";
|
|
3
3
|
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
4
4
|
import Animated, { interpolateColor, useAnimatedStyle, useReducedMotion } from "react-native-reanimated";
|
|
5
|
-
import { IOButtonStyles, IOColors, enterTransitionInnerContent, enterTransitionInnerContentSmall, exitTransitionInnerContent } from "../../core";
|
|
5
|
+
import { IOButtonStyles, IOColors, enterTransitionInnerContent, enterTransitionInnerContentSmall, exitTransitionInnerContent, useIOTheme } from "../../core";
|
|
6
6
|
import { useScaleAnimation } from "../../hooks";
|
|
7
7
|
import { Icon } from "../icons";
|
|
8
8
|
import { LoadingSpinner } from "../loadingSpinner";
|
|
9
9
|
import { ButtonText } from "../typography/ButtonText";
|
|
10
|
-
const colorPrimaryButtonDisabled = "grey-200";
|
|
11
10
|
const ICON_MARGIN = 8;
|
|
12
11
|
const DISABLED_OPACITY = 0.5;
|
|
13
12
|
|
|
14
13
|
// Icon size
|
|
15
14
|
const iconSize = 20;
|
|
16
|
-
const
|
|
17
|
-
backgroundDisabled: {
|
|
18
|
-
backgroundColor: IOColors[colorPrimaryButtonDisabled],
|
|
19
|
-
opacity: DISABLED_OPACITY
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const mapColorStates = {
|
|
23
|
-
// Primary button
|
|
24
|
-
primary: {
|
|
25
|
-
default: IOColors["blueIO-500"],
|
|
26
|
-
pressed: IOColors["blueIO-600"],
|
|
27
|
-
label: {
|
|
28
|
-
default: "white",
|
|
29
|
-
disabled: "grey-700"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
// Danger button
|
|
33
|
-
danger: {
|
|
34
|
-
default: IOColors["error-600"],
|
|
35
|
-
pressed: IOColors["error-500"],
|
|
36
|
-
label: {
|
|
37
|
-
default: "white",
|
|
38
|
-
disabled: "grey-700"
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
// Contrast button
|
|
42
|
-
contrast: {
|
|
43
|
-
default: IOColors.white,
|
|
44
|
-
pressed: IOColors["blueIO-50"],
|
|
45
|
-
label: {
|
|
46
|
-
default: "blueIO-500",
|
|
47
|
-
disabled: "grey-700"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
export const ButtonSolid = /*#__PURE__*/React.forwardRef(({
|
|
15
|
+
export const ButtonSolid = /*#__PURE__*/forwardRef(({
|
|
52
16
|
color = "primary",
|
|
53
17
|
label,
|
|
54
18
|
fullWidth = false,
|
|
@@ -61,7 +25,8 @@ export const ButtonSolid = /*#__PURE__*/React.forwardRef(({
|
|
|
61
25
|
accessibilityHint,
|
|
62
26
|
testID
|
|
63
27
|
}, ref) => {
|
|
64
|
-
var _mapColorStates$color, _mapColorStates$color2, _mapColorStates$color3;
|
|
28
|
+
var _mapColorStates$color, _mapColorStates$color2, _mapColorStates$color3, _mapColorStates$color4;
|
|
29
|
+
const theme = useIOTheme();
|
|
65
30
|
const {
|
|
66
31
|
progress,
|
|
67
32
|
onPressIn,
|
|
@@ -69,6 +34,44 @@ export const ButtonSolid = /*#__PURE__*/React.forwardRef(({
|
|
|
69
34
|
scaleAnimatedStyle
|
|
70
35
|
} = useScaleAnimation();
|
|
71
36
|
const reducedMotion = useReducedMotion();
|
|
37
|
+
const mapColorStates = {
|
|
38
|
+
// Primary button
|
|
39
|
+
primary: {
|
|
40
|
+
background: {
|
|
41
|
+
default: IOColors[theme["interactiveElem-default"]],
|
|
42
|
+
pressed: IOColors[theme["interactiveElem-pressed"]],
|
|
43
|
+
disabled: IOColors[theme["interactiveElem-disabled"]]
|
|
44
|
+
},
|
|
45
|
+
foreground: {
|
|
46
|
+
default: theme["buttonText-default"],
|
|
47
|
+
disabled: theme["buttonText-disabled"]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
// Danger button
|
|
51
|
+
danger: {
|
|
52
|
+
background: {
|
|
53
|
+
default: IOColors["error-600"],
|
|
54
|
+
pressed: IOColors["error-500"],
|
|
55
|
+
disabled: IOColors[theme["interactiveElem-disabled"]]
|
|
56
|
+
},
|
|
57
|
+
foreground: {
|
|
58
|
+
default: theme["buttonText-default"],
|
|
59
|
+
disabled: theme["buttonText-disabled"]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
// Contrast button
|
|
63
|
+
contrast: {
|
|
64
|
+
background: {
|
|
65
|
+
default: IOColors.white,
|
|
66
|
+
pressed: IOColors["blueIO-50"],
|
|
67
|
+
disabled: IOColors["blueIO-50"]
|
|
68
|
+
},
|
|
69
|
+
foreground: {
|
|
70
|
+
default: "blueIO-500",
|
|
71
|
+
disabled: "blueIO-500"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
72
75
|
|
|
73
76
|
/* Prevent the component from triggering the `isEntering' transition
|
|
74
77
|
on the on the first render. Solution from this discussion:
|
|
@@ -83,7 +86,7 @@ export const ButtonSolid = /*#__PURE__*/React.forwardRef(({
|
|
|
83
86
|
// Interpolate animation values from `isPressed` values
|
|
84
87
|
const pressedAnimationStyle = useAnimatedStyle(() => {
|
|
85
88
|
// Link color states to the pressed states
|
|
86
|
-
const backgroundColor = interpolateColor(progress.value, [0, 1], [mapColorStates[color].default, mapColorStates[color].pressed]);
|
|
89
|
+
const backgroundColor = interpolateColor(progress.value, [0, 1], [mapColorStates[color].background.default, mapColorStates[color].background.pressed]);
|
|
87
90
|
return {
|
|
88
91
|
backgroundColor
|
|
89
92
|
};
|
|
@@ -98,8 +101,11 @@ export const ButtonSolid = /*#__PURE__*/React.forwardRef(({
|
|
|
98
101
|
onPress(event);
|
|
99
102
|
}, [loading, onPress]);
|
|
100
103
|
|
|
104
|
+
// Background
|
|
105
|
+
const backgroundColor = disabled ? (_mapColorStates$color = mapColorStates[color]) === null || _mapColorStates$color === void 0 || (_mapColorStates$color = _mapColorStates$color.background) === null || _mapColorStates$color === void 0 ? void 0 : _mapColorStates$color.disabled : (_mapColorStates$color2 = mapColorStates[color]) === null || _mapColorStates$color2 === void 0 || (_mapColorStates$color2 = _mapColorStates$color2.background) === null || _mapColorStates$color2 === void 0 ? void 0 : _mapColorStates$color2.default;
|
|
106
|
+
|
|
101
107
|
// Label & Icons colors
|
|
102
|
-
const foregroundColor = disabled ? (_mapColorStates$
|
|
108
|
+
const foregroundColor = disabled ? (_mapColorStates$color3 = mapColorStates[color]) === null || _mapColorStates$color3 === void 0 || (_mapColorStates$color3 = _mapColorStates$color3.foreground) === null || _mapColorStates$color3 === void 0 ? void 0 : _mapColorStates$color3.disabled : (_mapColorStates$color4 = mapColorStates[color]) === null || _mapColorStates$color4 === void 0 || (_mapColorStates$color4 = _mapColorStates$color4.foreground) === null || _mapColorStates$color4 === void 0 ? void 0 : _mapColorStates$color4.default;
|
|
103
109
|
return /*#__PURE__*/React.createElement(Pressable, {
|
|
104
110
|
testID: testID,
|
|
105
111
|
ref: ref,
|
|
@@ -120,12 +126,13 @@ export const ButtonSolid = /*#__PURE__*/React.forwardRef(({
|
|
|
120
126
|
style: !fullWidth ? IOButtonStyles.dimensionsDefault : {}
|
|
121
127
|
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
122
128
|
style: [IOButtonStyles.button, IOButtonStyles.buttonSizeDefault, {
|
|
129
|
+
backgroundColor,
|
|
123
130
|
overflow: "hidden"
|
|
124
131
|
}, fullWidth && {
|
|
125
132
|
paddingHorizontal: 16
|
|
126
|
-
}, disabled ?
|
|
127
|
-
|
|
128
|
-
},
|
|
133
|
+
}, disabled ? {
|
|
134
|
+
opacity: DISABLED_OPACITY
|
|
135
|
+
} : {},
|
|
129
136
|
/* Prevent Reanimated from overriding background colors
|
|
130
137
|
if button is disabled */
|
|
131
138
|
!disabled && !reducedMotion && scaleAnimatedStyle, !disabled && pressedAnimationStyle]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useEffect","useRef","Pressable","
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useCallback","useEffect","useRef","Pressable","ReactNativeHapticFeedback","Animated","interpolateColor","useAnimatedStyle","useReducedMotion","IOButtonStyles","IOColors","enterTransitionInnerContent","enterTransitionInnerContentSmall","exitTransitionInnerContent","useIOTheme","useScaleAnimation","Icon","LoadingSpinner","ButtonText","ICON_MARGIN","DISABLED_OPACITY","iconSize","ButtonSolid","color","label","fullWidth","disabled","loading","icon","iconPosition","onPress","accessibilityLabel","accessibilityHint","testID","ref","_mapColorStates$color","_mapColorStates$color2","_mapColorStates$color3","_mapColorStates$color4","theme","progress","onPressIn","onPressOut","scaleAnimatedStyle","reducedMotion","mapColorStates","primary","background","default","pressed","foreground","danger","contrast","white","isMounted","current","pressedAnimationStyle","backgroundColor","value","handleOnPress","event","trigger","foregroundColor","createElement","accessible","accessibilityState","busy","accessibilityRole","style","dimensionsDefault","View","button","buttonSizeDefault","overflow","paddingHorizontal","opacity","buttonInner","entering","undefined","exiting","columnGap","flexDirection","allowFontScaling","name","size","numberOfLines","ellipsizeMode","accessibilityElementsHidden","importantForAccessibility"],"sourceRoot":"../../../../src","sources":["components/buttons/ButtonSolid.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAEVC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,MAAM,QACD,OAAO;AACd,SAGEC,SAAS,QAEJ,cAAc;AACrB,OAAOC,yBAAyB,MAAM,8BAA8B;A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AAE;IAAc,CAAC,CAC1D;IACFJ,QAAQ,EACNvB,SAAS,CAACC,OAAO,GAAG5C,2BAA2B,GAAGmE;EACnD,GAEAlD,IAAI,iBACH9B,KAAA,CAAAiE,aAAA,CAAC/C,IAAI;IACHkE,gBAAgB;IAChBC,IAAI,EAAEvD,IAAK;IACXwD,IAAI,EAAE/D,QAAS;IACfE,KAAK,EAAEuC;EAAgB,CACxB,CACF,eACDhE,KAAA,CAAAiE,aAAA,CAAC7C,UAAU;IACTK,KAAK,EAAEuC,eAAgB;IACvBM,KAAK,EAAE3D,cAAc,CAACe,KAAM;IAC5B6D,aAAa,EAAE,CAAE;IACjBC,aAAa,EAAC,MAAM;IACpBtB,UAAU,EAAE,KAAM;IAClBuB,2BAA2B;IAC3BC,yBAAyB,EAAC;EAAqB,GAE9ChE,KACS,CACC,CAEJ,CACN,CAAC;AAEhB,CACF,CAAC;AAED,eAAeF,WAAW"}
|
|
@@ -1,38 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Pressable } from "react-native";
|
|
3
3
|
import Animated, { interpolateColor, useAnimatedProps, useReducedMotion } from "react-native-reanimated";
|
|
4
|
-
import { IOColors, IOIconButtonStyles, IOStyles, hexToRgba } from "../../core";
|
|
4
|
+
import { IOColors, IOIconButtonStyles, IOStyles, IOThemeLight, hexToRgba, useIOTheme } from "../../core";
|
|
5
5
|
import { useScaleAnimation } from "../../hooks";
|
|
6
6
|
import { AnimatedIcon, IconClassComponent } from "../icons";
|
|
7
|
-
const mapColorStates = {
|
|
8
|
-
// Primary button
|
|
9
|
-
primary: {
|
|
10
|
-
icon: {
|
|
11
|
-
default: IOColors["blueIO-500"],
|
|
12
|
-
pressed: IOColors["blueIO-600"],
|
|
13
|
-
disabled: hexToRgba(IOColors["blueIO-500"], 0.25)
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
// Neutral button
|
|
17
|
-
neutral: {
|
|
18
|
-
icon: {
|
|
19
|
-
default: IOColors.black,
|
|
20
|
-
pressed: IOColors["grey-850"],
|
|
21
|
-
disabled: IOColors["grey-450"]
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
// Contrast button
|
|
25
|
-
contrast: {
|
|
26
|
-
icon: {
|
|
27
|
-
default: IOColors.white,
|
|
28
|
-
pressed: hexToRgba(IOColors.white, 0.85),
|
|
29
|
-
disabled: hexToRgba(IOColors.white, 0.25)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
7
|
const AnimatedIconClassComponent = Animated.createAnimatedComponent(IconClassComponent);
|
|
34
8
|
export const IconButton = ({
|
|
35
9
|
color = "primary",
|
|
10
|
+
persistentColorMode = false,
|
|
36
11
|
icon,
|
|
37
12
|
iconSize = 24,
|
|
38
13
|
disabled = false,
|
|
@@ -42,6 +17,7 @@ export const IconButton = ({
|
|
|
42
17
|
testID
|
|
43
18
|
}) => {
|
|
44
19
|
var _mapColorStates$color, _mapColorStates$color2;
|
|
20
|
+
const theme = useIOTheme();
|
|
45
21
|
const {
|
|
46
22
|
progress,
|
|
47
23
|
onPressIn,
|
|
@@ -49,6 +25,32 @@ export const IconButton = ({
|
|
|
49
25
|
scaleAnimatedStyle
|
|
50
26
|
} = useScaleAnimation("exaggerated");
|
|
51
27
|
const reducedMotion = useReducedMotion();
|
|
28
|
+
const mapColorStates = {
|
|
29
|
+
// Primary button
|
|
30
|
+
primary: {
|
|
31
|
+
icon: {
|
|
32
|
+
default: IOColors[theme["interactiveElem-default"]],
|
|
33
|
+
pressed: IOColors[theme["interactiveElem-pressed"]],
|
|
34
|
+
disabled: IOColors[theme["interactiveElem-disabled"]]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
// Neutral button
|
|
38
|
+
neutral: {
|
|
39
|
+
icon: {
|
|
40
|
+
default: persistentColorMode ? IOColors[IOThemeLight["neutralButton-default"]] : IOColors[theme["neutralButton-default"]],
|
|
41
|
+
pressed: persistentColorMode ? IOColors[IOThemeLight["neutralButton-pressed"]] : IOColors[theme["neutralButton-pressed"]],
|
|
42
|
+
disabled: persistentColorMode ? IOColors[IOThemeLight["neutralButton-disabled"]] : IOColors[theme["neutralButton-disabled"]]
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
// Contrast button
|
|
46
|
+
contrast: {
|
|
47
|
+
icon: {
|
|
48
|
+
default: IOColors.white,
|
|
49
|
+
pressed: hexToRgba(IOColors.white, 0.85),
|
|
50
|
+
disabled: hexToRgba(IOColors.white, 0.25)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
52
54
|
|
|
53
55
|
// Animate the <Icon> color prop
|
|
54
56
|
const animatedColor = useAnimatedProps(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Pressable","Animated","interpolateColor","useAnimatedProps","useReducedMotion","IOColors","IOIconButtonStyles","IOStyles","hexToRgba","useScaleAnimation","AnimatedIcon","IconClassComponent","
|
|
1
|
+
{"version":3,"names":["React","Pressable","Animated","interpolateColor","useAnimatedProps","useReducedMotion","IOColors","IOIconButtonStyles","IOStyles","IOThemeLight","hexToRgba","useIOTheme","useScaleAnimation","AnimatedIcon","IconClassComponent","AnimatedIconClassComponent","createAnimatedComponent","IconButton","color","persistentColorMode","icon","iconSize","disabled","onPress","accessibilityLabel","accessibilityHint","testID","_mapColorStates$color","_mapColorStates$color2","theme","progress","onPressIn","onPressOut","scaleAnimatedStyle","reducedMotion","mapColorStates","primary","default","pressed","neutral","contrast","white","animatedColor","iconColor","value","createElement","accessible","accessibilityRole","accessibilityState","hitSlop","View","style","buttonSizeSmall","alignCenter","centerJustified","allowFontScaling","name","size","animatedProps"],"sourceRoot":"../../../../src","sources":["components/buttons/IconButton.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAgCC,SAAS,QAAQ,cAAc;AAC/D,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,QACX,yBAAyB;AAChC,SACEC,QAA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,KAAA,CAAA6C,aAAA,CAAC3C,QAAQ,CAACgD,IAAI;IACZC,KAAK,EAAE,CACL5C,kBAAkB,CAAC6C,eAAe,EAClC5C,QAAQ,CAAC6C,WAAW,EACpB7C,QAAQ,CAAC8C,eAAe,EACxB,CAAChC,QAAQ,IAAI,CAACY,aAAa,IAAID,kBAAkB;EACjD,GAED,CAACX,QAAQ,gBACRtB,KAAA,CAAA6C,aAAA,CAAC9B,0BAA0B;IACzBwC,gBAAgB;IAChBC,IAAI,EAAEpC,IAAK;IACXqC,IAAI,EAAEpC,QAAS;IACfqC,aAAa,EAAEhB,aAAc;IAC7BxB,KAAK,GAAAS,qBAAA,GAAEQ,cAAc,CAACjB,KAAK,CAAC,cAAAS,qBAAA,gBAAAA,qBAAA,GAArBA,qBAAA,CAAuBP,IAAI,cAAAO,qBAAA,uBAA3BA,qBAAA,CAA6BU;EAAQ,CAC7C,CAAC,gBAEFrC,KAAA,CAAA6C,aAAA,CAAChC,YAAY;IACX0C,gBAAgB;IAChBC,IAAI,EAAEpC,IAAK;IACXqC,IAAI,EAAEpC,QAAS;IACfH,KAAK,GAAAU,sBAAA,GAAEO,cAAc,CAACjB,KAAK,CAAC,cAAAU,sBAAA,gBAAAA,sBAAA,GAArBA,sBAAA,CAAuBR,IAAI,cAAAQ,sBAAA,uBAA3BA,sBAAA,CAA6BN;EAAS,CAC9C,CAEU,CACN,CAAC;AAEhB,CAAC;AAED,eAAeL,UAAU"}
|
|
@@ -1,35 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Pressable } from "react-native";
|
|
3
3
|
import Animated, { interpolateColor, useAnimatedStyle, useReducedMotion } from "react-native-reanimated";
|
|
4
|
-
import { IOButtonStyles, IOIconButtonStyles } from "../../core";
|
|
4
|
+
import { IOButtonStyles, IOIconButtonStyles, useIOTheme } from "../../core";
|
|
5
5
|
import { IOColors, hexToRgba } from "../../core/IOColors";
|
|
6
6
|
import { useScaleAnimation } from "../../hooks";
|
|
7
7
|
import { AnimatedIcon } from "../icons";
|
|
8
|
-
const mapColorStates = {
|
|
9
|
-
// Primary button
|
|
10
|
-
primary: {
|
|
11
|
-
background: {
|
|
12
|
-
default: IOColors["blueIO-500"],
|
|
13
|
-
pressed: IOColors["blueIO-600"],
|
|
14
|
-
disabled: IOColors["grey-100"]
|
|
15
|
-
},
|
|
16
|
-
icon: {
|
|
17
|
-
default: IOColors.white,
|
|
18
|
-
disabled: IOColors["grey-450"]
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
contrast: {
|
|
22
|
-
background: {
|
|
23
|
-
default: IOColors.white,
|
|
24
|
-
pressed: IOColors["blueIO-50"],
|
|
25
|
-
disabled: hexToRgba(IOColors.white, 0.25)
|
|
26
|
-
},
|
|
27
|
-
icon: {
|
|
28
|
-
default: IOColors["blueIO-500"],
|
|
29
|
-
disabled: IOColors["blueIO-500"]
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
8
|
export const IconButtonSolid = ({
|
|
34
9
|
icon,
|
|
35
10
|
color = "primary",
|
|
@@ -40,6 +15,7 @@ export const IconButtonSolid = ({
|
|
|
40
15
|
testID
|
|
41
16
|
}) => {
|
|
42
17
|
var _mapColorStates$color, _mapColorStates$color2, _mapColorStates$color3, _mapColorStates$color4;
|
|
18
|
+
const theme = useIOTheme();
|
|
43
19
|
const {
|
|
44
20
|
progress,
|
|
45
21
|
onPressIn,
|
|
@@ -47,6 +23,31 @@ export const IconButtonSolid = ({
|
|
|
47
23
|
scaleAnimatedStyle
|
|
48
24
|
} = useScaleAnimation("exaggerated");
|
|
49
25
|
const reducedMotion = useReducedMotion();
|
|
26
|
+
const mapColorStates = {
|
|
27
|
+
// Primary button
|
|
28
|
+
primary: {
|
|
29
|
+
background: {
|
|
30
|
+
default: IOColors[theme["interactiveElem-default"]],
|
|
31
|
+
pressed: IOColors[theme["interactiveElem-pressed"]],
|
|
32
|
+
disabled: IOColors[theme["interactiveElem-disabled"]]
|
|
33
|
+
},
|
|
34
|
+
icon: {
|
|
35
|
+
default: IOColors[theme["buttonText-default"]],
|
|
36
|
+
disabled: IOColors[theme["buttonText-disabled"]]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
contrast: {
|
|
40
|
+
background: {
|
|
41
|
+
default: IOColors.white,
|
|
42
|
+
pressed: IOColors["blueIO-50"],
|
|
43
|
+
disabled: hexToRgba(IOColors.white, 0.25)
|
|
44
|
+
},
|
|
45
|
+
icon: {
|
|
46
|
+
default: IOColors["blueIO-500"],
|
|
47
|
+
disabled: IOColors["blueIO-500"]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
50
51
|
const backgroundColorAnimationStyle = useAnimatedStyle(() => ({
|
|
51
52
|
backgroundColor: interpolateColor(progress.value, [0, 1], [mapColorStates[color].background.default, mapColorStates[color].background.pressed])
|
|
52
53
|
}));
|