@pagopa/io-app-design-system 1.33.0 → 1.35.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/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +2 -0
- package/lib/commonjs/components/buttons/ButtonLink.js +4 -1
- package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonOutline.js +4 -1
- package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonSolid.js +8 -5
- package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButton.js +4 -1
- package/lib/commonjs/components/buttons/IconButton.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButtonContained.js +3 -0
- package/lib/commonjs/components/buttons/IconButtonContained.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButtonSolid.js +3 -0
- package/lib/commonjs/components/buttons/IconButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +2 -0
- package/lib/commonjs/components/icons/svg/IconCategCulture.js +1 -7
- package/lib/commonjs/components/icons/svg/IconCategCulture.js.map +1 -1
- package/lib/commonjs/components/icons/svg/IconCategFinance.js +3 -4
- package/lib/commonjs/components/icons/svg/IconCategFinance.js.map +1 -1
- package/lib/commonjs/components/icons/svg/IconCategHome.js +3 -4
- package/lib/commonjs/components/icons/svg/IconCategHome.js.map +1 -1
- package/lib/commonjs/components/icons/svg/IconCategJobOffers.js +3 -1
- package/lib/commonjs/components/icons/svg/IconCategJobOffers.js.map +1 -1
- package/lib/commonjs/components/icons/svg/IconCategLearning.js +3 -1
- package/lib/commonjs/components/icons/svg/IconCategLearning.js.map +1 -1
- package/lib/commonjs/components/icons/svg/IconCategMobility.js +3 -1
- package/lib/commonjs/components/icons/svg/IconCategMobility.js.map +1 -1
- package/lib/commonjs/components/icons/svg/IconCategSport.js +1 -1
- package/lib/commonjs/components/icons/svg/IconCategSport.js.map +1 -1
- package/lib/commonjs/components/icons/svg/IconCategTelco.js +3 -9
- package/lib/commonjs/components/icons/svg/IconCategTelco.js.map +1 -1
- package/lib/commonjs/components/icons/svg/IconCategTravel.js +1 -6
- package/lib/commonjs/components/icons/svg/IconCategTravel.js.map +1 -1
- package/lib/commonjs/components/icons/svg/IconCategWellness.js +3 -4
- package/lib/commonjs/components/icons/svg/IconCategWellness.js.map +1 -1
- package/lib/commonjs/components/icons/svg/originals/IconCategCulture.svg +1 -14
- package/lib/commonjs/components/icons/svg/originals/IconCategFinance.svg +1 -10
- package/lib/commonjs/components/icons/svg/originals/IconCategHome.svg +1 -10
- package/lib/commonjs/components/icons/svg/originals/IconCategJobOffers.svg +1 -6
- package/lib/commonjs/components/icons/svg/originals/IconCategLearning.svg +1 -6
- package/lib/commonjs/components/icons/svg/originals/IconCategMobility.svg +1 -6
- package/lib/commonjs/components/icons/svg/originals/IconCategSport.svg +1 -8
- package/lib/commonjs/components/icons/svg/originals/IconCategTelco.svg +1 -13
- package/lib/commonjs/components/icons/svg/originals/IconCategTravel.svg +1 -12
- package/lib/commonjs/components/icons/svg/originals/IconCategWellness.svg +1 -10
- package/lib/commonjs/components/index.js +42 -31
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemAction.js +1 -1
- package/lib/commonjs/components/listitems/ListItemCheckbox.js +7 -4
- package/lib/commonjs/components/listitems/ListItemCheckbox.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemNav.js +5 -0
- package/lib/commonjs/components/listitems/ListItemNav.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemRadio.js +4 -3
- package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js +23 -9
- package/lib/commonjs/components/listitems/ListItemRadioWithAmount.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemSwitch.js +5 -1
- package/lib/commonjs/components/listitems/ListItemSwitch.js.map +1 -1
- package/lib/commonjs/components/listitems/PressableListItemsBase.js +7 -6
- package/lib/commonjs/components/listitems/PressableListItemsBase.js.map +1 -1
- package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +12 -12
- package/lib/commonjs/components/modules/ModuleAttachment.js +6 -3
- package/lib/commonjs/components/modules/ModuleAttachment.js.map +1 -1
- package/lib/commonjs/components/modules/ModuleCheckout.js +37 -36
- package/lib/commonjs/components/modules/ModuleCheckout.js.map +1 -1
- package/lib/commonjs/components/modules/ModuleCredential.js.map +1 -1
- package/lib/commonjs/components/modules/PressableModuleBase.js +5 -3
- package/lib/commonjs/components/modules/PressableModuleBase.js.map +1 -1
- package/lib/commonjs/components/radio/RadioButtonLabel.js +10 -9
- package/lib/commonjs/components/radio/RadioButtonLabel.js.map +1 -1
- package/lib/commonjs/components/radio/RadioGroup.js +7 -2
- package/lib/commonjs/components/radio/RadioGroup.js.map +1 -1
- package/lib/commonjs/components/spacer/Spacer.js.map +1 -1
- package/lib/commonjs/components/stack/Stack.js +47 -0
- package/lib/commonjs/components/stack/Stack.js.map +1 -0
- package/lib/commonjs/components/stack/index.js +17 -0
- package/lib/commonjs/components/stack/index.js.map +1 -0
- package/lib/commonjs/components/tabs/TabItem.js +59 -7
- package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
- package/lib/commonjs/components/tabs/TabNavigation.js +2 -7
- package/lib/commonjs/components/tabs/TabNavigation.js.map +1 -1
- package/lib/commonjs/core/IOColors.js +7 -7
- package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +2 -0
- package/lib/module/components/buttons/ButtonLink.js +4 -1
- package/lib/module/components/buttons/ButtonLink.js.map +1 -1
- package/lib/module/components/buttons/ButtonOutline.js +4 -1
- package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/module/components/buttons/ButtonSolid.js +8 -5
- package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/IconButton.js +4 -1
- package/lib/module/components/buttons/IconButton.js.map +1 -1
- package/lib/module/components/buttons/IconButtonContained.js +3 -0
- package/lib/module/components/buttons/IconButtonContained.js.map +1 -1
- package/lib/module/components/buttons/IconButtonSolid.js +3 -0
- package/lib/module/components/buttons/IconButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +2 -0
- package/lib/module/components/icons/svg/IconCategCulture.js +1 -7
- package/lib/module/components/icons/svg/IconCategCulture.js.map +1 -1
- package/lib/module/components/icons/svg/IconCategFinance.js +3 -4
- package/lib/module/components/icons/svg/IconCategFinance.js.map +1 -1
- package/lib/module/components/icons/svg/IconCategHome.js +3 -4
- package/lib/module/components/icons/svg/IconCategHome.js.map +1 -1
- package/lib/module/components/icons/svg/IconCategJobOffers.js +3 -1
- package/lib/module/components/icons/svg/IconCategJobOffers.js.map +1 -1
- package/lib/module/components/icons/svg/IconCategLearning.js +3 -1
- package/lib/module/components/icons/svg/IconCategLearning.js.map +1 -1
- package/lib/module/components/icons/svg/IconCategMobility.js +3 -1
- package/lib/module/components/icons/svg/IconCategMobility.js.map +1 -1
- package/lib/module/components/icons/svg/IconCategSport.js +1 -1
- package/lib/module/components/icons/svg/IconCategSport.js.map +1 -1
- package/lib/module/components/icons/svg/IconCategTelco.js +3 -9
- package/lib/module/components/icons/svg/IconCategTelco.js.map +1 -1
- package/lib/module/components/icons/svg/IconCategTravel.js +1 -6
- package/lib/module/components/icons/svg/IconCategTravel.js.map +1 -1
- package/lib/module/components/icons/svg/IconCategWellness.js +3 -4
- package/lib/module/components/icons/svg/IconCategWellness.js.map +1 -1
- package/lib/module/components/icons/svg/originals/IconCategCulture.svg +1 -14
- package/lib/module/components/icons/svg/originals/IconCategFinance.svg +1 -10
- package/lib/module/components/icons/svg/originals/IconCategHome.svg +1 -10
- package/lib/module/components/icons/svg/originals/IconCategJobOffers.svg +1 -6
- package/lib/module/components/icons/svg/originals/IconCategLearning.svg +1 -6
- package/lib/module/components/icons/svg/originals/IconCategMobility.svg +1 -6
- package/lib/module/components/icons/svg/originals/IconCategSport.svg +1 -8
- package/lib/module/components/icons/svg/originals/IconCategTelco.svg +1 -13
- package/lib/module/components/icons/svg/originals/IconCategTravel.svg +1 -12
- package/lib/module/components/icons/svg/originals/IconCategWellness.svg +1 -10
- package/lib/module/components/index.js +5 -4
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/listitems/ListItemAction.js +1 -1
- package/lib/module/components/listitems/ListItemCheckbox.js +7 -4
- package/lib/module/components/listitems/ListItemCheckbox.js.map +1 -1
- package/lib/module/components/listitems/ListItemNav.js +5 -0
- package/lib/module/components/listitems/ListItemNav.js.map +1 -1
- package/lib/module/components/listitems/ListItemRadio.js +4 -3
- package/lib/module/components/listitems/ListItemRadio.js.map +1 -1
- package/lib/module/components/listitems/ListItemRadioWithAmount.js +23 -9
- package/lib/module/components/listitems/ListItemRadioWithAmount.js.map +1 -1
- package/lib/module/components/listitems/ListItemSwitch.js +5 -1
- package/lib/module/components/listitems/ListItemSwitch.js.map +1 -1
- package/lib/module/components/listitems/PressableListItemsBase.js +7 -6
- package/lib/module/components/listitems/PressableListItemsBase.js.map +1 -1
- package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +12 -12
- package/lib/module/components/modules/ModuleAttachment.js +6 -3
- package/lib/module/components/modules/ModuleAttachment.js.map +1 -1
- package/lib/module/components/modules/ModuleCheckout.js +39 -40
- package/lib/module/components/modules/ModuleCheckout.js.map +1 -1
- package/lib/module/components/modules/ModuleCredential.js.map +1 -1
- package/lib/module/components/modules/PressableModuleBase.js +5 -3
- package/lib/module/components/modules/PressableModuleBase.js.map +1 -1
- package/lib/module/components/radio/RadioButtonLabel.js +10 -9
- package/lib/module/components/radio/RadioButtonLabel.js.map +1 -1
- package/lib/module/components/radio/RadioGroup.js +7 -2
- package/lib/module/components/radio/RadioGroup.js.map +1 -1
- package/lib/module/components/spacer/Spacer.js.map +1 -1
- package/lib/module/components/stack/Stack.js +39 -0
- package/lib/module/components/stack/Stack.js.map +1 -0
- package/lib/module/components/stack/index.js +2 -0
- package/lib/module/components/stack/index.js.map +1 -0
- package/lib/module/components/tabs/TabItem.js +60 -7
- package/lib/module/components/tabs/TabItem.js.map +1 -1
- package/lib/module/components/tabs/TabNavigation.js +2 -7
- package/lib/module/components/tabs/TabNavigation.js.map +1 -1
- package/lib/module/core/IOColors.js +7 -7
- package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonOutline.d.ts +4 -10
- package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonSolid.d.ts +4 -16
- 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/IconButtonContained.d.ts +1 -1
- package/lib/typescript/components/buttons/IconButtonContained.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IconButtonSolid.d.ts.map +1 -1
- package/lib/typescript/components/icons/svg/IconCategCulture.d.ts.map +1 -1
- package/lib/typescript/components/icons/svg/IconCategFinance.d.ts.map +1 -1
- package/lib/typescript/components/icons/svg/IconCategHome.d.ts.map +1 -1
- package/lib/typescript/components/icons/svg/IconCategJobOffers.d.ts.map +1 -1
- package/lib/typescript/components/icons/svg/IconCategLearning.d.ts.map +1 -1
- package/lib/typescript/components/icons/svg/IconCategMobility.d.ts.map +1 -1
- package/lib/typescript/components/icons/svg/IconCategTelco.d.ts +2 -2
- package/lib/typescript/components/icons/svg/IconCategTelco.d.ts.map +1 -1
- package/lib/typescript/components/icons/svg/IconCategTravel.d.ts.map +1 -1
- package/lib/typescript/components/icons/svg/IconCategWellness.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +5 -4
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemCheckbox.d.ts +2 -2
- package/lib/typescript/components/listitems/ListItemCheckbox.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemNav.d.ts +4 -5
- package/lib/typescript/components/listitems/ListItemNav.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemRadio.d.ts +2 -2
- package/lib/typescript/components/listitems/ListItemRadio.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemRadioWithAmount.d.ts +4 -2
- package/lib/typescript/components/listitems/ListItemRadioWithAmount.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemSwitch.d.ts.map +1 -1
- package/lib/typescript/components/listitems/PressableListItemsBase.d.ts +3 -5
- package/lib/typescript/components/listitems/PressableListItemsBase.d.ts.map +1 -1
- package/lib/typescript/components/modules/ModuleCheckout.d.ts +19 -11
- package/lib/typescript/components/modules/ModuleCheckout.d.ts.map +1 -1
- package/lib/typescript/components/modules/ModuleCredential.d.ts +1 -1
- package/lib/typescript/components/modules/ModuleCredential.d.ts.map +1 -1
- package/lib/typescript/components/modules/PressableModuleBase.d.ts +4 -5
- package/lib/typescript/components/modules/PressableModuleBase.d.ts.map +1 -1
- package/lib/typescript/components/radio/RadioButtonLabel.d.ts +2 -2
- package/lib/typescript/components/radio/RadioButtonLabel.d.ts.map +1 -1
- package/lib/typescript/components/radio/RadioGroup.d.ts.map +1 -1
- package/lib/typescript/components/stack/Stack.d.ts +18 -0
- package/lib/typescript/components/stack/Stack.d.ts.map +1 -0
- package/lib/typescript/components/stack/index.d.ts +2 -0
- package/lib/typescript/components/stack/index.d.ts.map +1 -0
- package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -1
- package/lib/typescript/components/tabs/TabNavigation.d.ts +1 -1
- package/lib/typescript/components/tabs/TabNavigation.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +2 -0
- package/src/components/buttons/ButtonLink.tsx +2 -1
- package/src/components/buttons/ButtonOutline.tsx +18 -15
- package/src/components/buttons/ButtonSolid.tsx +35 -32
- package/src/components/buttons/IconButton.tsx +1 -0
- package/src/components/buttons/IconButtonContained.tsx +2 -1
- package/src/components/buttons/IconButtonSolid.tsx +1 -0
- package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +2 -0
- package/src/components/icons/svg/IconCategCulture.tsx +1 -9
- package/src/components/icons/svg/IconCategFinance.tsx +3 -5
- package/src/components/icons/svg/IconCategHome.tsx +3 -5
- package/src/components/icons/svg/IconCategJobOffers.tsx +3 -1
- package/src/components/icons/svg/IconCategLearning.tsx +3 -1
- package/src/components/icons/svg/IconCategMobility.tsx +3 -1
- package/src/components/icons/svg/IconCategSport.tsx +1 -1
- package/src/components/icons/svg/IconCategTelco.tsx +3 -8
- package/src/components/icons/svg/IconCategTravel.tsx +1 -7
- package/src/components/icons/svg/IconCategWellness.tsx +3 -5
- package/src/components/icons/svg/originals/IconCategCulture.svg +1 -14
- package/src/components/icons/svg/originals/IconCategFinance.svg +1 -10
- package/src/components/icons/svg/originals/IconCategHome.svg +1 -10
- package/src/components/icons/svg/originals/IconCategJobOffers.svg +1 -6
- package/src/components/icons/svg/originals/IconCategLearning.svg +1 -6
- package/src/components/icons/svg/originals/IconCategMobility.svg +1 -6
- package/src/components/icons/svg/originals/IconCategSport.svg +1 -8
- package/src/components/icons/svg/originals/IconCategTelco.svg +1 -13
- package/src/components/icons/svg/originals/IconCategTravel.svg +1 -12
- package/src/components/icons/svg/originals/IconCategWellness.svg +1 -10
- package/src/components/index.tsx +5 -4
- package/src/components/listitems/ListItemAction.tsx +1 -1
- package/src/components/listitems/ListItemCheckbox.tsx +12 -6
- package/src/components/listitems/ListItemNav.tsx +17 -11
- package/src/components/listitems/ListItemRadio.tsx +7 -5
- package/src/components/listitems/ListItemRadioWithAmount.tsx +28 -13
- package/src/components/listitems/ListItemSwitch.tsx +1 -0
- package/src/components/listitems/PressableListItemsBase.tsx +16 -8
- package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +12 -12
- package/src/components/modules/ModuleAttachment.tsx +4 -3
- package/src/components/modules/ModuleCheckout.tsx +65 -50
- package/src/components/modules/ModuleCredential.tsx +1 -1
- package/src/components/modules/PressableModuleBase.tsx +16 -10
- package/src/components/radio/RadioButtonLabel.tsx +16 -11
- package/src/components/radio/RadioGroup.tsx +18 -8
- package/src/components/spacer/Spacer.tsx +1 -1
- package/src/components/stack/Stack.tsx +41 -0
- package/src/components/stack/index.tsx +1 -0
- package/src/components/tabs/TabItem.tsx +93 -10
- package/src/components/tabs/TabNavigation.tsx +2 -10
- package/src/core/IOColors.ts +7 -7
|
@@ -36,12 +36,10 @@ type Props = {
|
|
|
36
36
|
|
|
37
37
|
const DISABLED_OPACITY = 0.5;
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
// onPress:
|
|
41
|
-
type OwnProps = Props &
|
|
39
|
+
type ListItemCheckboxProps = Props &
|
|
42
40
|
Pick<
|
|
43
41
|
React.ComponentProps<typeof Pressable>,
|
|
44
|
-
"onPress" | "accessibilityLabel" | "disabled"
|
|
42
|
+
"onPress" | "accessibilityLabel" | "accessibilityHint" | "disabled"
|
|
45
43
|
>;
|
|
46
44
|
|
|
47
45
|
/**
|
|
@@ -57,9 +55,10 @@ export const ListItemCheckbox = ({
|
|
|
57
55
|
icon,
|
|
58
56
|
selected,
|
|
59
57
|
accessibilityLabel,
|
|
58
|
+
accessibilityHint,
|
|
60
59
|
disabled,
|
|
61
60
|
onValueChange
|
|
62
|
-
}:
|
|
61
|
+
}: ListItemCheckboxProps) => {
|
|
63
62
|
const [toggleValue, setToggleValue] = useState(selected ?? false);
|
|
64
63
|
// Animations
|
|
65
64
|
const isPressed: Animated.SharedValue<number> = useSharedValue(0);
|
|
@@ -74,6 +73,12 @@ export const ListItemCheckbox = ({
|
|
|
74
73
|
// Theme
|
|
75
74
|
const theme = useIOTheme();
|
|
76
75
|
|
|
76
|
+
// Accessibility
|
|
77
|
+
// Comma = Small pause when announcing content
|
|
78
|
+
const fallbackAccessibilityLabel = description
|
|
79
|
+
? `${value}, ${description}`
|
|
80
|
+
: value;
|
|
81
|
+
|
|
77
82
|
const mapBackgroundStates: Record<string, string> = {
|
|
78
83
|
default: hexToRgba(IOColors[theme["listItem-pressed"]], 0),
|
|
79
84
|
pressed: IOColors[theme["listItem-pressed"]]
|
|
@@ -130,7 +135,8 @@ export const ListItemCheckbox = ({
|
|
|
130
135
|
onTouchEnd={handlePressOut}
|
|
131
136
|
testID="ListItemCheckbox"
|
|
132
137
|
accessible={true}
|
|
133
|
-
accessibilityLabel={accessibilityLabel}
|
|
138
|
+
accessibilityLabel={accessibilityLabel || fallbackAccessibilityLabel}
|
|
139
|
+
accessibilityHint={accessibilityHint}
|
|
134
140
|
accessibilityRole="checkbox"
|
|
135
141
|
accessibilityState={{
|
|
136
142
|
checked: selected ?? toggleValue,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback } from "react";
|
|
1
|
+
import React, { ComponentProps, useCallback } from "react";
|
|
2
2
|
import {
|
|
3
3
|
GestureResponderEvent,
|
|
4
4
|
Image,
|
|
@@ -44,16 +44,19 @@ type ListItemTopElementProps =
|
|
|
44
44
|
dateValue: string;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
type ListItemNavPartialProps = WithTestID<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
type ListItemNavPartialProps = WithTestID<
|
|
48
|
+
{
|
|
49
|
+
value: string | React.ReactNode;
|
|
50
|
+
description?: string | React.ReactNode;
|
|
51
|
+
loading?: boolean;
|
|
52
|
+
onPress: (event: GestureResponderEvent) => void;
|
|
53
|
+
hideChevron?: boolean;
|
|
54
|
+
topElement?: ListItemTopElementProps;
|
|
55
|
+
} & Pick<
|
|
56
|
+
ComponentProps<typeof Pressable>,
|
|
57
|
+
"accessibilityLabel" | "accessibilityHint"
|
|
58
|
+
>
|
|
59
|
+
>;
|
|
57
60
|
|
|
58
61
|
export type ListItemNavGraphicProps =
|
|
59
62
|
| { icon?: never; iconColor?: never; paymentLogoUri: string }
|
|
@@ -77,6 +80,7 @@ export const ListItemNav = ({
|
|
|
77
80
|
iconColor = "grey-450",
|
|
78
81
|
paymentLogoUri,
|
|
79
82
|
accessibilityLabel,
|
|
83
|
+
accessibilityHint,
|
|
80
84
|
testID,
|
|
81
85
|
hideChevron = false,
|
|
82
86
|
topElement,
|
|
@@ -197,7 +201,9 @@ export const ListItemNav = ({
|
|
|
197
201
|
onPressIn={handlePressIn}
|
|
198
202
|
onPressOut={handlePressOut}
|
|
199
203
|
accessible={true}
|
|
204
|
+
accessibilityState={{ busy: loading }}
|
|
200
205
|
accessibilityLabel={accessibilityLabel}
|
|
206
|
+
accessibilityHint={accessibilityHint}
|
|
201
207
|
accessibilityRole="button"
|
|
202
208
|
testID={testID}
|
|
203
209
|
>
|
|
@@ -57,12 +57,10 @@ type Props = WithTestID<{
|
|
|
57
57
|
|
|
58
58
|
const DISABLED_OPACITY = 0.5;
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
// onPress:
|
|
62
|
-
type OwnProps = Props &
|
|
60
|
+
type ListItemRadioProps = Props &
|
|
63
61
|
Pick<
|
|
64
62
|
React.ComponentProps<typeof Pressable>,
|
|
65
|
-
"onPress" | "accessibilityLabel" | "disabled"
|
|
63
|
+
"onPress" | "accessibilityLabel" | "accessibilityHint" | "disabled"
|
|
66
64
|
>;
|
|
67
65
|
|
|
68
66
|
const styles = StyleSheet.create({
|
|
@@ -87,9 +85,11 @@ export const ListItemRadio = ({
|
|
|
87
85
|
selected,
|
|
88
86
|
disabled,
|
|
89
87
|
onValueChange,
|
|
88
|
+
accessibilityLabel,
|
|
89
|
+
accessibilityHint,
|
|
90
90
|
loadingProps,
|
|
91
91
|
testID
|
|
92
|
-
}:
|
|
92
|
+
}: ListItemRadioProps) => {
|
|
93
93
|
const [toggleValue, setToggleValue] = useState(selected ?? false);
|
|
94
94
|
// Animations
|
|
95
95
|
const isPressed: Animated.SharedValue<number> = useSharedValue(0);
|
|
@@ -217,6 +217,8 @@ export const ListItemRadio = ({
|
|
|
217
217
|
checked: selected ?? toggleValue,
|
|
218
218
|
disabled: !!disabled
|
|
219
219
|
}}
|
|
220
|
+
accessibilityLabel={accessibilityLabel}
|
|
221
|
+
accessibilityHint={accessibilityHint}
|
|
220
222
|
onPress={toggleRadioItem}
|
|
221
223
|
onPressIn={handlePressIn}
|
|
222
224
|
onPressOut={handlePressOut}
|
|
@@ -14,24 +14,32 @@ export type ListItemRadioWithAmountProps = {
|
|
|
14
14
|
selected?: boolean;
|
|
15
15
|
label: string;
|
|
16
16
|
formattedAmountString: string;
|
|
17
|
+
accessibilityLabel?: string;
|
|
17
18
|
} & (
|
|
18
19
|
| {
|
|
19
20
|
isSuggested?: false;
|
|
21
|
+
suggestReason?: never;
|
|
20
22
|
}
|
|
21
23
|
| {
|
|
22
|
-
isSuggested
|
|
24
|
+
isSuggested?: true;
|
|
23
25
|
suggestReason: string;
|
|
24
26
|
}
|
|
25
27
|
);
|
|
26
|
-
export const ListItemRadioWithAmount = (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
export const ListItemRadioWithAmount = ({
|
|
29
|
+
onValueChange,
|
|
30
|
+
selected,
|
|
31
|
+
label,
|
|
32
|
+
accessibilityLabel,
|
|
33
|
+
isSuggested = false,
|
|
34
|
+
suggestReason,
|
|
35
|
+
formattedAmountString
|
|
36
|
+
}: ListItemRadioWithAmountProps) => {
|
|
37
|
+
const [toggleValue, setToggleValue] = React.useState(selected ?? false);
|
|
30
38
|
const pressHandler = () => {
|
|
31
39
|
RNReactNativeHapticFeedback.trigger("impactLight");
|
|
32
40
|
setToggleValue(val => !val);
|
|
33
|
-
if (
|
|
34
|
-
|
|
41
|
+
if (onValueChange !== undefined) {
|
|
42
|
+
onValueChange(!toggleValue);
|
|
35
43
|
}
|
|
36
44
|
};
|
|
37
45
|
const theme = useIOTheme();
|
|
@@ -39,19 +47,26 @@ export const ListItemRadioWithAmount = (
|
|
|
39
47
|
const suggestColor: IOColors = "hanPurple-500";
|
|
40
48
|
|
|
41
49
|
return (
|
|
42
|
-
<PressableListItemBase
|
|
50
|
+
<PressableListItemBase
|
|
51
|
+
onPress={pressHandler}
|
|
52
|
+
accessibilityRole="radio"
|
|
53
|
+
accessibilityLabel={accessibilityLabel}
|
|
54
|
+
accessibilityState={{
|
|
55
|
+
checked: selected ?? toggleValue
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
43
58
|
<View style={{ flexShrink: 1 }}>
|
|
44
59
|
<LabelSmallAlt numberOfLines={1} color={theme["textBody-default"]}>
|
|
45
|
-
{
|
|
60
|
+
{label} con nome molto molto lungo
|
|
46
61
|
</LabelSmallAlt>
|
|
47
|
-
{
|
|
62
|
+
{isSuggested && (
|
|
48
63
|
<>
|
|
49
64
|
<VSpacer size={4} />
|
|
50
65
|
<View style={styles.rowCenter}>
|
|
51
66
|
<Icon name="sparkles" size={16} color={suggestColor} />
|
|
52
67
|
<HSpacer size={4} />
|
|
53
68
|
<LabelSmall weight="Regular" color={suggestColor}>
|
|
54
|
-
{
|
|
69
|
+
{suggestReason}
|
|
55
70
|
</LabelSmall>
|
|
56
71
|
</View>
|
|
57
72
|
</>
|
|
@@ -60,10 +75,10 @@ export const ListItemRadioWithAmount = (
|
|
|
60
75
|
<View pointerEvents="none" style={{ flexDirection: "row" }}>
|
|
61
76
|
<HSpacer size={8} />
|
|
62
77
|
<H6 color={theme["interactiveElem-default"]}>
|
|
63
|
-
{
|
|
78
|
+
{formattedAmountString}
|
|
64
79
|
</H6>
|
|
65
80
|
<HSpacer size={8} />
|
|
66
|
-
<AnimatedRadio checked={
|
|
81
|
+
<AnimatedRadio checked={selected ?? toggleValue} />
|
|
67
82
|
</View>
|
|
68
83
|
</PressableListItemBase>
|
|
69
84
|
);
|
|
@@ -5,15 +5,23 @@ import { IOListItemStyles } from "../../core";
|
|
|
5
5
|
import { WithTestID } from "../../utils/types";
|
|
6
6
|
import { useListItemSpringAnimation } from "./hooks/useListItemSpringAnimation";
|
|
7
7
|
|
|
8
|
-
export type PressableBaseProps = WithTestID<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export type PressableBaseProps = WithTestID<
|
|
9
|
+
Pick<
|
|
10
|
+
React.ComponentProps<typeof Pressable>,
|
|
11
|
+
| "onPress"
|
|
12
|
+
| "accessibilityLabel"
|
|
13
|
+
| "accessibilityHint"
|
|
14
|
+
| "accessibilityState"
|
|
15
|
+
| "accessibilityRole"
|
|
16
|
+
>
|
|
17
|
+
>;
|
|
18
|
+
|
|
12
19
|
export const PressableListItemBase = ({
|
|
13
20
|
onPress,
|
|
14
21
|
testID,
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
children,
|
|
23
|
+
accessibilityRole,
|
|
24
|
+
...props
|
|
17
25
|
}: React.PropsWithChildren<PressableBaseProps>) => {
|
|
18
26
|
const { onPressIn, onPressOut, animatedScaleStyle, animatedBackgroundStyle } =
|
|
19
27
|
useListItemSpringAnimation();
|
|
@@ -22,11 +30,11 @@ export const PressableListItemBase = ({
|
|
|
22
30
|
onPress={onPress}
|
|
23
31
|
testID={testID}
|
|
24
32
|
accessible={true}
|
|
25
|
-
accessibilityLabel={accessibilityLabel}
|
|
26
33
|
onPressIn={onPressIn}
|
|
27
34
|
onPressOut={onPressOut}
|
|
28
35
|
onTouchEnd={onPressOut}
|
|
29
|
-
accessibilityRole="button"
|
|
36
|
+
accessibilityRole={accessibilityRole || "button"}
|
|
37
|
+
{...props}
|
|
30
38
|
>
|
|
31
39
|
<Animated.View
|
|
32
40
|
style={[IOListItemStyles.listItem, animatedBackgroundStyle]}
|
|
@@ -777,7 +777,7 @@ exports[`Test List Item Components - Experimental Enabled ListItemNavAlert Snap
|
|
|
777
777
|
"borderWidth": 0,
|
|
778
778
|
},
|
|
779
779
|
{
|
|
780
|
-
"color": "#
|
|
780
|
+
"color": "#D13333",
|
|
781
781
|
},
|
|
782
782
|
{
|
|
783
783
|
"flex": 0,
|
|
@@ -786,7 +786,7 @@ exports[`Test List Item Components - Experimental Enabled ListItemNavAlert Snap
|
|
|
786
786
|
},
|
|
787
787
|
]
|
|
788
788
|
}
|
|
789
|
-
tintColor="#
|
|
789
|
+
tintColor="#D13333"
|
|
790
790
|
vbHeight={24}
|
|
791
791
|
vbWidth={24}
|
|
792
792
|
width={24}
|
|
@@ -931,11 +931,11 @@ exports[`Test List Item Components - Experimental Enabled ListItemNavAlert Snap
|
|
|
931
931
|
|
|
932
932
|
exports[`Test List Item Components - Experimental Enabled ListItemRadioWithAmount Snapshot 1`] = `
|
|
933
933
|
<View
|
|
934
|
-
accessibilityRole="
|
|
934
|
+
accessibilityRole="radio"
|
|
935
935
|
accessibilityState={
|
|
936
936
|
{
|
|
937
937
|
"busy": undefined,
|
|
938
|
-
"checked":
|
|
938
|
+
"checked": true,
|
|
939
939
|
"disabled": undefined,
|
|
940
940
|
"expanded": undefined,
|
|
941
941
|
"selected": undefined,
|
|
@@ -1348,11 +1348,11 @@ exports[`Test List Item Components - Experimental Enabled ListItemRadioWithAmou
|
|
|
1348
1348
|
|
|
1349
1349
|
exports[`Test List Item Components - Experimental Enabled ListItemRadioWithAmount Snapshot 2`] = `
|
|
1350
1350
|
<View
|
|
1351
|
-
accessibilityRole="
|
|
1351
|
+
accessibilityRole="radio"
|
|
1352
1352
|
accessibilityState={
|
|
1353
1353
|
{
|
|
1354
1354
|
"busy": undefined,
|
|
1355
|
-
"checked":
|
|
1355
|
+
"checked": false,
|
|
1356
1356
|
"disabled": undefined,
|
|
1357
1357
|
"expanded": undefined,
|
|
1358
1358
|
"selected": undefined,
|
|
@@ -2582,7 +2582,7 @@ exports[`Test List Item Components ListItemNavAlert Snapshot 1`] = `
|
|
|
2582
2582
|
"borderWidth": 0,
|
|
2583
2583
|
},
|
|
2584
2584
|
{
|
|
2585
|
-
"color": "#
|
|
2585
|
+
"color": "#D13333",
|
|
2586
2586
|
},
|
|
2587
2587
|
{
|
|
2588
2588
|
"flex": 0,
|
|
@@ -2591,7 +2591,7 @@ exports[`Test List Item Components ListItemNavAlert Snapshot 1`] = `
|
|
|
2591
2591
|
},
|
|
2592
2592
|
]
|
|
2593
2593
|
}
|
|
2594
|
-
tintColor="#
|
|
2594
|
+
tintColor="#D13333"
|
|
2595
2595
|
vbHeight={24}
|
|
2596
2596
|
vbWidth={24}
|
|
2597
2597
|
width={24}
|
|
@@ -2736,11 +2736,11 @@ exports[`Test List Item Components ListItemNavAlert Snapshot 1`] = `
|
|
|
2736
2736
|
|
|
2737
2737
|
exports[`Test List Item Components ListItemRadioWithAmount Snapshot 1`] = `
|
|
2738
2738
|
<View
|
|
2739
|
-
accessibilityRole="
|
|
2739
|
+
accessibilityRole="radio"
|
|
2740
2740
|
accessibilityState={
|
|
2741
2741
|
{
|
|
2742
2742
|
"busy": undefined,
|
|
2743
|
-
"checked":
|
|
2743
|
+
"checked": true,
|
|
2744
2744
|
"disabled": undefined,
|
|
2745
2745
|
"expanded": undefined,
|
|
2746
2746
|
"selected": undefined,
|
|
@@ -3153,11 +3153,11 @@ exports[`Test List Item Components ListItemRadioWithAmount Snapshot 1`] = `
|
|
|
3153
3153
|
|
|
3154
3154
|
exports[`Test List Item Components ListItemRadioWithAmount Snapshot 2`] = `
|
|
3155
3155
|
<View
|
|
3156
|
-
accessibilityRole="
|
|
3156
|
+
accessibilityRole="radio"
|
|
3157
3157
|
accessibilityState={
|
|
3158
3158
|
{
|
|
3159
3159
|
"busy": undefined,
|
|
3160
|
-
"checked":
|
|
3160
|
+
"checked": false,
|
|
3161
3161
|
"disabled": undefined,
|
|
3162
3162
|
"expanded": undefined,
|
|
3163
3163
|
"selected": undefined,
|
|
@@ -23,11 +23,11 @@ import {
|
|
|
23
23
|
useIOTheme
|
|
24
24
|
} from "../../core";
|
|
25
25
|
import { WithTestID } from "../../utils/types";
|
|
26
|
-
import { Icon } from "../icons";
|
|
27
|
-
import { LabelSmall } from "../typography";
|
|
28
|
-
import { VSpacer } from "../spacer";
|
|
29
26
|
import { Badge } from "../badge";
|
|
27
|
+
import { Icon } from "../icons";
|
|
30
28
|
import { LoadingSpinner } from "../loadingSpinner";
|
|
29
|
+
import { VSpacer } from "../spacer";
|
|
30
|
+
import { LabelSmall } from "../typography";
|
|
31
31
|
|
|
32
32
|
type PartialProps = WithTestID<{
|
|
33
33
|
title: string;
|
|
@@ -243,6 +243,7 @@ const SkeletonComponent = ({
|
|
|
243
243
|
<View
|
|
244
244
|
style={styles.button}
|
|
245
245
|
accessible={true}
|
|
246
|
+
accessibilityState={{ busy: true }}
|
|
246
247
|
accessibilityLabel={loadingAccessibilityLabel}
|
|
247
248
|
>
|
|
248
249
|
<View style={styles.innerContent}>
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Image,
|
|
4
|
+
ImageSourcePropType,
|
|
5
|
+
ImageURISource,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
View
|
|
8
|
+
} from "react-native";
|
|
3
9
|
import Placeholder from "rn-placeholder";
|
|
4
10
|
import {
|
|
5
11
|
IOModuleStyles,
|
|
12
|
+
IOSelectionListItemVisualParams,
|
|
6
13
|
IOSpacingScale,
|
|
7
14
|
IOStyles,
|
|
8
15
|
useIOTheme
|
|
@@ -13,54 +20,57 @@ import { HSpacer, VSpacer } from "../spacer";
|
|
|
13
20
|
import { H6, LabelSmall } from "../typography";
|
|
14
21
|
import { PressableModuleBase } from "./PressableModuleBase";
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
type ModuleCheckoutPartialProps =
|
|
19
|
-
| {
|
|
20
|
-
isLoading?: false;
|
|
21
|
-
paymentLogo?: IOLogoPaymentType;
|
|
22
|
-
title: string;
|
|
23
|
-
subtitle?: string;
|
|
24
|
-
onPress: () => void;
|
|
25
|
-
}
|
|
26
|
-
| {
|
|
27
|
-
isLoading: true;
|
|
28
|
-
paymentLogo?: never;
|
|
29
|
-
title?: never;
|
|
30
|
-
subtitle?: never;
|
|
31
|
-
onPress?: never;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export type ModuleCheckoutProps = ModuleCheckoutPartialProps & {
|
|
23
|
+
type LoadingProps = {
|
|
24
|
+
isLoading: true;
|
|
35
25
|
ctaText?: string;
|
|
36
26
|
};
|
|
37
27
|
|
|
38
|
-
type
|
|
28
|
+
type ImageProps =
|
|
29
|
+
| { paymentLogo: IOLogoPaymentType; image?: never }
|
|
30
|
+
| { paymentLogo?: never; image: ImageURISource | ImageSourcePropType }
|
|
31
|
+
| { paymentLogo?: never; image?: never };
|
|
39
32
|
|
|
40
|
-
|
|
33
|
+
type BaseProps = {
|
|
34
|
+
isLoading?: false;
|
|
35
|
+
paymentLogo?: IOLogoPaymentType;
|
|
36
|
+
title: string;
|
|
37
|
+
subtitle?: string;
|
|
38
|
+
ctaText?: string;
|
|
39
|
+
onPress: () => void;
|
|
40
|
+
} & ImageProps;
|
|
41
|
+
|
|
42
|
+
export type ModuleCheckoutProps = LoadingProps | BaseProps;
|
|
41
43
|
|
|
42
44
|
export const ModuleCheckout = (props: ModuleCheckoutProps) => {
|
|
43
45
|
const theme = useIOTheme();
|
|
44
46
|
|
|
45
47
|
if (props.isLoading) {
|
|
46
|
-
return <LoadingVersion
|
|
48
|
+
return <LoadingVersion {...props} />;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
const
|
|
51
|
+
const { paymentLogo, image } = props;
|
|
50
52
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
so we use a row and a marginEnd on the logo
|
|
57
|
-
*/}
|
|
58
|
-
{props.paymentLogo && (
|
|
59
|
-
<View style={{ marginEnd: paymentLogoEndMargin }}>
|
|
60
|
-
<LogoPayment name={props.paymentLogo} />
|
|
53
|
+
const imageComponent = (
|
|
54
|
+
<>
|
|
55
|
+
{paymentLogo && (
|
|
56
|
+
<View style={styles.imageWrapper}>
|
|
57
|
+
<LogoPayment name={paymentLogo} />
|
|
61
58
|
</View>
|
|
62
59
|
)}
|
|
63
|
-
|
|
60
|
+
{image && (
|
|
61
|
+
<Image
|
|
62
|
+
source={image}
|
|
63
|
+
style={[styles.imageWrapper, styles.image]}
|
|
64
|
+
accessibilityIgnoresInvertColors={true}
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
67
|
+
</>
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const ModuleBaseContent = () => (
|
|
71
|
+
<>
|
|
72
|
+
{imageComponent}
|
|
73
|
+
<View style={styles.content}>
|
|
64
74
|
<H6>{props.title}</H6>
|
|
65
75
|
{props.subtitle && (
|
|
66
76
|
<LabelSmall weight="Regular" color={theme["textBody-tertiary"]}>
|
|
@@ -68,14 +78,14 @@ export const ModuleCheckout = (props: ModuleCheckoutProps) => {
|
|
|
68
78
|
</LabelSmall>
|
|
69
79
|
)}
|
|
70
80
|
</View>
|
|
71
|
-
|
|
81
|
+
</>
|
|
72
82
|
);
|
|
73
83
|
|
|
74
84
|
if (props.ctaText) {
|
|
75
85
|
return (
|
|
76
86
|
<PressableModuleBase onPress={props.onPress}>
|
|
77
87
|
<ModuleBaseContent />
|
|
78
|
-
{props.ctaText && <
|
|
88
|
+
{props.ctaText && <ModuleAction ctaText={props.ctaText} />}
|
|
79
89
|
</PressableModuleBase>
|
|
80
90
|
);
|
|
81
91
|
}
|
|
@@ -87,21 +97,19 @@ export const ModuleCheckout = (props: ModuleCheckoutProps) => {
|
|
|
87
97
|
);
|
|
88
98
|
};
|
|
89
99
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const CTA = ({ text }: CtaOnlyProps) => (
|
|
100
|
+
const ModuleAction = ({ ctaText }: Pick<ModuleCheckoutProps, "ctaText">) => (
|
|
93
101
|
<View pointerEvents="none">
|
|
94
102
|
<ButtonLink
|
|
95
|
-
label={
|
|
96
|
-
accessibilityLabel={
|
|
103
|
+
label={ctaText ?? ""}
|
|
104
|
+
accessibilityLabel={ctaText}
|
|
97
105
|
onPress={() => null}
|
|
98
106
|
/>
|
|
99
107
|
</View>
|
|
100
108
|
);
|
|
101
109
|
|
|
102
|
-
const LoadingVersion = ({
|
|
110
|
+
const LoadingVersion = ({ ctaText }: LoadingProps) => (
|
|
103
111
|
<View style={IOModuleStyles.button}>
|
|
104
|
-
<View style={
|
|
112
|
+
<View style={[IOStyles.row, IOStyles.alignCenter]}>
|
|
105
113
|
<Placeholder.Box animate="fade" radius={8} height={24} width={24} />
|
|
106
114
|
<HSpacer size={8} />
|
|
107
115
|
<View>
|
|
@@ -110,16 +118,23 @@ const LoadingVersion = ({ text }: CtaOnlyProps) => (
|
|
|
110
118
|
<Placeholder.Box animate="fade" radius={8} height={16} width={116} />
|
|
111
119
|
</View>
|
|
112
120
|
</View>
|
|
113
|
-
<
|
|
121
|
+
<ModuleAction ctaText={ctaText} />
|
|
114
122
|
</View>
|
|
115
123
|
);
|
|
116
124
|
|
|
117
|
-
|
|
125
|
+
const imageMarginRight: IOSpacingScale = 12;
|
|
118
126
|
|
|
119
127
|
const styles = StyleSheet.create({
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
128
|
+
imageWrapper: {
|
|
129
|
+
marginRight: imageMarginRight
|
|
130
|
+
},
|
|
131
|
+
image: {
|
|
132
|
+
width: IOSelectionListItemVisualParams.iconSize,
|
|
133
|
+
height: IOSelectionListItemVisualParams.iconSize,
|
|
134
|
+
resizeMode: "contain"
|
|
135
|
+
},
|
|
136
|
+
content: {
|
|
137
|
+
flexGrow: 1,
|
|
138
|
+
flexShrink: 1
|
|
124
139
|
}
|
|
125
140
|
});
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
View
|
|
8
8
|
} from "react-native";
|
|
9
9
|
import Placeholder from "rn-placeholder";
|
|
10
|
-
import { WithTestID } from "src/utils/types";
|
|
11
10
|
import {
|
|
12
11
|
IOListItemVisualParams,
|
|
13
12
|
IOModuleStyles,
|
|
@@ -15,6 +14,7 @@ import {
|
|
|
15
14
|
IOStyles,
|
|
16
15
|
useIOTheme
|
|
17
16
|
} from "../../core";
|
|
17
|
+
import { WithTestID } from "../../utils/types";
|
|
18
18
|
import { Badge } from "../badge";
|
|
19
19
|
import { IOIcons, Icon } from "../icons";
|
|
20
20
|
import { HSpacer } from "../spacer";
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { PropsWithChildren } from "react";
|
|
3
|
+
import { Pressable } from "react-native";
|
|
3
4
|
import Animated from "react-native-reanimated";
|
|
4
5
|
import { IOModuleIDPSavedVSpacing, IOModuleStyles } from "../../core";
|
|
5
6
|
import { WithTestID } from "../../utils/types";
|
|
6
7
|
import { useModuleSpringAnimation } from "./hooks/useModuleSpringAnimation";
|
|
7
8
|
|
|
8
|
-
export type PressableModuleBaseProps = WithTestID<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
export type PressableModuleBaseProps = WithTestID<
|
|
10
|
+
{
|
|
11
|
+
withLooseSpacing?: boolean;
|
|
12
|
+
} & Pick<
|
|
13
|
+
React.ComponentProps<typeof Pressable>,
|
|
14
|
+
"onPress" | "accessibilityLabel" | "accessibilityHint"
|
|
15
|
+
>
|
|
16
|
+
>;
|
|
13
17
|
|
|
14
18
|
export const PressableModuleBase = ({
|
|
15
19
|
onPress,
|
|
16
|
-
testID,
|
|
17
|
-
accessibilityLabel,
|
|
18
20
|
withLooseSpacing = false,
|
|
21
|
+
accessibilityLabel,
|
|
22
|
+
accessibilityHint,
|
|
23
|
+
testID,
|
|
19
24
|
children
|
|
20
|
-
}:
|
|
25
|
+
}: PropsWithChildren<PressableModuleBaseProps>) => {
|
|
21
26
|
const { handlePressIn, handlePressOut, animatedStyle } =
|
|
22
27
|
useModuleSpringAnimation();
|
|
23
28
|
return (
|
|
@@ -25,10 +30,11 @@ export const PressableModuleBase = ({
|
|
|
25
30
|
onPress={onPress}
|
|
26
31
|
testID={testID}
|
|
27
32
|
accessible={true}
|
|
28
|
-
accessibilityLabel={accessibilityLabel}
|
|
29
33
|
onPressIn={handlePressIn}
|
|
30
34
|
onPressOut={handlePressOut}
|
|
31
35
|
onTouchEnd={handlePressOut}
|
|
36
|
+
accessibilityLabel={accessibilityLabel}
|
|
37
|
+
accessibilityHint={accessibilityHint}
|
|
32
38
|
accessibilityRole="button"
|
|
33
39
|
>
|
|
34
40
|
<Animated.View
|