@pagopa/io-app-design-system 5.1.1 → 5.1.3
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/Banner.js +3 -5
- package/lib/commonjs/components/banner/Banner.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonLink.js +2 -1
- package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
- package/lib/commonjs/components/featureInfo/FeatureInfo.js +6 -1
- package/lib/commonjs/components/featureInfo/FeatureInfo.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemRadio.js +12 -3
- package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemTransaction.js +12 -3
- package/lib/commonjs/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +12 -2
- package/lib/commonjs/components/modules/ModuleAttachment.js +13 -2
- package/lib/commonjs/components/modules/ModuleAttachment.js.map +1 -1
- package/lib/commonjs/components/modules/ModuleCheckout.js +11 -2
- package/lib/commonjs/components/modules/ModuleCheckout.js.map +1 -1
- package/lib/commonjs/components/modules/ModuleCredential.js +11 -2
- package/lib/commonjs/components/modules/ModuleCredential.js.map +1 -1
- package/lib/commonjs/components/modules/ModuleNavigation.js +11 -2
- package/lib/commonjs/components/modules/ModuleNavigation.js.map +1 -1
- package/lib/commonjs/components/modules/ModulePaymentNotice.js +12 -2
- package/lib/commonjs/components/modules/ModulePaymentNotice.js.map +1 -1
- package/lib/commonjs/components/modules/ModuleStatic.js +7 -2
- package/lib/commonjs/components/modules/ModuleStatic.js.map +1 -1
- package/lib/commonjs/components/textInput/TextInputBase.js +26 -8
- package/lib/commonjs/components/textInput/TextInputBase.js.map +1 -1
- package/lib/commonjs/components/typography/Body.js +2 -1
- package/lib/commonjs/components/typography/Body.js.map +1 -1
- package/lib/commonjs/components/typography/BodySmall.js +2 -1
- package/lib/commonjs/components/typography/BodySmall.js.map +1 -1
- package/lib/commonjs/components/typography/IOText.js.map +1 -1
- package/lib/commonjs/components/typography/LabelMini.js +2 -1
- package/lib/commonjs/components/typography/LabelMini.js.map +1 -1
- package/lib/module/components/banner/Banner.js +3 -5
- package/lib/module/components/banner/Banner.js.map +1 -1
- package/lib/module/components/buttons/ButtonLink.js +2 -1
- package/lib/module/components/buttons/ButtonLink.js.map +1 -1
- package/lib/module/components/featureInfo/FeatureInfo.js +6 -1
- package/lib/module/components/featureInfo/FeatureInfo.js.map +1 -1
- package/lib/module/components/listitems/ListItemRadio.js +12 -3
- package/lib/module/components/listitems/ListItemRadio.js.map +1 -1
- package/lib/module/components/listitems/ListItemTransaction.js +12 -3
- package/lib/module/components/listitems/ListItemTransaction.js.map +1 -1
- package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +12 -2
- package/lib/module/components/modules/ModuleAttachment.js +13 -2
- package/lib/module/components/modules/ModuleAttachment.js.map +1 -1
- package/lib/module/components/modules/ModuleCheckout.js +11 -2
- package/lib/module/components/modules/ModuleCheckout.js.map +1 -1
- package/lib/module/components/modules/ModuleCredential.js +11 -2
- package/lib/module/components/modules/ModuleCredential.js.map +1 -1
- package/lib/module/components/modules/ModuleNavigation.js +11 -2
- package/lib/module/components/modules/ModuleNavigation.js.map +1 -1
- package/lib/module/components/modules/ModulePaymentNotice.js +12 -2
- package/lib/module/components/modules/ModulePaymentNotice.js.map +1 -1
- package/lib/module/components/modules/ModuleStatic.js +7 -2
- package/lib/module/components/modules/ModuleStatic.js.map +1 -1
- package/lib/module/components/textInput/TextInputBase.js +26 -8
- package/lib/module/components/textInput/TextInputBase.js.map +1 -1
- package/lib/module/components/typography/Body.js +2 -1
- package/lib/module/components/typography/Body.js.map +1 -1
- package/lib/module/components/typography/BodySmall.js +2 -1
- package/lib/module/components/typography/BodySmall.js.map +1 -1
- package/lib/module/components/typography/IOText.js.map +1 -1
- package/lib/module/components/typography/LabelMini.js +2 -1
- package/lib/module/components/typography/LabelMini.js.map +1 -1
- package/lib/typescript/components/banner/Banner.d.ts +3 -3
- package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonLink.d.ts +3 -1
- package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
- package/lib/typescript/components/featureInfo/FeatureInfo.d.ts +2 -1
- package/lib/typescript/components/featureInfo/FeatureInfo.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemRadio.d.ts +2 -0
- package/lib/typescript/components/listitems/ListItemRadio.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemTransaction.d.ts +2 -1
- package/lib/typescript/components/listitems/ListItemTransaction.d.ts.map +1 -1
- package/lib/typescript/components/modules/ModuleAttachment.d.ts +3 -1
- package/lib/typescript/components/modules/ModuleAttachment.d.ts.map +1 -1
- package/lib/typescript/components/modules/ModuleCheckout.d.ts +1 -0
- package/lib/typescript/components/modules/ModuleCheckout.d.ts.map +1 -1
- package/lib/typescript/components/modules/ModuleCredential.d.ts +1 -0
- package/lib/typescript/components/modules/ModuleCredential.d.ts.map +1 -1
- package/lib/typescript/components/modules/ModuleNavigation.d.ts +1 -0
- package/lib/typescript/components/modules/ModuleNavigation.d.ts.map +1 -1
- package/lib/typescript/components/modules/ModulePaymentNotice.d.ts +2 -1
- package/lib/typescript/components/modules/ModulePaymentNotice.d.ts.map +1 -1
- package/lib/typescript/components/modules/ModuleStatic.d.ts +3 -3
- package/lib/typescript/components/modules/ModuleStatic.d.ts.map +1 -1
- package/lib/typescript/components/textInput/TextInputBase.d.ts.map +1 -1
- package/lib/typescript/components/typography/Body.d.ts.map +1 -1
- package/lib/typescript/components/typography/BodySmall.d.ts.map +1 -1
- package/lib/typescript/components/typography/IOText.d.ts +2 -1
- package/lib/typescript/components/typography/IOText.d.ts.map +1 -1
- package/lib/typescript/components/typography/LabelMini.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/banner/Banner.tsx +4 -6
- package/src/components/buttons/ButtonLink.tsx +4 -1
- package/src/components/featureInfo/FeatureInfo.tsx +7 -1
- package/src/components/listitems/ListItemRadio.tsx +14 -3
- package/src/components/listitems/ListItemTransaction.tsx +16 -3
- package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +12 -2
- package/src/components/modules/ModuleAttachment.tsx +14 -2
- package/src/components/modules/ModuleCheckout.tsx +12 -2
- package/src/components/modules/ModuleCredential.tsx +10 -2
- package/src/components/modules/ModuleNavigation.tsx +12 -2
- package/src/components/modules/ModulePaymentNotice.tsx +13 -2
- package/src/components/modules/ModuleStatic.tsx +13 -6
- package/src/components/textInput/TextInputBase.tsx +38 -8
- package/src/components/typography/Body.tsx +8 -2
- package/src/components/typography/BodySmall.tsx +8 -2
- package/src/components/typography/IOText.tsx +2 -0
- package/src/components/typography/LabelMini.tsx +8 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
import { GestureResponderEvent } from "react-native";
|
|
2
|
+
import { AccessibilityRole, GestureResponderEvent } from "react-native";
|
|
3
3
|
import {
|
|
4
4
|
BodySmall,
|
|
5
5
|
HStack,
|
|
@@ -23,6 +23,7 @@ type FeatureInfoActionProps =
|
|
|
23
23
|
action: {
|
|
24
24
|
label: string;
|
|
25
25
|
onPress: (event: GestureResponderEvent) => void;
|
|
26
|
+
accessibilityRole?: Extract<AccessibilityRole, "button" | "link">;
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
29
|
| {
|
|
@@ -56,6 +57,10 @@ export const FeatureInfo = ({
|
|
|
56
57
|
}: FeatureInfoProps) => {
|
|
57
58
|
const theme = useIOTheme();
|
|
58
59
|
|
|
60
|
+
/* Already defined in the `BodySmall` component as a fallback value,
|
|
61
|
+
but I keep it here to avoid possible future inconsistencies. */
|
|
62
|
+
const accessibilityRole = action?.accessibilityRole ?? "link";
|
|
63
|
+
|
|
59
64
|
return (
|
|
60
65
|
<HStack style={{ alignItems: "center" }} space={24}>
|
|
61
66
|
{iconName && (
|
|
@@ -83,6 +88,7 @@ export const FeatureInfo = ({
|
|
|
83
88
|
accessible
|
|
84
89
|
importantForAccessibility={"yes"}
|
|
85
90
|
accessibilityElementsHidden={false}
|
|
91
|
+
accessibilityRole={accessibilityRole}
|
|
86
92
|
>
|
|
87
93
|
{action.label}
|
|
88
94
|
</BodySmall>
|
|
@@ -31,11 +31,13 @@ type ListItemRadioLoadingProps =
|
|
|
31
31
|
state: true;
|
|
32
32
|
skeletonDescription?: boolean;
|
|
33
33
|
skeletonIcon?: boolean;
|
|
34
|
+
loadingAccessibilityLabel?: string;
|
|
34
35
|
}
|
|
35
36
|
| {
|
|
36
37
|
state?: false;
|
|
37
38
|
skeletonDescription?: never;
|
|
38
39
|
skeletonIcon?: never;
|
|
40
|
+
loadingAccessibilityLabel?: never;
|
|
39
41
|
};
|
|
40
42
|
|
|
41
43
|
type Props = WithTestID<{
|
|
@@ -122,8 +124,15 @@ export const ListItemRadio = ({
|
|
|
122
124
|
</View>
|
|
123
125
|
);
|
|
124
126
|
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
+
const ListItemRadioSkeleton = ({
|
|
128
|
+
loadingAccessibilityLabel
|
|
129
|
+
}: Pick<ListItemRadioLoadingProps, "loadingAccessibilityLabel">) => (
|
|
130
|
+
<View
|
|
131
|
+
style={[IOSelectionListItemStyles.listItem, { rowGap: 8 }]}
|
|
132
|
+
accessible={true}
|
|
133
|
+
accessibilityLabel={loadingAccessibilityLabel}
|
|
134
|
+
accessibilityState={{ busy: true }}
|
|
135
|
+
>
|
|
127
136
|
<View style={IOSelectionListItemStyles.listItemInner}>
|
|
128
137
|
<View
|
|
129
138
|
style={[
|
|
@@ -155,7 +164,9 @@ export const ListItemRadio = ({
|
|
|
155
164
|
);
|
|
156
165
|
|
|
157
166
|
return loadingProps?.state ? (
|
|
158
|
-
<
|
|
167
|
+
<ListItemRadioSkeleton
|
|
168
|
+
loadingAccessibilityLabel={loadingProps?.loadingAccessibilityLabel}
|
|
169
|
+
/>
|
|
159
170
|
) : (
|
|
160
171
|
<Pressable
|
|
161
172
|
accessibilityRole="radio"
|
|
@@ -41,6 +41,7 @@ export type ListItemTransaction = WithTestID<
|
|
|
41
41
|
PressableBaseProps & {
|
|
42
42
|
showChevron?: boolean;
|
|
43
43
|
isLoading?: boolean;
|
|
44
|
+
loadingAccessibilityLabel?: string;
|
|
44
45
|
/**
|
|
45
46
|
* A logo that will be displayed on the left of the list item.
|
|
46
47
|
*
|
|
@@ -102,6 +103,7 @@ const StartComponent = ({
|
|
|
102
103
|
|
|
103
104
|
export const ListItemTransaction = ({
|
|
104
105
|
accessibilityLabel,
|
|
106
|
+
loadingAccessibilityLabel,
|
|
105
107
|
showChevron = false,
|
|
106
108
|
isLoading = false,
|
|
107
109
|
paymentLogoIcon,
|
|
@@ -116,7 +118,11 @@ export const ListItemTransaction = ({
|
|
|
116
118
|
const theme = useIOTheme();
|
|
117
119
|
|
|
118
120
|
if (isLoading) {
|
|
119
|
-
return
|
|
121
|
+
return (
|
|
122
|
+
<ListItemTransactionSkeleton
|
|
123
|
+
loadingAccessibilityLabel={loadingAccessibilityLabel}
|
|
124
|
+
/>
|
|
125
|
+
);
|
|
120
126
|
}
|
|
121
127
|
|
|
122
128
|
const interactiveColor: IOColors = theme["interactiveElem-default"];
|
|
@@ -207,8 +213,15 @@ export const ListItemTransaction = ({
|
|
|
207
213
|
}
|
|
208
214
|
};
|
|
209
215
|
|
|
210
|
-
const
|
|
211
|
-
|
|
216
|
+
const ListItemTransactionSkeleton = ({
|
|
217
|
+
loadingAccessibilityLabel
|
|
218
|
+
}: Pick<ListItemTransaction, "loadingAccessibilityLabel">) => (
|
|
219
|
+
<View
|
|
220
|
+
style={IOListItemStyles.listItem}
|
|
221
|
+
accessible={true}
|
|
222
|
+
accessibilityLabel={loadingAccessibilityLabel}
|
|
223
|
+
accessibilityState={{ busy: true }}
|
|
224
|
+
>
|
|
212
225
|
<View style={IOListItemStyles.listItemInner}>
|
|
213
226
|
<View style={{ marginRight: IOListItemVisualParams.iconMargin }}>
|
|
214
227
|
<Placeholder.Box
|
|
@@ -1364,7 +1364,12 @@ exports[`Test List Item Components - Experimental Enabled ListItemRadioWithAmou
|
|
|
1364
1364
|
|
|
1365
1365
|
exports[`Test List Item Components - Experimental Enabled ListItemTransaction Snapshot 1`] = `
|
|
1366
1366
|
<View
|
|
1367
|
-
|
|
1367
|
+
accessibilityState={
|
|
1368
|
+
{
|
|
1369
|
+
"busy": true,
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
accessible={true}
|
|
1368
1373
|
style={
|
|
1369
1374
|
{
|
|
1370
1375
|
"marginHorizontal": -24,
|
|
@@ -2942,7 +2947,12 @@ exports[`Test List Item Components ListItemRadioWithAmount Snapshot 2`] = `
|
|
|
2942
2947
|
|
|
2943
2948
|
exports[`Test List Item Components ListItemTransaction Snapshot 1`] = `
|
|
2944
2949
|
<View
|
|
2945
|
-
|
|
2950
|
+
accessibilityState={
|
|
2951
|
+
{
|
|
2952
|
+
"busy": true,
|
|
2953
|
+
}
|
|
2954
|
+
}
|
|
2955
|
+
accessible={true}
|
|
2946
2956
|
style={
|
|
2947
2957
|
{
|
|
2948
2958
|
"marginHorizontal": -24,
|
|
@@ -16,6 +16,7 @@ type PartialProps = WithTestID<{
|
|
|
16
16
|
format: "doc" | "pdf";
|
|
17
17
|
isLoading?: boolean;
|
|
18
18
|
isFetching?: boolean;
|
|
19
|
+
loadingAccessibilityLabel?: string;
|
|
19
20
|
fetchingAccessibilityLabel?: string;
|
|
20
21
|
onPress: (event: GestureResponderEvent) => void;
|
|
21
22
|
}>;
|
|
@@ -87,6 +88,7 @@ const ModuleAttachmentContent = ({
|
|
|
87
88
|
* @param {string} accessibilityLabel - Optional accessibility label.
|
|
88
89
|
* @param {boolean} disabled - If true, the button is disabled.
|
|
89
90
|
* @param {string} fetchingAccessibilityLabel - Optional accessibility label to use during fetching.
|
|
91
|
+
* @param {string} loadingAccessibilityLabel - Optional accessibility label to use during loading.
|
|
90
92
|
* @param {string} format - Badge content. PDF or DOC.
|
|
91
93
|
* @param {boolean} isLoading - If true, displays a skeleton loading component.
|
|
92
94
|
* @param {boolean} isFetching - If true, displays an activity indicator.
|
|
@@ -99,6 +101,7 @@ export const ModuleAttachment = ({
|
|
|
99
101
|
accessibilityLabel,
|
|
100
102
|
disabled = false,
|
|
101
103
|
fetchingAccessibilityLabel,
|
|
104
|
+
loadingAccessibilityLabel,
|
|
102
105
|
format,
|
|
103
106
|
isLoading = false,
|
|
104
107
|
isFetching = false,
|
|
@@ -117,7 +120,11 @@ export const ModuleAttachment = ({
|
|
|
117
120
|
);
|
|
118
121
|
|
|
119
122
|
if (isLoading) {
|
|
120
|
-
return
|
|
123
|
+
return (
|
|
124
|
+
<ModuleAttachmentSkeleton
|
|
125
|
+
loadingAccessibilityLabel={loadingAccessibilityLabel}
|
|
126
|
+
/>
|
|
127
|
+
);
|
|
121
128
|
}
|
|
122
129
|
|
|
123
130
|
const pressableAccessibilityLabel =
|
|
@@ -149,8 +156,13 @@ export const ModuleAttachment = ({
|
|
|
149
156
|
);
|
|
150
157
|
};
|
|
151
158
|
|
|
152
|
-
const ModuleAttachmentSkeleton = (
|
|
159
|
+
const ModuleAttachmentSkeleton = ({
|
|
160
|
+
loadingAccessibilityLabel
|
|
161
|
+
}: Pick<ModuleAttachmentProps, "loadingAccessibilityLabel">) => (
|
|
153
162
|
<ModuleStatic
|
|
163
|
+
accessible={true}
|
|
164
|
+
accessibilityLabel={loadingAccessibilityLabel}
|
|
165
|
+
accessibilityState={{ busy: true }}
|
|
154
166
|
startBlock={
|
|
155
167
|
<VStack space={4}>
|
|
156
168
|
<Placeholder.Box animate="fade" radius={8} width={114} height={16} />
|
|
@@ -21,6 +21,7 @@ import { PressableModuleBase } from "./PressableModuleBase";
|
|
|
21
21
|
|
|
22
22
|
type LoadingProps = {
|
|
23
23
|
isLoading: true;
|
|
24
|
+
loadingAccessibilityLabel?: string;
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
type ImageProps =
|
|
@@ -45,7 +46,11 @@ export const ModuleCheckout = (props: ModuleCheckoutProps) => {
|
|
|
45
46
|
const imageMargin: IOSpacingScale = 12;
|
|
46
47
|
|
|
47
48
|
if (props.isLoading) {
|
|
48
|
-
return
|
|
49
|
+
return (
|
|
50
|
+
<ModuleCheckoutSkeleton
|
|
51
|
+
loadingAccessibilityLabel={props.loadingAccessibilityLabel}
|
|
52
|
+
/>
|
|
53
|
+
);
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
const { paymentLogo, image, title, subtitle, ctaText, onPress } = props;
|
|
@@ -98,8 +103,13 @@ export const ModuleCheckout = (props: ModuleCheckoutProps) => {
|
|
|
98
103
|
);
|
|
99
104
|
};
|
|
100
105
|
|
|
101
|
-
const ModuleCheckoutSkeleton = (
|
|
106
|
+
const ModuleCheckoutSkeleton = ({
|
|
107
|
+
loadingAccessibilityLabel
|
|
108
|
+
}: Pick<LoadingProps, "loadingAccessibilityLabel">) => (
|
|
102
109
|
<ModuleStatic
|
|
110
|
+
accessible={true}
|
|
111
|
+
accessibilityLabel={loadingAccessibilityLabel}
|
|
112
|
+
accessibilityState={{ busy: true }}
|
|
103
113
|
startBlock={
|
|
104
114
|
<HStack space={8} style={{ alignItems: "center" }}>
|
|
105
115
|
<Placeholder.Box animate="fade" radius={8} height={24} width={24} />
|
|
@@ -32,6 +32,7 @@ type ImageProps =
|
|
|
32
32
|
|
|
33
33
|
type LoadingModuleProps = {
|
|
34
34
|
isLoading: true;
|
|
35
|
+
loadingAccessibilityLabel?: string;
|
|
35
36
|
};
|
|
36
37
|
|
|
37
38
|
type BaseModuleProps = {
|
|
@@ -48,7 +49,9 @@ const ModuleCredential = (
|
|
|
48
49
|
props: WithTestID<LoadingModuleProps | ModuleCredentialProps>
|
|
49
50
|
) =>
|
|
50
51
|
props.isLoading ? (
|
|
51
|
-
<ModuleCredentialSkeleton
|
|
52
|
+
<ModuleCredentialSkeleton
|
|
53
|
+
loadingAccessibilityLabel={props.loadingAccessibilityLabel}
|
|
54
|
+
/>
|
|
52
55
|
) : (
|
|
53
56
|
<ModuleCredentialContent {...props} />
|
|
54
57
|
);
|
|
@@ -144,8 +147,13 @@ const ModuleCredentialContent = ({
|
|
|
144
147
|
);
|
|
145
148
|
};
|
|
146
149
|
|
|
147
|
-
const ModuleCredentialSkeleton = (
|
|
150
|
+
const ModuleCredentialSkeleton = ({
|
|
151
|
+
loadingAccessibilityLabel
|
|
152
|
+
}: Pick<LoadingModuleProps, "loadingAccessibilityLabel">) => (
|
|
148
153
|
<ModuleStatic
|
|
154
|
+
accessible={true}
|
|
155
|
+
accessibilityLabel={loadingAccessibilityLabel}
|
|
156
|
+
accessibilityState={{ busy: true }}
|
|
149
157
|
startBlock={
|
|
150
158
|
<HStack
|
|
151
159
|
style={{ alignItems: "center" }}
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
|
|
29
29
|
type LoadingProps = {
|
|
30
30
|
isLoading: true;
|
|
31
|
+
loadingAccessibilityLabel?: string;
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
type ImageProps =
|
|
@@ -49,7 +50,11 @@ export const ModuleNavigation = (props: WithTestID<ModuleNavigationProps>) => {
|
|
|
49
50
|
const { hugeFontEnabled } = useIOFontDynamicScale();
|
|
50
51
|
|
|
51
52
|
if (props.isLoading) {
|
|
52
|
-
return
|
|
53
|
+
return (
|
|
54
|
+
<ModuleNavigationSkeleton
|
|
55
|
+
loadingAccessibilityLabel={props.loadingAccessibilityLabel}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
const { icon, image, title, subtitle, onPress, badge, ...pressableProps } =
|
|
@@ -111,8 +116,13 @@ export const ModuleNavigation = (props: WithTestID<ModuleNavigationProps>) => {
|
|
|
111
116
|
);
|
|
112
117
|
};
|
|
113
118
|
|
|
114
|
-
const ModuleNavigationSkeleton = (
|
|
119
|
+
const ModuleNavigationSkeleton = ({
|
|
120
|
+
loadingAccessibilityLabel
|
|
121
|
+
}: Pick<LoadingProps, "loadingAccessibilityLabel">) => (
|
|
115
122
|
<ModuleStatic
|
|
123
|
+
accessible={true}
|
|
124
|
+
accessibilityLabel={loadingAccessibilityLabel}
|
|
125
|
+
accessibilityState={{ busy: true }}
|
|
116
126
|
startBlock={
|
|
117
127
|
<HStack
|
|
118
128
|
style={{ alignItems: "center" }}
|
|
@@ -23,6 +23,7 @@ export type ModulePaymentNoticeProps = WithTestID<
|
|
|
23
23
|
{
|
|
24
24
|
isLoading?: boolean;
|
|
25
25
|
accessibilityLabel?: string;
|
|
26
|
+
loadingAccessibilityLabel?: string;
|
|
26
27
|
title?: string;
|
|
27
28
|
subtitle: string;
|
|
28
29
|
onPress: (event: GestureResponderEvent) => void;
|
|
@@ -140,10 +141,15 @@ export const ModulePaymentNotice = ({
|
|
|
140
141
|
testID,
|
|
141
142
|
accessibilityLabel,
|
|
142
143
|
onPress,
|
|
144
|
+
loadingAccessibilityLabel,
|
|
143
145
|
...rest
|
|
144
146
|
}: ModulePaymentNoticeProps) => {
|
|
145
147
|
if (isLoading) {
|
|
146
|
-
return
|
|
148
|
+
return (
|
|
149
|
+
<ModulePaymentNoticeSkeleton
|
|
150
|
+
loadingAccessibilityLabel={loadingAccessibilityLabel}
|
|
151
|
+
/>
|
|
152
|
+
);
|
|
147
153
|
}
|
|
148
154
|
|
|
149
155
|
return (
|
|
@@ -157,8 +163,13 @@ export const ModulePaymentNotice = ({
|
|
|
157
163
|
);
|
|
158
164
|
};
|
|
159
165
|
|
|
160
|
-
const ModulePaymentNoticeSkeleton = (
|
|
166
|
+
const ModulePaymentNoticeSkeleton = ({
|
|
167
|
+
loadingAccessibilityLabel
|
|
168
|
+
}: Pick<ModulePaymentNoticeProps, "loadingAccessibilityLabel">) => (
|
|
161
169
|
<ModuleStatic
|
|
170
|
+
accessible={true}
|
|
171
|
+
accessibilityLabel={loadingAccessibilityLabel}
|
|
172
|
+
accessibilityState={{ busy: true }}
|
|
162
173
|
startBlock={
|
|
163
174
|
<VStack space={4}>
|
|
164
175
|
<Placeholder.Box animate="fade" radius={8} width={120} height={12} />
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { PressableProps, View } from "react-native";
|
|
2
|
+
import { PressableProps, View, ViewProps } from "react-native";
|
|
3
3
|
import { IOColors, IOModuleStyles, useIOTheme } from "../../core";
|
|
4
4
|
import { HStack } from "../stack";
|
|
5
5
|
|
|
6
|
-
type ModuleStaticProps =
|
|
7
|
-
|
|
8
|
-
|
|
|
6
|
+
type ModuleStaticProps = Pick<
|
|
7
|
+
ViewProps,
|
|
8
|
+
"accessible" | "accessibilityLabel" | "accessibilityState"
|
|
9
|
+
> &
|
|
10
|
+
(ModuleStaticSingleBlockProps | ModuleStaticMultipleBlockProps);
|
|
9
11
|
|
|
10
12
|
type ModuleStaticMultipleBlockProps = {
|
|
11
13
|
startBlock: React.ReactNode;
|
|
@@ -27,7 +29,10 @@ export const ModuleStatic = ({
|
|
|
27
29
|
disabled = false,
|
|
28
30
|
startBlock,
|
|
29
31
|
endBlock,
|
|
30
|
-
children
|
|
32
|
+
children,
|
|
33
|
+
accessible = false,
|
|
34
|
+
accessibilityLabel,
|
|
35
|
+
accessibilityState
|
|
31
36
|
}: ModuleStaticProps) => {
|
|
32
37
|
const theme = useIOTheme();
|
|
33
38
|
|
|
@@ -40,7 +45,9 @@ export const ModuleStatic = ({
|
|
|
40
45
|
opacity: disabled ? DISABLED_OPACITY : 1
|
|
41
46
|
}
|
|
42
47
|
]}
|
|
43
|
-
accessible={
|
|
48
|
+
accessible={accessible}
|
|
49
|
+
accessibilityLabel={accessibilityLabel}
|
|
50
|
+
accessibilityState={accessibilityState}
|
|
44
51
|
>
|
|
45
52
|
{startBlock && (
|
|
46
53
|
<HStack space={8} style={{ alignItems: "center" }}>
|
|
@@ -120,17 +120,27 @@ const styles = StyleSheet.create({
|
|
|
120
120
|
|
|
121
121
|
type InputTextHelperRow = Pick<
|
|
122
122
|
InputTextProps,
|
|
123
|
-
|
|
123
|
+
| "value"
|
|
124
|
+
| "counterLimit"
|
|
125
|
+
| "bottomMessage"
|
|
126
|
+
| "bottomMessageColor"
|
|
127
|
+
| "inputType"
|
|
124
128
|
>;
|
|
125
129
|
|
|
126
130
|
const HelperRow = ({
|
|
127
131
|
value,
|
|
128
132
|
counterLimit,
|
|
129
133
|
bottomMessage,
|
|
130
|
-
bottomMessageColor
|
|
134
|
+
bottomMessageColor,
|
|
135
|
+
inputType
|
|
131
136
|
}: InputTextHelperRow) => {
|
|
132
137
|
const theme = useIOTheme();
|
|
133
|
-
|
|
138
|
+
|
|
139
|
+
const valueCount = useMemo(
|
|
140
|
+
() =>
|
|
141
|
+
inputType !== "default" ? value.replace(/\s/g, "").length : value.length,
|
|
142
|
+
[inputType, value]
|
|
143
|
+
);
|
|
134
144
|
|
|
135
145
|
const bottomMessageColorDefault: IOColors = theme["textBody-tertiary"];
|
|
136
146
|
const bottomMessageColorValue =
|
|
@@ -315,12 +325,22 @@ export const TextInputBase = ({
|
|
|
315
325
|
|
|
316
326
|
const onChangeTextHandler = useCallback(
|
|
317
327
|
(text: string) => {
|
|
318
|
-
|
|
328
|
+
const actualTextLength =
|
|
329
|
+
inputType !== "default" ? text.replace(/\s/g, "").length : text.length;
|
|
330
|
+
|
|
331
|
+
if (counterLimit && actualTextLength > counterLimit) {
|
|
319
332
|
return;
|
|
320
333
|
}
|
|
321
|
-
|
|
334
|
+
|
|
335
|
+
if (inputType !== "default") {
|
|
336
|
+
// necessary to omit whitespaces added by the valueFormat function
|
|
337
|
+
const formattedText = text.replace(/\s/g, "");
|
|
338
|
+
onChangeText(formattedText);
|
|
339
|
+
} else {
|
|
340
|
+
onChangeText(text);
|
|
341
|
+
}
|
|
322
342
|
},
|
|
323
|
-
[counterLimit, onChangeText]
|
|
343
|
+
[counterLimit, onChangeText, inputType]
|
|
324
344
|
);
|
|
325
345
|
|
|
326
346
|
const onBlurHandler = useCallback(() => {
|
|
@@ -348,6 +368,15 @@ export const TextInputBase = ({
|
|
|
348
368
|
[value, derivedInputProps]
|
|
349
369
|
);
|
|
350
370
|
|
|
371
|
+
// Calculate the adjusted maxLength to account for spaces
|
|
372
|
+
const adjustedMaxLength = useMemo(() => {
|
|
373
|
+
if (counterLimit && derivedInputProps && derivedInputProps.valueFormat) {
|
|
374
|
+
const spacesCount = Math.floor(counterLimit / 4);
|
|
375
|
+
return counterLimit + spacesCount;
|
|
376
|
+
}
|
|
377
|
+
return counterLimit;
|
|
378
|
+
}, [counterLimit, derivedInputProps]);
|
|
379
|
+
|
|
351
380
|
return (
|
|
352
381
|
<>
|
|
353
382
|
<Pressable
|
|
@@ -407,7 +436,7 @@ export const TextInputBase = ({
|
|
|
407
436
|
accessibilityHint={accessibilityHint}
|
|
408
437
|
selectionColor={IOColors[theme["interactiveElem-default"]]} // Caret on iOS
|
|
409
438
|
cursorColor={IOColors[theme["interactiveElem-default"]]} // Caret Android
|
|
410
|
-
maxLength={
|
|
439
|
+
maxLength={adjustedMaxLength}
|
|
411
440
|
onBlur={onBlurHandler}
|
|
412
441
|
onFocus={onFocusHandler}
|
|
413
442
|
blurOnSubmit={true}
|
|
@@ -499,10 +528,11 @@ export const TextInputBase = ({
|
|
|
499
528
|
|
|
500
529
|
{(bottomMessage || counterLimit) && (
|
|
501
530
|
<HelperRow
|
|
502
|
-
value={
|
|
531
|
+
value={inputValue}
|
|
503
532
|
bottomMessage={bottomMessage}
|
|
504
533
|
bottomMessageColor={bottomMessageColor}
|
|
505
534
|
counterLimit={counterLimit}
|
|
535
|
+
inputType={inputType}
|
|
506
536
|
/>
|
|
507
537
|
)}
|
|
508
538
|
</>
|
|
@@ -24,7 +24,13 @@ const legacyFontName: IOFontFamily = "TitilliumSansPro";
|
|
|
24
24
|
*/
|
|
25
25
|
export const Body = forwardRef<View, BodyStyleProps>(
|
|
26
26
|
(
|
|
27
|
-
{
|
|
27
|
+
{
|
|
28
|
+
weight: customWeight,
|
|
29
|
+
color: customColor,
|
|
30
|
+
asLink,
|
|
31
|
+
accessibilityRole = "link",
|
|
32
|
+
...props
|
|
33
|
+
},
|
|
28
34
|
ref?: ForwardedRef<View>
|
|
29
35
|
) => {
|
|
30
36
|
const theme = useIOTheme();
|
|
@@ -44,7 +50,7 @@ export const Body = forwardRef<View, BodyStyleProps>(
|
|
|
44
50
|
color: customColor ?? defaultColor,
|
|
45
51
|
...(asLink
|
|
46
52
|
? {
|
|
47
|
-
accessibilityRole
|
|
53
|
+
accessibilityRole,
|
|
48
54
|
textStyle: { textDecorationLine: "underline" }
|
|
49
55
|
}
|
|
50
56
|
: {})
|
|
@@ -21,7 +21,13 @@ const legacyFontName: IOFontFamily = "TitilliumSansPro";
|
|
|
21
21
|
*/
|
|
22
22
|
export const BodySmall = forwardRef<View, BodySmallProps>(
|
|
23
23
|
(
|
|
24
|
-
{
|
|
24
|
+
{
|
|
25
|
+
weight: customWeight,
|
|
26
|
+
color: customColor,
|
|
27
|
+
asLink,
|
|
28
|
+
accessibilityRole = "link",
|
|
29
|
+
...props
|
|
30
|
+
},
|
|
25
31
|
ref?: ForwardedRef<View>
|
|
26
32
|
) => {
|
|
27
33
|
const theme = useIOTheme();
|
|
@@ -41,7 +47,7 @@ export const BodySmall = forwardRef<View, BodySmallProps>(
|
|
|
41
47
|
color: customColor ?? defaultColor,
|
|
42
48
|
...(asLink
|
|
43
49
|
? {
|
|
44
|
-
accessibilityRole
|
|
50
|
+
accessibilityRole,
|
|
45
51
|
textStyle: { textDecorationLine: "underline" }
|
|
46
52
|
}
|
|
47
53
|
: {})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ComponentProps, forwardRef, useMemo } from "react";
|
|
2
2
|
import {
|
|
3
|
+
AccessibilityRole,
|
|
3
4
|
ColorValue,
|
|
4
5
|
GestureResponderEvent,
|
|
5
6
|
Text,
|
|
@@ -60,6 +61,7 @@ export type TypographicStyleAsLinkProps =
|
|
|
60
61
|
color?: never;
|
|
61
62
|
asLink: true;
|
|
62
63
|
onPress: (event: GestureResponderEvent) => void;
|
|
64
|
+
accessibilityRole?: Extract<AccessibilityRole, "button" | "link">;
|
|
63
65
|
}
|
|
64
66
|
| { color?: IOColors; asLink?: false };
|
|
65
67
|
|
|
@@ -21,7 +21,13 @@ const legacyFontName: IOFontFamily = "TitilliumSansPro";
|
|
|
21
21
|
*/
|
|
22
22
|
export const LabelMini = forwardRef<View, LabelMiniProps>(
|
|
23
23
|
(
|
|
24
|
-
{
|
|
24
|
+
{
|
|
25
|
+
weight: customWeight,
|
|
26
|
+
color: customColor,
|
|
27
|
+
asLink,
|
|
28
|
+
accessibilityRole = "link",
|
|
29
|
+
...props
|
|
30
|
+
},
|
|
25
31
|
ref?: ForwardedRef<View>
|
|
26
32
|
) => {
|
|
27
33
|
const theme = useIOTheme();
|
|
@@ -41,7 +47,7 @@ export const LabelMini = forwardRef<View, LabelMiniProps>(
|
|
|
41
47
|
color: customColor ?? defaultColor,
|
|
42
48
|
...(asLink
|
|
43
49
|
? {
|
|
44
|
-
accessibilityRole
|
|
50
|
+
accessibilityRole,
|
|
45
51
|
textStyle: { textDecorationLine: "underline" }
|
|
46
52
|
}
|
|
47
53
|
: {})
|