jfs-components 0.1.18 → 0.1.19
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/CHANGELOG.md +6 -0
- package/lib/commonjs/components/Card/Card.js +29 -12
- package/lib/commonjs/components/CardFeedback/CardFeedback.js +16 -2
- package/lib/commonjs/components/CardInsight/CardInsight.js +34 -13
- package/lib/commonjs/components/CardProviderInfo/CardProviderInfo.js +23 -3
- package/lib/commonjs/components/DebitCard/DebitCard.js +23 -3
- package/lib/commonjs/components/MediaCard/MediaCard.js +24 -7
- package/lib/commonjs/components/RechargeCard/RechargeCard.js +34 -13
- package/lib/commonjs/components/TestimonialsCard/TestimonialsCard.js +23 -5
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/module/components/Card/Card.js +31 -14
- package/lib/module/components/CardFeedback/CardFeedback.js +17 -3
- package/lib/module/components/CardInsight/CardInsight.js +36 -15
- package/lib/module/components/CardProviderInfo/CardProviderInfo.js +25 -5
- package/lib/module/components/DebitCard/DebitCard.js +25 -5
- package/lib/module/components/MediaCard/MediaCard.js +26 -9
- package/lib/module/components/RechargeCard/RechargeCard.js +36 -15
- package/lib/module/components/TestimonialsCard/TestimonialsCard.js +25 -7
- package/lib/module/icons/registry.js +1 -1
- package/lib/typescript/src/components/Card/Card.d.ts +10 -1
- package/lib/typescript/src/components/CardFeedback/CardFeedback.d.ts +10 -1
- package/lib/typescript/src/components/CardInsight/CardInsight.d.ts +10 -1
- package/lib/typescript/src/components/CardProviderInfo/CardProviderInfo.d.ts +10 -1
- package/lib/typescript/src/components/DebitCard/DebitCard.d.ts +10 -1
- package/lib/typescript/src/components/MediaCard/MediaCard.d.ts +10 -1
- package/lib/typescript/src/components/RechargeCard/RechargeCard.d.ts +10 -1
- package/lib/typescript/src/components/TestimonialsCard/TestimonialsCard.d.ts +8 -1
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Card/Card.tsx +46 -15
- package/src/components/CardFeedback/CardFeedback.tsx +29 -4
- package/src/components/CardInsight/CardInsight.tsx +48 -17
- package/src/components/CardProviderInfo/CardProviderInfo.tsx +36 -3
- package/src/components/DebitCard/DebitCard.tsx +36 -3
- package/src/components/MediaCard/MediaCard.tsx +40 -9
- package/src/components/RechargeCard/RechargeCard.tsx +48 -13
- package/src/components/TestimonialsCard/TestimonialsCard.tsx +37 -6
- package/src/icons/registry.ts +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React, { createContext, useContext, isValidElement, cloneElement } from 'react';
|
|
4
|
-
import { View, Text } from 'react-native';
|
|
4
|
+
import { View, Text, Pressable } from 'react-native';
|
|
5
5
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
6
|
import { EMPTY_MODES } from '../../utils/react-utils';
|
|
7
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
/**
|
|
9
9
|
* Context to share 'modes' with child components like Card.Title and Card.SupportText.
|
|
10
10
|
* This ensures that nested components can resolve their tokens correctly without
|
|
@@ -32,7 +32,10 @@ export function Card({
|
|
|
32
32
|
children,
|
|
33
33
|
modes = EMPTY_MODES,
|
|
34
34
|
mediaAspectRatio = 154 / 116,
|
|
35
|
-
style
|
|
35
|
+
style,
|
|
36
|
+
onPress,
|
|
37
|
+
disabled,
|
|
38
|
+
accessibilityLabel
|
|
36
39
|
}) {
|
|
37
40
|
// Resolve Card Container Tokens
|
|
38
41
|
const backgroundColor = getVariableByName('card/background/color', modes);
|
|
@@ -96,22 +99,36 @@ export function Card({
|
|
|
96
99
|
paddingHorizontal: contentPaddingHorizontal,
|
|
97
100
|
paddingVertical: contentPaddingVertical
|
|
98
101
|
};
|
|
102
|
+
const content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
103
|
+
children: [header && /*#__PURE__*/_jsx(View, {
|
|
104
|
+
style: headerWrapperStyle,
|
|
105
|
+
children: headerWithModes
|
|
106
|
+
}), media && /*#__PURE__*/_jsx(View, {
|
|
107
|
+
style: mediaWrapperStyle,
|
|
108
|
+
children: mediaWithModes
|
|
109
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
110
|
+
style: contentWrapperStyle,
|
|
111
|
+
children: children
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
99
114
|
return /*#__PURE__*/_jsx(CardContext.Provider, {
|
|
100
115
|
value: {
|
|
101
116
|
modes
|
|
102
117
|
},
|
|
103
|
-
children: /*#__PURE__*/
|
|
118
|
+
children: onPress ? /*#__PURE__*/_jsx(Pressable, {
|
|
119
|
+
style: [containerStyle, style],
|
|
120
|
+
onPress: onPress,
|
|
121
|
+
disabled: disabled,
|
|
122
|
+
accessibilityRole: "button",
|
|
123
|
+
accessibilityLabel: accessibilityLabel,
|
|
124
|
+
accessibilityState: {
|
|
125
|
+
disabled: !!disabled
|
|
126
|
+
},
|
|
127
|
+
children: content
|
|
128
|
+
}) : /*#__PURE__*/_jsx(View, {
|
|
104
129
|
style: [containerStyle, style],
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
children: headerWithModes
|
|
108
|
-
}), media && /*#__PURE__*/_jsx(View, {
|
|
109
|
-
style: mediaWrapperStyle,
|
|
110
|
-
children: mediaWithModes
|
|
111
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
112
|
-
style: contentWrapperStyle,
|
|
113
|
-
children: children
|
|
114
|
-
})]
|
|
130
|
+
accessibilityLabel: accessibilityLabel,
|
|
131
|
+
children: content
|
|
115
132
|
})
|
|
116
133
|
});
|
|
117
134
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React, { createContext, useContext, isValidElement, cloneElement } from 'react';
|
|
4
|
-
import { View, Text } from 'react-native';
|
|
4
|
+
import { View, Text, Pressable } from 'react-native';
|
|
5
5
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
6
|
import IconComponent from '../../icons/Icon';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -17,7 +17,10 @@ const CardFeedbackContext = /*#__PURE__*/createContext({});
|
|
|
17
17
|
export function CardFeedback({
|
|
18
18
|
children,
|
|
19
19
|
modes: propModes,
|
|
20
|
-
style
|
|
20
|
+
style,
|
|
21
|
+
onPress,
|
|
22
|
+
disabled,
|
|
23
|
+
accessibilityLabel
|
|
21
24
|
}) {
|
|
22
25
|
const modes = {
|
|
23
26
|
'Appearance.System': 'positive',
|
|
@@ -46,8 +49,19 @@ export function CardFeedback({
|
|
|
46
49
|
value: {
|
|
47
50
|
modes
|
|
48
51
|
},
|
|
49
|
-
children: /*#__PURE__*/_jsx(
|
|
52
|
+
children: onPress ? /*#__PURE__*/_jsx(Pressable, {
|
|
53
|
+
style: [containerStyle, style],
|
|
54
|
+
onPress: onPress,
|
|
55
|
+
disabled: disabled,
|
|
56
|
+
accessibilityRole: "button",
|
|
57
|
+
accessibilityLabel: accessibilityLabel,
|
|
58
|
+
accessibilityState: {
|
|
59
|
+
disabled: !!disabled
|
|
60
|
+
},
|
|
61
|
+
children: children
|
|
62
|
+
}) : /*#__PURE__*/_jsx(View, {
|
|
50
63
|
style: [containerStyle, style],
|
|
64
|
+
accessibilityLabel: accessibilityLabel,
|
|
51
65
|
children: children
|
|
52
66
|
})
|
|
53
67
|
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { View, Text } from 'react-native';
|
|
4
|
+
import { View, Text, Pressable } from 'react-native';
|
|
5
5
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
6
|
import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils';
|
|
7
7
|
import Badge from '../Badge/Badge';
|
|
8
8
|
import Divider from '../Divider/Divider';
|
|
9
9
|
import Nudge from '../Nudge/Nudge';
|
|
10
10
|
import SavingsGoalSummary from '../SavingsGoalSummary/SavingsGoalSummary';
|
|
11
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
12
|
/**
|
|
13
13
|
* `CardInsight` renders a single insight card composed of:
|
|
14
14
|
*
|
|
@@ -28,7 +28,10 @@ function CardInsight({
|
|
|
28
28
|
footer,
|
|
29
29
|
divider,
|
|
30
30
|
modes = EMPTY_MODES,
|
|
31
|
-
style
|
|
31
|
+
style,
|
|
32
|
+
onPress,
|
|
33
|
+
disabled,
|
|
34
|
+
accessibilityLabel
|
|
32
35
|
}) {
|
|
33
36
|
const background = getVariableByName('cardInsight/background', modes) ?? '#ffffff';
|
|
34
37
|
const radius = getVariableByName('cardInsight/radius', modes) ?? 12;
|
|
@@ -101,18 +104,18 @@ function CardInsight({
|
|
|
101
104
|
};
|
|
102
105
|
const footerNode = renderFooter();
|
|
103
106
|
const showDivider = footerNode !== null && divider !== false && divider !== null;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
107
|
+
const containerStyle = {
|
|
108
|
+
backgroundColor: background,
|
|
109
|
+
borderRadius: radius,
|
|
110
|
+
borderWidth,
|
|
111
|
+
borderColor,
|
|
112
|
+
paddingHorizontal,
|
|
113
|
+
paddingVertical,
|
|
114
|
+
gap,
|
|
115
|
+
overflow: 'hidden',
|
|
116
|
+
alignItems: 'stretch'
|
|
117
|
+
};
|
|
118
|
+
const content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
116
119
|
children: [/*#__PURE__*/_jsxs(View, {
|
|
117
120
|
style: {
|
|
118
121
|
flexDirection: 'row',
|
|
@@ -160,5 +163,23 @@ function CardInsight({
|
|
|
160
163
|
children: renderSlot()
|
|
161
164
|
}), showDivider ? renderDivider() : null, footerNode]
|
|
162
165
|
});
|
|
166
|
+
if (onPress) {
|
|
167
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
168
|
+
style: [containerStyle, style],
|
|
169
|
+
onPress: onPress,
|
|
170
|
+
disabled: disabled,
|
|
171
|
+
accessibilityRole: "button",
|
|
172
|
+
accessibilityLabel: accessibilityLabel ?? title,
|
|
173
|
+
accessibilityState: {
|
|
174
|
+
disabled: !!disabled
|
|
175
|
+
},
|
|
176
|
+
children: content
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return /*#__PURE__*/_jsx(View, {
|
|
180
|
+
style: [containerStyle, style],
|
|
181
|
+
accessibilityLabel: accessibilityLabel,
|
|
182
|
+
children: content
|
|
183
|
+
});
|
|
163
184
|
}
|
|
164
185
|
export default CardInsight;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { View } from 'react-native';
|
|
4
|
+
import { View, Pressable } from 'react-native';
|
|
5
5
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
6
|
import ProductLabel from '../ProductLabel/ProductLabel';
|
|
7
7
|
import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils';
|
|
8
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
9
|
/**
|
|
10
10
|
* CardProviderInfo displays a product header (ProductLabel) followed by a
|
|
11
11
|
* 2-column grid of children (typically StatItem instances).
|
|
@@ -18,7 +18,10 @@ function CardProviderInfo({
|
|
|
18
18
|
imageSource,
|
|
19
19
|
children,
|
|
20
20
|
modes = EMPTY_MODES,
|
|
21
|
-
style
|
|
21
|
+
style,
|
|
22
|
+
onPress,
|
|
23
|
+
disabled,
|
|
24
|
+
accessibilityLabel
|
|
22
25
|
}) {
|
|
23
26
|
const background = getVariableByName('card/providerInfo/background', modes) ?? '#fef4e5';
|
|
24
27
|
const border = getVariableByName('card/providerInfo/border', modes) ?? '#fef4e5';
|
|
@@ -43,8 +46,7 @@ function CardProviderInfo({
|
|
|
43
46
|
for (let i = 0; i < childArray.length; i += 2) {
|
|
44
47
|
rows.push(childArray.slice(i, i + 2));
|
|
45
48
|
}
|
|
46
|
-
|
|
47
|
-
style: [containerStyle, style],
|
|
49
|
+
const content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
48
50
|
children: [/*#__PURE__*/_jsx(ProductLabel, {
|
|
49
51
|
label: label,
|
|
50
52
|
imageSource: imageSource,
|
|
@@ -67,5 +69,23 @@ function CardProviderInfo({
|
|
|
67
69
|
}, i))
|
|
68
70
|
})]
|
|
69
71
|
});
|
|
72
|
+
if (onPress) {
|
|
73
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
74
|
+
style: [containerStyle, style],
|
|
75
|
+
onPress: onPress,
|
|
76
|
+
disabled: disabled,
|
|
77
|
+
accessibilityRole: "button",
|
|
78
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
79
|
+
accessibilityState: {
|
|
80
|
+
disabled: !!disabled
|
|
81
|
+
},
|
|
82
|
+
children: content
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return /*#__PURE__*/_jsx(View, {
|
|
86
|
+
style: [containerStyle, style],
|
|
87
|
+
accessibilityLabel: accessibilityLabel,
|
|
88
|
+
children: content
|
|
89
|
+
});
|
|
70
90
|
}
|
|
71
91
|
export default CardProviderInfo;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { View, Text, Image } from 'react-native';
|
|
4
|
+
import { View, Text, Image, Pressable } from 'react-native';
|
|
5
5
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
6
|
import { useTokens } from '../../design-tokens/JFSThemeProvider';
|
|
7
7
|
import { cloneChildrenWithModes, EMPTY_MODES } from '../../utils/react-utils';
|
|
8
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
9
|
const defaultCardArt = require('./cf64a67d5075caa8924d20b4e4e650d47b3ee08b.png');
|
|
10
10
|
function DebitCard({
|
|
11
11
|
cardholderName = 'Shruti Shukla',
|
|
@@ -17,7 +17,10 @@ function DebitCard({
|
|
|
17
17
|
bankLogoSlot,
|
|
18
18
|
providerLogoSlot,
|
|
19
19
|
modes: propModes = EMPTY_MODES,
|
|
20
|
-
style
|
|
20
|
+
style,
|
|
21
|
+
onPress,
|
|
22
|
+
disabled,
|
|
23
|
+
accessibilityLabel
|
|
21
24
|
}) {
|
|
22
25
|
const {
|
|
23
26
|
modes: globalModes
|
|
@@ -116,8 +119,7 @@ function DebitCard({
|
|
|
116
119
|
};
|
|
117
120
|
return cardArtSource;
|
|
118
121
|
}, [cardArtSource]);
|
|
119
|
-
|
|
120
|
-
style: [containerStyle, style],
|
|
122
|
+
const content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
121
123
|
children: [/*#__PURE__*/_jsxs(View, {
|
|
122
124
|
style: headerStyle,
|
|
123
125
|
children: [/*#__PURE__*/_jsxs(View, {
|
|
@@ -157,5 +159,23 @@ function DebitCard({
|
|
|
157
159
|
})]
|
|
158
160
|
})]
|
|
159
161
|
});
|
|
162
|
+
if (onPress) {
|
|
163
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
164
|
+
style: [containerStyle, style],
|
|
165
|
+
onPress: onPress,
|
|
166
|
+
disabled: disabled,
|
|
167
|
+
accessibilityRole: "button",
|
|
168
|
+
accessibilityLabel: accessibilityLabel ?? `${bankName} ${cardType} ${cardNumber}`,
|
|
169
|
+
accessibilityState: {
|
|
170
|
+
disabled: !!disabled
|
|
171
|
+
},
|
|
172
|
+
children: content
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return /*#__PURE__*/_jsx(View, {
|
|
176
|
+
style: [containerStyle, style],
|
|
177
|
+
accessibilityLabel: accessibilityLabel,
|
|
178
|
+
children: content
|
|
179
|
+
});
|
|
160
180
|
}
|
|
161
181
|
export default DebitCard;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React, { createContext, useContext } from 'react';
|
|
4
|
-
import { View, Text, StyleSheet } from 'react-native';
|
|
4
|
+
import { View, Text, Pressable, StyleSheet } from 'react-native';
|
|
5
5
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
6
|
import Image from '../Image/Image';
|
|
7
7
|
import GlassFill from '../../utils/GlassFill/GlassFill';
|
|
8
8
|
import { EMPTY_MODES } from '../../utils/react-utils';
|
|
9
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
const MediaCardContext = /*#__PURE__*/createContext({});
|
|
11
11
|
/**
|
|
12
12
|
* MediaCard component implementation from Figma node 1241:4140.
|
|
@@ -32,7 +32,10 @@ export function MediaCard({
|
|
|
32
32
|
media,
|
|
33
33
|
children,
|
|
34
34
|
modes = EMPTY_MODES,
|
|
35
|
-
style
|
|
35
|
+
style,
|
|
36
|
+
onPress,
|
|
37
|
+
disabled,
|
|
38
|
+
accessibilityLabel
|
|
36
39
|
}) {
|
|
37
40
|
const radius = parseFloat(getVariableByName('cardMedia/radius', modes));
|
|
38
41
|
const containerStyle = {
|
|
@@ -47,17 +50,31 @@ export function MediaCard({
|
|
|
47
50
|
accessibilityElementsHidden: true,
|
|
48
51
|
importantForAccessibility: "no"
|
|
49
52
|
}) : null);
|
|
53
|
+
const content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
54
|
+
children: [background, children != null ? /*#__PURE__*/_jsx(View, {
|
|
55
|
+
style: StyleSheet.absoluteFill,
|
|
56
|
+
pointerEvents: "box-none",
|
|
57
|
+
children: children
|
|
58
|
+
}) : null]
|
|
59
|
+
});
|
|
50
60
|
return /*#__PURE__*/_jsx(MediaCardContext.Provider, {
|
|
51
61
|
value: {
|
|
52
62
|
modes
|
|
53
63
|
},
|
|
54
|
-
children: /*#__PURE__*/
|
|
64
|
+
children: onPress ? /*#__PURE__*/_jsx(Pressable, {
|
|
65
|
+
style: [containerStyle, style],
|
|
66
|
+
onPress: onPress,
|
|
67
|
+
disabled: disabled,
|
|
68
|
+
accessibilityRole: "button",
|
|
69
|
+
accessibilityLabel: accessibilityLabel,
|
|
70
|
+
accessibilityState: {
|
|
71
|
+
disabled: !!disabled
|
|
72
|
+
},
|
|
73
|
+
children: content
|
|
74
|
+
}) : /*#__PURE__*/_jsx(View, {
|
|
55
75
|
style: [containerStyle, style],
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
pointerEvents: "box-none",
|
|
59
|
-
children: children
|
|
60
|
-
}) : null]
|
|
76
|
+
accessibilityLabel: accessibilityLabel,
|
|
77
|
+
children: content
|
|
61
78
|
})
|
|
62
79
|
});
|
|
63
80
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { View, Text } from 'react-native';
|
|
4
|
+
import { View, Text, Pressable } from 'react-native';
|
|
5
5
|
import ButtonGroup from '../ButtonGroup/ButtonGroup';
|
|
6
6
|
import AvatarGroup from '../AvatarGroup/AvatarGroup';
|
|
7
7
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
8
8
|
import { EMPTY_MODES } from '../../utils/react-utils';
|
|
9
9
|
import MoneyValue from '../MoneyValue/MoneyValue';
|
|
10
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
11
|
// Defaults applied to the inner ButtonGroup so the card matches Figma out of
|
|
12
12
|
// the box. They are spread *before* the caller's `modes` so any consumer can
|
|
13
13
|
// override an individual key (e.g. swap the size to "M").
|
|
@@ -36,7 +36,10 @@ export default function RechargeCard({
|
|
|
36
36
|
subscriptionContent,
|
|
37
37
|
actions,
|
|
38
38
|
modes = EMPTY_MODES,
|
|
39
|
-
style
|
|
39
|
+
style,
|
|
40
|
+
onPress,
|
|
41
|
+
disabled,
|
|
42
|
+
accessibilityLabel
|
|
40
43
|
}) {
|
|
41
44
|
// Container Tokens (defaults mirror Figma node 2235:937).
|
|
42
45
|
const backgroundColor = getVariableByName('rechargeCard/background', modes);
|
|
@@ -85,18 +88,18 @@ export default function RechargeCard({
|
|
|
85
88
|
// Pass modes to subscription children (e.g. AvatarGroup)
|
|
86
89
|
// Now encapsulated, so we just pass children to AvatarGroup
|
|
87
90
|
const hasSubscriptions = React.Children.count(subscriptionContent) > 0;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
91
|
+
const containerStyle = {
|
|
92
|
+
backgroundColor,
|
|
93
|
+
paddingHorizontal,
|
|
94
|
+
paddingVertical,
|
|
95
|
+
gap,
|
|
96
|
+
borderRadius: radius,
|
|
97
|
+
borderWidth: strokeWidth,
|
|
98
|
+
borderColor: strokeColor,
|
|
99
|
+
minWidth,
|
|
100
|
+
alignItems: 'flex-start'
|
|
101
|
+
};
|
|
102
|
+
const content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
100
103
|
children: [/*#__PURE__*/_jsxs(View, {
|
|
101
104
|
style: {
|
|
102
105
|
gap: headerGap,
|
|
@@ -212,4 +215,22 @@ export default function RechargeCard({
|
|
|
212
215
|
children: actions
|
|
213
216
|
})]
|
|
214
217
|
});
|
|
218
|
+
if (onPress) {
|
|
219
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
220
|
+
style: [containerStyle, style],
|
|
221
|
+
onPress: onPress,
|
|
222
|
+
disabled: disabled,
|
|
223
|
+
accessibilityRole: "button",
|
|
224
|
+
accessibilityLabel: accessibilityLabel ?? title,
|
|
225
|
+
accessibilityState: {
|
|
226
|
+
disabled: !!disabled
|
|
227
|
+
},
|
|
228
|
+
children: content
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
return /*#__PURE__*/_jsx(View, {
|
|
232
|
+
style: [containerStyle, style],
|
|
233
|
+
accessibilityLabel: accessibilityLabel,
|
|
234
|
+
children: content
|
|
235
|
+
});
|
|
215
236
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { View, Text } from 'react-native';
|
|
4
|
+
import { View, Text, Pressable } from 'react-native';
|
|
5
5
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
6
|
import { EMPTY_MODES } from '../../utils/react-utils';
|
|
7
7
|
import Avatar from '../Avatar/Avatar';
|
|
8
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
9
9
|
/**
|
|
10
10
|
* TestimonialsCard renders a compact, fixed-width card with a circular avatar,
|
|
11
11
|
* a bold title, and a body paragraph. It is typically used inside a horizontal
|
|
@@ -28,7 +28,9 @@ function TestimonialsCard({
|
|
|
28
28
|
modes = EMPTY_MODES,
|
|
29
29
|
style,
|
|
30
30
|
avatarProps,
|
|
31
|
-
accessibilityLabel
|
|
31
|
+
accessibilityLabel,
|
|
32
|
+
onPress,
|
|
33
|
+
disabled
|
|
32
34
|
}) {
|
|
33
35
|
// Container tokens
|
|
34
36
|
const background = getVariableByName('testimonialsCard/background', modes) ?? '#ffffff';
|
|
@@ -84,10 +86,7 @@ function TestimonialsCard({
|
|
|
84
86
|
...(avatarProps?.modes || {})
|
|
85
87
|
};
|
|
86
88
|
const resolvedAccessibilityLabel = accessibilityLabel ?? `Testimonial${title ? ` from ${title}` : ''}${body ? `: ${body}` : ''}`;
|
|
87
|
-
|
|
88
|
-
style: [containerStyle, style],
|
|
89
|
-
accessibilityRole: "text",
|
|
90
|
-
accessibilityLabel: resolvedAccessibilityLabel,
|
|
89
|
+
const content = /*#__PURE__*/_jsxs(_Fragment, {
|
|
91
90
|
children: [/*#__PURE__*/_jsx(Avatar, {
|
|
92
91
|
style: "Image",
|
|
93
92
|
modes: avatarModes,
|
|
@@ -107,6 +106,25 @@ function TestimonialsCard({
|
|
|
107
106
|
})]
|
|
108
107
|
})]
|
|
109
108
|
});
|
|
109
|
+
if (onPress) {
|
|
110
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
111
|
+
style: [containerStyle, style],
|
|
112
|
+
onPress: onPress,
|
|
113
|
+
disabled: disabled,
|
|
114
|
+
accessibilityRole: "button",
|
|
115
|
+
accessibilityLabel: resolvedAccessibilityLabel,
|
|
116
|
+
accessibilityState: {
|
|
117
|
+
disabled: !!disabled
|
|
118
|
+
},
|
|
119
|
+
children: content
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return /*#__PURE__*/_jsx(View, {
|
|
123
|
+
style: [containerStyle, style],
|
|
124
|
+
accessibilityRole: "text",
|
|
125
|
+
accessibilityLabel: resolvedAccessibilityLabel,
|
|
126
|
+
children: content
|
|
127
|
+
});
|
|
110
128
|
}
|
|
111
129
|
const textContainerStyle = {
|
|
112
130
|
width: '100%',
|