@pagopa/io-app-design-system 1.25.1 → 1.27.0
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/README.md +1 -0
- package/lib/commonjs/components/accordion/AccordionItem.js +1 -0
- package/lib/commonjs/components/accordion/AccordionItem.js.map +1 -1
- package/lib/commonjs/components/alert/Alert.js +3 -2
- package/lib/commonjs/components/alert/Alert.js.map +1 -1
- package/lib/commonjs/components/avatar/Avatar.js +18 -11
- package/lib/commonjs/components/avatar/Avatar.js.map +1 -1
- package/lib/commonjs/components/avatar/__test__/__snapshots__/avatar.test.tsx.snap +60 -28
- package/lib/commonjs/components/badge/Badge.js +1 -0
- package/lib/commonjs/components/badge/Badge.js.map +1 -1
- package/lib/commonjs/components/badge/__test__/__snapshots__/badge.test.tsx.snap +2 -0
- package/lib/commonjs/components/banner/Banner.js +2 -2
- package/lib/commonjs/components/banner/Banner.js.map +1 -1
- package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +8 -0
- package/lib/commonjs/components/buttons/ButtonExtendedOutline.js +3 -2
- package/lib/commonjs/components/buttons/ButtonExtendedOutline.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonLink.js +5 -1
- package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonOutline.js +6 -3
- package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonSolid.js +4 -1
- package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +20 -2
- package/lib/commonjs/components/checkbox/AnimatedCheckbox.js +4 -2
- package/lib/commonjs/components/checkbox/AnimatedCheckbox.js.map +1 -1
- package/lib/commonjs/components/checkbox/AnimatedMessageCheckbox.js +4 -3
- package/lib/commonjs/components/checkbox/AnimatedMessageCheckbox.js.map +1 -1
- package/lib/commonjs/components/divider/Divider.js +1 -1
- package/lib/commonjs/components/divider/Divider.js.map +1 -1
- package/lib/commonjs/components/layout/GradientBottomActions.js +25 -5
- package/lib/commonjs/components/layout/GradientBottomActions.js.map +1 -1
- package/lib/commonjs/components/layout/GradientScrollView.js +1 -1
- package/lib/commonjs/components/layout/HeaderFirstLevel.js +12 -1
- package/lib/commonjs/components/layout/HeaderFirstLevel.js.map +1 -1
- package/lib/commonjs/components/layout/HeaderSecondLevel.js +21 -6
- package/lib/commonjs/components/layout/HeaderSecondLevel.js.map +1 -1
- package/lib/commonjs/components/layout/ModalBSHeader.js +73 -0
- package/lib/commonjs/components/layout/ModalBSHeader.js.map +1 -0
- package/lib/commonjs/components/layout/index.js +11 -0
- package/lib/commonjs/components/layout/index.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemAction.js +2 -1
- package/lib/commonjs/components/listitems/ListItemAction.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemInfoCopy.js +1 -0
- package/lib/commonjs/components/listitems/ListItemInfoCopy.js.map +1 -1
- package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +6 -0
- package/lib/commonjs/components/otpInput/BoxedInput.js +2 -1
- package/lib/commonjs/components/otpInput/BoxedInput.js.map +1 -1
- package/lib/commonjs/components/pictograms/Pictogram.js +15 -15
- package/lib/commonjs/components/pictograms/Pictogram.js.map +1 -1
- package/lib/commonjs/components/switch/NativeSwitch.js +5 -0
- package/lib/commonjs/components/switch/NativeSwitch.js.map +1 -1
- package/lib/commonjs/components/tabs/TabItem.js +4 -3
- package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
- package/lib/commonjs/components/tag/Tag.js +6 -5
- package/lib/commonjs/components/tag/Tag.js.map +1 -1
- package/lib/commonjs/components/textInput/TextInputBase.js +1 -0
- package/lib/commonjs/components/textInput/TextInputBase.js.map +1 -1
- package/lib/commonjs/components/toast/ToastNotification.js +1 -0
- package/lib/commonjs/components/toast/ToastNotification.js.map +1 -1
- package/lib/commonjs/core/IOColors.js +1 -18
- package/lib/commonjs/core/IOColors.js.map +1 -1
- package/lib/commonjs/core/IOSpacing.js.map +1 -1
- package/lib/commonjs/core/IOStyles.js +4 -0
- package/lib/commonjs/core/IOStyles.js.map +1 -1
- package/lib/commonjs/core/IOThemeContextProvider.js +42 -0
- package/lib/commonjs/core/IOThemeContextProvider.js.map +1 -0
- package/lib/commonjs/core/index.js +11 -0
- package/lib/commonjs/core/index.js.map +1 -1
- package/lib/module/components/accordion/AccordionItem.js +1 -0
- package/lib/module/components/accordion/AccordionItem.js.map +1 -1
- package/lib/module/components/alert/Alert.js +3 -2
- package/lib/module/components/alert/Alert.js.map +1 -1
- package/lib/module/components/avatar/Avatar.js +18 -11
- package/lib/module/components/avatar/Avatar.js.map +1 -1
- package/lib/module/components/avatar/__test__/__snapshots__/avatar.test.tsx.snap +60 -28
- package/lib/module/components/badge/Badge.js +1 -0
- package/lib/module/components/badge/Badge.js.map +1 -1
- package/lib/module/components/badge/__test__/__snapshots__/badge.test.tsx.snap +2 -0
- package/lib/module/components/banner/Banner.js +2 -2
- package/lib/module/components/banner/Banner.js.map +1 -1
- package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +8 -0
- package/lib/module/components/buttons/ButtonExtendedOutline.js +3 -2
- package/lib/module/components/buttons/ButtonExtendedOutline.js.map +1 -1
- package/lib/module/components/buttons/ButtonLink.js +5 -1
- package/lib/module/components/buttons/ButtonLink.js.map +1 -1
- package/lib/module/components/buttons/ButtonOutline.js +6 -3
- package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/module/components/buttons/ButtonSolid.js +4 -1
- package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +20 -2
- package/lib/module/components/checkbox/AnimatedCheckbox.js +4 -2
- package/lib/module/components/checkbox/AnimatedCheckbox.js.map +1 -1
- package/lib/module/components/checkbox/AnimatedMessageCheckbox.js +4 -3
- package/lib/module/components/checkbox/AnimatedMessageCheckbox.js.map +1 -1
- package/lib/module/components/divider/Divider.js +2 -2
- package/lib/module/components/divider/Divider.js.map +1 -1
- package/lib/module/components/layout/BlockButtons.js.map +1 -1
- package/lib/module/components/layout/GradientBottomActions.js +26 -6
- package/lib/module/components/layout/GradientBottomActions.js.map +1 -1
- package/lib/module/components/layout/GradientScrollView.js +1 -1
- package/lib/module/components/layout/HeaderFirstLevel.js +13 -2
- package/lib/module/components/layout/HeaderFirstLevel.js.map +1 -1
- package/lib/module/components/layout/HeaderSecondLevel.js +22 -7
- package/lib/module/components/layout/HeaderSecondLevel.js.map +1 -1
- package/lib/module/components/layout/ModalBSHeader.js +65 -0
- package/lib/module/components/layout/ModalBSHeader.js.map +1 -0
- package/lib/module/components/layout/index.js +1 -0
- package/lib/module/components/layout/index.js.map +1 -1
- package/lib/module/components/listitems/ListItemAction.js +2 -1
- package/lib/module/components/listitems/ListItemAction.js.map +1 -1
- package/lib/module/components/listitems/ListItemInfoCopy.js +1 -0
- package/lib/module/components/listitems/ListItemInfoCopy.js.map +1 -1
- package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +6 -0
- package/lib/module/components/otpInput/BoxedInput.js +3 -2
- package/lib/module/components/otpInput/BoxedInput.js.map +1 -1
- package/lib/module/components/pictograms/Pictogram.js +1 -1
- package/lib/module/components/pictograms/Pictogram.js.map +1 -1
- package/lib/module/components/switch/NativeSwitch.js +5 -0
- package/lib/module/components/switch/NativeSwitch.js.map +1 -1
- package/lib/module/components/tabs/TabItem.js +4 -3
- package/lib/module/components/tabs/TabItem.js.map +1 -1
- package/lib/module/components/tag/Tag.js +6 -5
- package/lib/module/components/tag/Tag.js.map +1 -1
- package/lib/module/components/textInput/TextInputBase.js +1 -0
- package/lib/module/components/textInput/TextInputBase.js.map +1 -1
- package/lib/module/components/toast/ToastNotification.js +1 -0
- package/lib/module/components/toast/ToastNotification.js.map +1 -1
- package/lib/module/core/IOColors.js +0 -12
- package/lib/module/core/IOColors.js.map +1 -1
- package/lib/module/core/IOSpacing.js.map +1 -1
- package/lib/module/core/IOStyles.js +4 -0
- package/lib/module/core/IOStyles.js.map +1 -1
- package/lib/module/core/IOThemeContextProvider.js +30 -0
- package/lib/module/core/IOThemeContextProvider.js.map +1 -0
- package/lib/module/core/index.js +1 -0
- package/lib/module/core/index.js.map +1 -1
- package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
- package/lib/typescript/components/avatar/Avatar.d.ts +6 -2
- package/lib/typescript/components/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/components/badge/Badge.d.ts.map +1 -1
- package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonExtendedOutline.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonLink.d.ts +11 -2
- package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonOutline.d.ts +12 -2
- package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonSolid.d.ts +28 -2
- package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
- package/lib/typescript/components/checkbox/AnimatedCheckbox.d.ts.map +1 -1
- package/lib/typescript/components/checkbox/AnimatedMessageCheckbox.d.ts.map +1 -1
- package/lib/typescript/components/layout/BlockButtons.d.ts +2 -2
- package/lib/typescript/components/layout/BlockButtons.d.ts.map +1 -1
- package/lib/typescript/components/layout/GradientBottomActions.d.ts.map +1 -1
- package/lib/typescript/components/layout/HeaderFirstLevel.d.ts.map +1 -1
- package/lib/typescript/components/layout/HeaderSecondLevel.d.ts.map +1 -1
- package/lib/typescript/components/layout/ModalBSHeader.d.ts +16 -0
- package/lib/typescript/components/layout/ModalBSHeader.d.ts.map +1 -0
- package/lib/typescript/components/layout/index.d.ts +1 -0
- package/lib/typescript/components/layout/index.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemAction.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemInfoCopy.d.ts.map +1 -1
- package/lib/typescript/components/otpInput/BoxedInput.d.ts.map +1 -1
- package/lib/typescript/components/pictograms/Pictogram.d.ts +1 -1
- package/lib/typescript/components/pictograms/Pictogram.d.ts.map +1 -1
- package/lib/typescript/components/switch/NativeSwitch.d.ts.map +1 -1
- package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -1
- package/lib/typescript/components/tag/Tag.d.ts.map +1 -1
- package/lib/typescript/components/textInput/TextInputBase.d.ts +3 -3
- package/lib/typescript/components/textInput/TextInputBase.d.ts.map +1 -1
- package/lib/typescript/components/toast/ToastNotification.d.ts.map +1 -1
- package/lib/typescript/core/IOColors.d.ts +0 -7
- package/lib/typescript/core/IOColors.d.ts.map +1 -1
- package/lib/typescript/core/IOSpacing.d.ts +1 -1
- package/lib/typescript/core/IOSpacing.d.ts.map +1 -1
- package/lib/typescript/core/IOStyles.d.ts +4 -0
- package/lib/typescript/core/IOStyles.d.ts.map +1 -1
- package/lib/typescript/core/IOThemeContextProvider.d.ts +21 -0
- package/lib/typescript/core/IOThemeContextProvider.d.ts.map +1 -0
- package/lib/typescript/core/index.d.ts +1 -0
- package/lib/typescript/core/index.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/components/accordion/AccordionItem.tsx +1 -0
- package/src/components/alert/Alert.tsx +3 -2
- package/src/components/avatar/Avatar.tsx +33 -20
- package/src/components/avatar/__test__/__snapshots__/avatar.test.tsx.snap +60 -28
- package/src/components/badge/Badge.tsx +1 -0
- package/src/components/badge/__test__/__snapshots__/badge.test.tsx.snap +2 -0
- package/src/components/banner/Banner.tsx +4 -4
- package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +8 -0
- package/src/components/buttons/ButtonExtendedOutline.tsx +3 -2
- package/src/components/buttons/ButtonLink.tsx +25 -13
- package/src/components/buttons/ButtonOutline.tsx +172 -159
- package/src/components/buttons/ButtonSolid.tsx +26 -15
- package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +20 -2
- package/src/components/checkbox/AnimatedCheckbox.tsx +4 -2
- package/src/components/checkbox/AnimatedMessageCheckbox.tsx +4 -3
- package/src/components/divider/Divider.tsx +2 -2
- package/src/components/layout/BlockButtons.tsx +2 -2
- package/src/components/layout/GradientBottomActions.tsx +22 -8
- package/src/components/layout/GradientScrollView.tsx +1 -1
- package/src/components/layout/HeaderFirstLevel.tsx +23 -8
- package/src/components/layout/HeaderSecondLevel.tsx +40 -15
- package/src/components/layout/ModalBSHeader.tsx +92 -0
- package/src/components/layout/index.tsx +1 -0
- package/src/components/listitems/ListItemAction.tsx +1 -0
- package/src/components/listitems/ListItemInfoCopy.tsx +1 -0
- package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +6 -0
- package/src/components/otpInput/BoxedInput.tsx +3 -2
- package/src/components/pictograms/Pictogram.tsx +1 -6
- package/src/components/switch/NativeSwitch.tsx +2 -0
- package/src/components/tabs/TabItem.tsx +4 -3
- package/src/components/tag/Tag.tsx +7 -6
- package/src/components/textInput/TextInputBase.tsx +4 -3
- package/src/components/toast/ToastNotification.tsx +1 -0
- package/src/core/IOColors.ts +1 -11
- package/src/core/IOSpacing.ts +2 -1
- package/src/core/IOStyles.ts +6 -0
- package/src/core/IOThemeContextProvider.tsx +50 -0
- package/src/core/index.ts +1 -0
|
@@ -38,6 +38,7 @@ exports[`Test Banner Components - Experimental Enabled Banner Snapshot 1`] = `
|
|
|
38
38
|
{
|
|
39
39
|
"alignContent": "center",
|
|
40
40
|
"alignItems": "flex-start",
|
|
41
|
+
"borderCurve": "continuous",
|
|
41
42
|
"borderRadius": 8,
|
|
42
43
|
"flexDirection": "row",
|
|
43
44
|
},
|
|
@@ -186,8 +187,11 @@ exports[`Test Banner Components - Experimental Enabled Banner Snapshot 1`] = `
|
|
|
186
187
|
}
|
|
187
188
|
>
|
|
188
189
|
<Text
|
|
190
|
+
accessibilityElementsHidden={true}
|
|
191
|
+
accessible={false}
|
|
189
192
|
allowFontScaling={true}
|
|
190
193
|
ellipsizeMode="tail"
|
|
194
|
+
importantForAccessibility="no-hide-descendants"
|
|
191
195
|
maxFontSizeMultiplier={1.3}
|
|
192
196
|
numberOfLines={1}
|
|
193
197
|
style={
|
|
@@ -353,6 +357,7 @@ exports[`Test Banner Components Banner Snapshot 1`] = `
|
|
|
353
357
|
{
|
|
354
358
|
"alignContent": "center",
|
|
355
359
|
"alignItems": "flex-start",
|
|
360
|
+
"borderCurve": "continuous",
|
|
356
361
|
"borderRadius": 8,
|
|
357
362
|
"flexDirection": "row",
|
|
358
363
|
},
|
|
@@ -501,8 +506,11 @@ exports[`Test Banner Components Banner Snapshot 1`] = `
|
|
|
501
506
|
}
|
|
502
507
|
>
|
|
503
508
|
<Text
|
|
509
|
+
accessibilityElementsHidden={true}
|
|
510
|
+
accessible={false}
|
|
504
511
|
allowFontScaling={false}
|
|
505
512
|
ellipsizeMode="tail"
|
|
513
|
+
importantForAccessibility="no-hide-descendants"
|
|
506
514
|
maxFontSizeMultiplier={1.3}
|
|
507
515
|
numberOfLines={1}
|
|
508
516
|
style={
|
|
@@ -13,9 +13,9 @@ import Animated, {
|
|
|
13
13
|
useSharedValue,
|
|
14
14
|
withSpring
|
|
15
15
|
} from "react-native-reanimated";
|
|
16
|
+
import { IOColors, IOScaleValues, IOSpringValues, IOStyles } from "../../core";
|
|
16
17
|
import { IOIcons, Icon } from "../icons";
|
|
17
18
|
import { H6, LabelSmall } from "../typography";
|
|
18
|
-
import { IOScaleValues, IOSpringValues, IOColors, IOStyles } from "../../core";
|
|
19
19
|
|
|
20
20
|
type Props = {
|
|
21
21
|
label: string;
|
|
@@ -33,7 +33,8 @@ const styles = StyleSheet.create({
|
|
|
33
33
|
paddingHorizontal: 16,
|
|
34
34
|
paddingVertical: 16,
|
|
35
35
|
borderRadius: 8,
|
|
36
|
-
|
|
36
|
+
borderCurve: "continuous",
|
|
37
|
+
borderColor: IOColors["grey-100"],
|
|
37
38
|
backgroundColor: IOColors.white,
|
|
38
39
|
borderStyle: "solid",
|
|
39
40
|
borderWidth: 1
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React, { useCallback, useMemo } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
GestureResponderEvent,
|
|
4
|
+
Pressable,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
View
|
|
7
|
+
} from "react-native";
|
|
3
8
|
import Animated, {
|
|
4
9
|
Extrapolate,
|
|
5
10
|
interpolate,
|
|
@@ -112,18 +117,21 @@ const IOButtonLegacyStylesLocal = StyleSheet.create({
|
|
|
112
117
|
}
|
|
113
118
|
});
|
|
114
119
|
|
|
115
|
-
export const ButtonLink = React.
|
|
116
|
-
(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
export const ButtonLink = React.forwardRef<View, ButtonLinkProps>(
|
|
121
|
+
(
|
|
122
|
+
{
|
|
123
|
+
color = "primary",
|
|
124
|
+
label,
|
|
125
|
+
disabled = false,
|
|
126
|
+
icon,
|
|
127
|
+
iconPosition = "start",
|
|
128
|
+
onPress,
|
|
129
|
+
accessibilityLabel,
|
|
130
|
+
accessibilityHint,
|
|
131
|
+
testID
|
|
132
|
+
},
|
|
133
|
+
ref
|
|
134
|
+
) => {
|
|
127
135
|
const isPressed = useSharedValue(0);
|
|
128
136
|
const { isExperimental } = useIOExperimentalDesign();
|
|
129
137
|
|
|
@@ -203,6 +211,7 @@ export const ButtonLink = React.memo(
|
|
|
203
211
|
|
|
204
212
|
return (
|
|
205
213
|
<Pressable
|
|
214
|
+
ref={ref}
|
|
206
215
|
accessibilityLabel={accessibilityLabel}
|
|
207
216
|
accessibilityHint={accessibilityHint}
|
|
208
217
|
accessibilityRole={"button"}
|
|
@@ -246,6 +255,9 @@ export const ButtonLink = React.memo(
|
|
|
246
255
|
</>
|
|
247
256
|
)}
|
|
248
257
|
<Animated.Text
|
|
258
|
+
accessible={false}
|
|
259
|
+
accessibilityElementsHidden
|
|
260
|
+
importantForAccessibility="no-hide-descendants"
|
|
249
261
|
style={[
|
|
250
262
|
buttonStylesLocal.label,
|
|
251
263
|
disabled
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
GestureResponderEvent,
|
|
4
|
+
Pressable,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
View
|
|
7
|
+
} from "react-native";
|
|
3
8
|
import Animated, {
|
|
4
9
|
Extrapolate,
|
|
5
10
|
interpolate,
|
|
@@ -213,183 +218,191 @@ const IOButtonStylesLocal = StyleSheet.create({
|
|
|
213
218
|
}
|
|
214
219
|
});
|
|
215
220
|
|
|
216
|
-
export const ButtonOutline = (
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
);
|
|
235
|
-
|
|
236
|
-
const buttonStyles = React.useMemo(
|
|
237
|
-
() => (isExperimental ? IOButtonStyles : IOButtonLegacyStyles),
|
|
238
|
-
[isExperimental]
|
|
239
|
-
);
|
|
240
|
-
|
|
241
|
-
const buttonStylesLocal = React.useMemo(
|
|
242
|
-
() => (isExperimental ? IOButtonStylesLocal : IOButtonLegacyStylesLocal),
|
|
243
|
-
[isExperimental]
|
|
244
|
-
);
|
|
245
|
-
// Scaling transformation applied when the button is pressed
|
|
246
|
-
const animationScaleValue = IOScaleValues?.basicButton?.pressedState;
|
|
221
|
+
export const ButtonOutline = React.forwardRef<View, ButtonOutline>(
|
|
222
|
+
(
|
|
223
|
+
{
|
|
224
|
+
color = "primary",
|
|
225
|
+
label,
|
|
226
|
+
fullWidth = false,
|
|
227
|
+
disabled = false,
|
|
228
|
+
icon,
|
|
229
|
+
iconPosition = "start",
|
|
230
|
+
onPress,
|
|
231
|
+
accessibilityLabel,
|
|
232
|
+
accessibilityHint,
|
|
233
|
+
testID
|
|
234
|
+
},
|
|
235
|
+
ref
|
|
236
|
+
) => {
|
|
237
|
+
const { isExperimental } = useIOExperimentalDesign();
|
|
238
|
+
const isPressed: Animated.SharedValue<number> = useSharedValue(0);
|
|
247
239
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
240
|
+
const colorMap = React.useMemo(
|
|
241
|
+
() => (isExperimental ? mapColorStates : mapLegacyColorStates),
|
|
242
|
+
[isExperimental]
|
|
243
|
+
);
|
|
252
244
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
const backgroundColor = interpolateColor(
|
|
257
|
-
progressPressed.value,
|
|
258
|
-
[0, 1],
|
|
259
|
-
[colorMap[color].background.default, colorMap[color].background.pressed]
|
|
245
|
+
const buttonStyles = React.useMemo(
|
|
246
|
+
() => (isExperimental ? IOButtonStyles : IOButtonLegacyStyles),
|
|
247
|
+
[isExperimental]
|
|
260
248
|
);
|
|
261
249
|
|
|
262
|
-
const
|
|
263
|
-
|
|
264
|
-
[
|
|
265
|
-
[colorMap[color].border.default, colorMap[color].border.pressed]
|
|
250
|
+
const buttonStylesLocal = React.useMemo(
|
|
251
|
+
() => (isExperimental ? IOButtonStylesLocal : IOButtonLegacyStylesLocal),
|
|
252
|
+
[isExperimental]
|
|
266
253
|
);
|
|
254
|
+
// Scaling transformation applied when the button is pressed
|
|
255
|
+
const animationScaleValue = IOScaleValues?.basicButton?.pressedState;
|
|
267
256
|
|
|
268
|
-
//
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
[0, 1],
|
|
272
|
-
[1, animationScaleValue],
|
|
273
|
-
Extrapolate.CLAMP
|
|
257
|
+
// Using a spring-based animation for our interpolations
|
|
258
|
+
const progressPressed = useDerivedValue(() =>
|
|
259
|
+
withSpring(isPressed.value, IOSpringValues.button)
|
|
274
260
|
);
|
|
275
261
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
262
|
+
// Interpolate animation values from `isPressed` values
|
|
263
|
+
const pressedAnimationStyle = useAnimatedStyle(() => {
|
|
264
|
+
// Link color states to the pressed states
|
|
265
|
+
const backgroundColor = interpolateColor(
|
|
266
|
+
progressPressed.value,
|
|
267
|
+
[0, 1],
|
|
268
|
+
[colorMap[color].background.default, colorMap[color].background.pressed]
|
|
269
|
+
);
|
|
282
270
|
|
|
283
|
-
|
|
284
|
-
|
|
271
|
+
const borderColor = interpolateColor(
|
|
272
|
+
progressPressed.value,
|
|
273
|
+
[0, 1],
|
|
274
|
+
[colorMap[color].border.default, colorMap[color].border.pressed]
|
|
275
|
+
);
|
|
285
276
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
277
|
+
// Scale down button slightly when pressed
|
|
278
|
+
const scale = interpolate(
|
|
279
|
+
progressPressed.value,
|
|
280
|
+
[0, 1],
|
|
281
|
+
[1, animationScaleValue],
|
|
282
|
+
Extrapolate.CLAMP
|
|
283
|
+
);
|
|
291
284
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
285
|
+
return {
|
|
286
|
+
borderColor,
|
|
287
|
+
backgroundColor,
|
|
288
|
+
transform: [{ scale }]
|
|
289
|
+
};
|
|
290
|
+
});
|
|
296
291
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
const iconColor = interpolateColor(
|
|
300
|
-
progressPressed.value,
|
|
301
|
-
[0, 1],
|
|
302
|
-
[colorMap[color].label.default, colorMap[color].label.pressed]
|
|
303
|
-
);
|
|
304
|
-
return { color: iconColor };
|
|
305
|
-
});
|
|
292
|
+
const pressedColorLabelAnimationStyle = useAnimatedStyle(() => {
|
|
293
|
+
// Link color states to the pressed states
|
|
306
294
|
|
|
307
|
-
|
|
308
|
-
|
|
295
|
+
const labelColor = interpolateColor(
|
|
296
|
+
progressPressed.value,
|
|
297
|
+
[0, 1],
|
|
298
|
+
[colorMap[color].border.default, colorMap[color].border.pressed]
|
|
299
|
+
);
|
|
309
300
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
const onPressOut = useCallback(() => {
|
|
315
|
-
// eslint-disable-next-line functional/immutable-data
|
|
316
|
-
isPressed.value = 0;
|
|
317
|
-
}, [isPressed]);
|
|
301
|
+
return {
|
|
302
|
+
color: labelColor
|
|
303
|
+
};
|
|
304
|
+
});
|
|
318
305
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
306
|
+
// Animate the <Icon> color prop
|
|
307
|
+
const pressedColorIconAnimationStyle = useAnimatedProps(() => {
|
|
308
|
+
const iconColor = interpolateColor(
|
|
309
|
+
progressPressed.value,
|
|
310
|
+
[0, 1],
|
|
311
|
+
[colorMap[color].label.default, colorMap[color].label.pressed]
|
|
312
|
+
);
|
|
313
|
+
return { color: iconColor };
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
const AnimatedIconClassComponent =
|
|
317
|
+
Animated.createAnimatedComponent(IconClassComponent);
|
|
318
|
+
|
|
319
|
+
const onPressIn = useCallback(() => {
|
|
320
|
+
// eslint-disable-next-line functional/immutable-data
|
|
321
|
+
isPressed.value = 1;
|
|
322
|
+
}, [isPressed]);
|
|
323
|
+
const onPressOut = useCallback(() => {
|
|
324
|
+
// eslint-disable-next-line functional/immutable-data
|
|
325
|
+
isPressed.value = 0;
|
|
326
|
+
}, [isPressed]);
|
|
327
|
+
|
|
328
|
+
return (
|
|
329
|
+
<Pressable
|
|
330
|
+
ref={ref}
|
|
331
|
+
accessibilityLabel={accessibilityLabel}
|
|
332
|
+
accessibilityHint={accessibilityHint}
|
|
333
|
+
accessibilityRole={"button"}
|
|
334
|
+
testID={testID}
|
|
335
|
+
onPress={onPress}
|
|
336
|
+
onPressIn={onPressIn}
|
|
337
|
+
onPressOut={onPressOut}
|
|
338
|
+
accessible={true}
|
|
339
|
+
disabled={disabled}
|
|
340
|
+
style={!fullWidth ? IOButtonStyles.dimensionsDefault : {}}
|
|
353
341
|
>
|
|
354
|
-
|
|
355
|
-
<>
|
|
356
|
-
{!disabled ? (
|
|
357
|
-
<AnimatedIconClassComponent
|
|
358
|
-
name={icon}
|
|
359
|
-
animatedProps={pressedColorIconAnimationStyle}
|
|
360
|
-
color={colorMap[color]?.label?.default}
|
|
361
|
-
size={iconSize}
|
|
362
|
-
/>
|
|
363
|
-
) : (
|
|
364
|
-
<AnimatedIcon
|
|
365
|
-
name={icon}
|
|
366
|
-
color={colorMap[color]?.label?.disabled}
|
|
367
|
-
size={iconSize}
|
|
368
|
-
/>
|
|
369
|
-
)}
|
|
370
|
-
<HSpacer size={8} />
|
|
371
|
-
</>
|
|
372
|
-
)}
|
|
373
|
-
<Animated.Text
|
|
342
|
+
<Animated.View
|
|
374
343
|
style={[
|
|
375
|
-
|
|
376
|
-
|
|
344
|
+
buttonStyles.button,
|
|
345
|
+
isExperimental && fullWidth && { paddingHorizontal: 16 },
|
|
346
|
+
buttonStylesLocal.buttonWithBorder,
|
|
347
|
+
buttonStyles.buttonSizeDefault,
|
|
348
|
+
iconPosition === "end" && { flexDirection: "row-reverse" },
|
|
377
349
|
disabled
|
|
378
|
-
? {
|
|
379
|
-
|
|
380
|
-
|
|
350
|
+
? {
|
|
351
|
+
backgroundColor: colorMap[color]?.background?.disabled,
|
|
352
|
+
borderColor: colorMap[color]?.border?.disabled,
|
|
353
|
+
opacity: DISABLED_OPACITY
|
|
354
|
+
}
|
|
355
|
+
: {
|
|
356
|
+
backgroundColor: colorMap[color]?.background?.default,
|
|
357
|
+
borderColor: colorMap[color]?.border.default
|
|
358
|
+
},
|
|
359
|
+
/* Prevent Reanimated from overriding background colors
|
|
360
|
+
if button is disabled */
|
|
361
|
+
!disabled && pressedAnimationStyle
|
|
381
362
|
]}
|
|
382
|
-
numberOfLines={1}
|
|
383
|
-
ellipsizeMode="tail"
|
|
384
|
-
allowFontScaling={isExperimental}
|
|
385
|
-
maxFontSizeMultiplier={1.3}
|
|
386
|
-
importantForAccessibility="no-hide-descendants"
|
|
387
363
|
>
|
|
388
|
-
{
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
}
|
|
364
|
+
{icon && (
|
|
365
|
+
<>
|
|
366
|
+
{!disabled ? (
|
|
367
|
+
<AnimatedIconClassComponent
|
|
368
|
+
name={icon}
|
|
369
|
+
animatedProps={pressedColorIconAnimationStyle}
|
|
370
|
+
color={colorMap[color]?.label?.default}
|
|
371
|
+
size={iconSize}
|
|
372
|
+
/>
|
|
373
|
+
) : (
|
|
374
|
+
<AnimatedIcon
|
|
375
|
+
name={icon}
|
|
376
|
+
color={colorMap[color]?.label?.disabled}
|
|
377
|
+
size={iconSize}
|
|
378
|
+
/>
|
|
379
|
+
)}
|
|
380
|
+
<HSpacer size={8} />
|
|
381
|
+
</>
|
|
382
|
+
)}
|
|
383
|
+
<Animated.Text
|
|
384
|
+
style={[
|
|
385
|
+
buttonStylesLocal.label,
|
|
386
|
+
buttonStyles.label,
|
|
387
|
+
disabled
|
|
388
|
+
? { color: colorMap[color]?.label?.disabled }
|
|
389
|
+
: { color: colorMap[color]?.label?.default },
|
|
390
|
+
!disabled && pressedColorLabelAnimationStyle
|
|
391
|
+
]}
|
|
392
|
+
numberOfLines={1}
|
|
393
|
+
ellipsizeMode="tail"
|
|
394
|
+
allowFontScaling={isExperimental}
|
|
395
|
+
maxFontSizeMultiplier={1.3}
|
|
396
|
+
accessible={false}
|
|
397
|
+
accessibilityElementsHidden
|
|
398
|
+
importantForAccessibility="no-hide-descendants"
|
|
399
|
+
>
|
|
400
|
+
{label}
|
|
401
|
+
</Animated.Text>
|
|
402
|
+
</Animated.View>
|
|
403
|
+
</Pressable>
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
);
|
|
394
407
|
|
|
395
408
|
export default ButtonOutline;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
GestureResponderEvent,
|
|
4
|
+
Pressable,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
View
|
|
7
|
+
} from "react-native";
|
|
3
8
|
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
4
9
|
import Animated, {
|
|
5
10
|
Extrapolate,
|
|
@@ -155,20 +160,23 @@ const mapLegacyColorStates: Record<
|
|
|
155
160
|
}
|
|
156
161
|
};
|
|
157
162
|
|
|
158
|
-
export const ButtonSolid = React.
|
|
159
|
-
(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
163
|
+
export const ButtonSolid = React.forwardRef<View, ButtonSolidProps>(
|
|
164
|
+
(
|
|
165
|
+
{
|
|
166
|
+
color = "primary",
|
|
167
|
+
label,
|
|
168
|
+
fullWidth = false,
|
|
169
|
+
disabled = false,
|
|
170
|
+
loading = false,
|
|
171
|
+
icon,
|
|
172
|
+
iconPosition = "start",
|
|
173
|
+
onPress,
|
|
174
|
+
accessibilityLabel,
|
|
175
|
+
accessibilityHint,
|
|
176
|
+
testID
|
|
177
|
+
},
|
|
178
|
+
ref
|
|
179
|
+
) => {
|
|
172
180
|
const isPressed = useSharedValue(0);
|
|
173
181
|
const { isExperimental } = useIOExperimentalDesign();
|
|
174
182
|
// Scaling transformation applied when the button is pressed
|
|
@@ -253,6 +261,7 @@ export const ButtonSolid = React.memo(
|
|
|
253
261
|
return (
|
|
254
262
|
<Pressable
|
|
255
263
|
testID={testID}
|
|
264
|
+
ref={ref}
|
|
256
265
|
accessible={true}
|
|
257
266
|
accessibilityLabel={accessibilityLabel}
|
|
258
267
|
accessibilityHint={accessibilityHint}
|
|
@@ -320,6 +329,8 @@ export const ButtonSolid = React.memo(
|
|
|
320
329
|
ellipsizeMode="tail"
|
|
321
330
|
allowFontScaling={isExperimental}
|
|
322
331
|
maxFontSizeMultiplier={1.3}
|
|
332
|
+
accessible={false}
|
|
333
|
+
accessibilityElementsHidden
|
|
323
334
|
importantForAccessibility="no-hide-descendants"
|
|
324
335
|
>
|
|
325
336
|
{label}
|
|
@@ -39,7 +39,8 @@ exports[`Test Buttons Components - Experimental Enabled ButtonExtendedOutline Sn
|
|
|
39
39
|
{
|
|
40
40
|
"alignItems": "center",
|
|
41
41
|
"backgroundColor": "#FFFFFF",
|
|
42
|
-
"borderColor": "#
|
|
42
|
+
"borderColor": "#E8EBF1",
|
|
43
|
+
"borderCurve": "continuous",
|
|
43
44
|
"borderRadius": 8,
|
|
44
45
|
"borderStyle": "solid",
|
|
45
46
|
"borderWidth": 1,
|
|
@@ -233,8 +234,11 @@ exports[`Test Buttons Components - Experimental Enabled ButtonLink Snapshot 1`]
|
|
|
233
234
|
}
|
|
234
235
|
>
|
|
235
236
|
<Text
|
|
237
|
+
accessibilityElementsHidden={true}
|
|
238
|
+
accessible={false}
|
|
236
239
|
allowFontScaling={true}
|
|
237
240
|
ellipsizeMode="tail"
|
|
241
|
+
importantForAccessibility="no-hide-descendants"
|
|
238
242
|
maxFontSizeMultiplier={1.3}
|
|
239
243
|
numberOfLines={1}
|
|
240
244
|
style={
|
|
@@ -304,6 +308,7 @@ exports[`Test Buttons Components - Experimental Enabled ButtonOutline Snapshot 1
|
|
|
304
308
|
[
|
|
305
309
|
{
|
|
306
310
|
"alignItems": "center",
|
|
311
|
+
"borderCurve": "continuous",
|
|
307
312
|
"borderRadius": 8,
|
|
308
313
|
"elevation": 0,
|
|
309
314
|
"flexDirection": "row",
|
|
@@ -336,6 +341,8 @@ exports[`Test Buttons Components - Experimental Enabled ButtonOutline Snapshot 1
|
|
|
336
341
|
}
|
|
337
342
|
>
|
|
338
343
|
<Text
|
|
344
|
+
accessibilityElementsHidden={true}
|
|
345
|
+
accessible={false}
|
|
339
346
|
allowFontScaling={true}
|
|
340
347
|
ellipsizeMode="tail"
|
|
341
348
|
importantForAccessibility="no-hide-descendants"
|
|
@@ -411,6 +418,7 @@ exports[`Test Buttons Components - Experimental Enabled ButtonSolid Snapshot 1`]
|
|
|
411
418
|
[
|
|
412
419
|
{
|
|
413
420
|
"alignItems": "center",
|
|
421
|
+
"borderCurve": "continuous",
|
|
414
422
|
"borderRadius": 8,
|
|
415
423
|
"elevation": 0,
|
|
416
424
|
"flexDirection": "row",
|
|
@@ -453,6 +461,8 @@ exports[`Test Buttons Components - Experimental Enabled ButtonSolid Snapshot 1`]
|
|
|
453
461
|
}
|
|
454
462
|
>
|
|
455
463
|
<Text
|
|
464
|
+
accessibilityElementsHidden={true}
|
|
465
|
+
accessible={false}
|
|
456
466
|
allowFontScaling={true}
|
|
457
467
|
color="white"
|
|
458
468
|
defaultColor="white"
|
|
@@ -902,7 +912,8 @@ exports[`Test Buttons Components ButtonExtendedOutline Snapshot 1`] = `
|
|
|
902
912
|
{
|
|
903
913
|
"alignItems": "center",
|
|
904
914
|
"backgroundColor": "#FFFFFF",
|
|
905
|
-
"borderColor": "#
|
|
915
|
+
"borderColor": "#E8EBF1",
|
|
916
|
+
"borderCurve": "continuous",
|
|
906
917
|
"borderRadius": 8,
|
|
907
918
|
"borderStyle": "solid",
|
|
908
919
|
"borderWidth": 1,
|
|
@@ -1096,8 +1107,11 @@ exports[`Test Buttons Components ButtonLink Snapshot 1`] = `
|
|
|
1096
1107
|
}
|
|
1097
1108
|
>
|
|
1098
1109
|
<Text
|
|
1110
|
+
accessibilityElementsHidden={true}
|
|
1111
|
+
accessible={false}
|
|
1099
1112
|
allowFontScaling={false}
|
|
1100
1113
|
ellipsizeMode="tail"
|
|
1114
|
+
importantForAccessibility="no-hide-descendants"
|
|
1101
1115
|
maxFontSizeMultiplier={1.3}
|
|
1102
1116
|
numberOfLines={1}
|
|
1103
1117
|
style={
|
|
@@ -1199,6 +1213,8 @@ exports[`Test Buttons Components ButtonOutline Snapshot 1`] = `
|
|
|
1199
1213
|
}
|
|
1200
1214
|
>
|
|
1201
1215
|
<Text
|
|
1216
|
+
accessibilityElementsHidden={true}
|
|
1217
|
+
accessible={false}
|
|
1202
1218
|
allowFontScaling={false}
|
|
1203
1219
|
ellipsizeMode="tail"
|
|
1204
1220
|
importantForAccessibility="no-hide-descendants"
|
|
@@ -1315,6 +1331,8 @@ exports[`Test Buttons Components ButtonSolid Snapshot 1`] = `
|
|
|
1315
1331
|
}
|
|
1316
1332
|
>
|
|
1317
1333
|
<Text
|
|
1334
|
+
accessibilityElementsHidden={true}
|
|
1335
|
+
accessible={false}
|
|
1318
1336
|
allowFontScaling={false}
|
|
1319
1337
|
color="white"
|
|
1320
1338
|
defaultColor="white"
|
|
@@ -37,7 +37,8 @@ const styles = StyleSheet.create({
|
|
|
37
37
|
width: IOSelectionTickVisualParams.size,
|
|
38
38
|
height: IOSelectionTickVisualParams.size,
|
|
39
39
|
borderWidth: IOSelectionTickVisualParams.borderWidth,
|
|
40
|
-
borderRadius: checkBoxRadius
|
|
40
|
+
borderRadius: checkBoxRadius,
|
|
41
|
+
borderCurve: "continuous"
|
|
41
42
|
},
|
|
42
43
|
checkBoxSquare: {
|
|
43
44
|
position: "absolute",
|
|
@@ -45,7 +46,8 @@ const styles = StyleSheet.create({
|
|
|
45
46
|
top: 0,
|
|
46
47
|
width: IOSelectionTickVisualParams.size,
|
|
47
48
|
height: IOSelectionTickVisualParams.size,
|
|
48
|
-
borderRadius: checkBoxRadius
|
|
49
|
+
borderRadius: checkBoxRadius,
|
|
50
|
+
borderCurve: "continuous"
|
|
49
51
|
}
|
|
50
52
|
});
|
|
51
53
|
|