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,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View, Text, type ViewStyle } from 'react-native';
|
|
2
|
+
import { View, Text, Pressable, type ViewStyle } from 'react-native';
|
|
3
3
|
import ButtonGroup from '../ButtonGroup/ButtonGroup';
|
|
4
4
|
import AvatarGroup from '../AvatarGroup/AvatarGroup';
|
|
5
5
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
@@ -65,6 +65,15 @@ export type RechargeCardProps = {
|
|
|
65
65
|
*/
|
|
66
66
|
modes?: Modes;
|
|
67
67
|
style?: ViewStyle;
|
|
68
|
+
/**
|
|
69
|
+
* Press handler for the whole card. When set, the card becomes pressable
|
|
70
|
+
* (rendered through a `Pressable` with `accessibilityRole="button"`).
|
|
71
|
+
*/
|
|
72
|
+
onPress?: () => void;
|
|
73
|
+
/** Disable interaction when `onPress` is set. */
|
|
74
|
+
disabled?: boolean;
|
|
75
|
+
/** Accessibility label forwarded to the pressable wrapper (defaults to `title`). */
|
|
76
|
+
accessibilityLabel?: string;
|
|
68
77
|
};
|
|
69
78
|
|
|
70
79
|
/**
|
|
@@ -81,6 +90,9 @@ export default function RechargeCard({
|
|
|
81
90
|
actions,
|
|
82
91
|
modes = EMPTY_MODES,
|
|
83
92
|
style,
|
|
93
|
+
onPress,
|
|
94
|
+
disabled,
|
|
95
|
+
accessibilityLabel,
|
|
84
96
|
}: RechargeCardProps) {
|
|
85
97
|
// Container Tokens (defaults mirror Figma node 2235:937).
|
|
86
98
|
const backgroundColor = getVariableByName('rechargeCard/background', modes);
|
|
@@ -132,18 +144,20 @@ export default function RechargeCard({
|
|
|
132
144
|
const hasSubscriptions = React.Children.count(subscriptionContent) > 0;
|
|
133
145
|
|
|
134
146
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
+
const containerStyle: ViewStyle = {
|
|
148
|
+
backgroundColor,
|
|
149
|
+
paddingHorizontal,
|
|
150
|
+
paddingVertical,
|
|
151
|
+
gap,
|
|
152
|
+
borderRadius: radius,
|
|
153
|
+
borderWidth: strokeWidth,
|
|
154
|
+
borderColor: strokeColor,
|
|
155
|
+
minWidth,
|
|
156
|
+
alignItems: 'flex-start',
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const content = (
|
|
160
|
+
<>
|
|
147
161
|
{/* Header */}
|
|
148
162
|
<View style={{ gap: headerGap, alignItems: 'flex-start' }}>
|
|
149
163
|
<Text style={{
|
|
@@ -244,6 +258,27 @@ export default function RechargeCard({
|
|
|
244
258
|
<ButtonGroup modes={{ ...DEFAULT_BUTTON_GROUP_MODES, ...modes }}>
|
|
245
259
|
{actions}
|
|
246
260
|
</ButtonGroup>
|
|
261
|
+
</>
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
if (onPress) {
|
|
265
|
+
return (
|
|
266
|
+
<Pressable
|
|
267
|
+
style={[containerStyle, style]}
|
|
268
|
+
onPress={onPress}
|
|
269
|
+
disabled={disabled}
|
|
270
|
+
accessibilityRole="button"
|
|
271
|
+
accessibilityLabel={accessibilityLabel ?? title}
|
|
272
|
+
accessibilityState={{ disabled: !!disabled }}
|
|
273
|
+
>
|
|
274
|
+
{content}
|
|
275
|
+
</Pressable>
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return (
|
|
280
|
+
<View style={[containerStyle, style]} accessibilityLabel={accessibilityLabel}>
|
|
281
|
+
{content}
|
|
247
282
|
</View>
|
|
248
283
|
);
|
|
249
284
|
}
|
|
@@ -2,6 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
Text,
|
|
5
|
+
Pressable,
|
|
5
6
|
type ViewStyle,
|
|
6
7
|
type TextStyle,
|
|
7
8
|
type StyleProp,
|
|
@@ -38,6 +39,13 @@ export type TestimonialsCardProps = {
|
|
|
38
39
|
* from the title and body.
|
|
39
40
|
*/
|
|
40
41
|
accessibilityLabel?: string
|
|
42
|
+
/**
|
|
43
|
+
* Press handler for the whole card. When set, the card becomes pressable
|
|
44
|
+
* (rendered through a `Pressable` with `accessibilityRole="button"`).
|
|
45
|
+
*/
|
|
46
|
+
onPress?: () => void
|
|
47
|
+
/** Disable interaction when `onPress` is set. */
|
|
48
|
+
disabled?: boolean
|
|
41
49
|
}
|
|
42
50
|
|
|
43
51
|
/**
|
|
@@ -63,6 +71,8 @@ function TestimonialsCard({
|
|
|
63
71
|
style,
|
|
64
72
|
avatarProps,
|
|
65
73
|
accessibilityLabel,
|
|
74
|
+
onPress,
|
|
75
|
+
disabled,
|
|
66
76
|
}: TestimonialsCardProps) {
|
|
67
77
|
// Container tokens
|
|
68
78
|
const background = getVariableByName('testimonialsCard/background', modes) ?? '#ffffff'
|
|
@@ -127,12 +137,8 @@ function TestimonialsCard({
|
|
|
127
137
|
const resolvedAccessibilityLabel =
|
|
128
138
|
accessibilityLabel ?? `Testimonial${title ? ` from ${title}` : ''}${body ? `: ${body}` : ''}`
|
|
129
139
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
style={[containerStyle, style]}
|
|
133
|
-
accessibilityRole="text"
|
|
134
|
-
accessibilityLabel={resolvedAccessibilityLabel}
|
|
135
|
-
>
|
|
140
|
+
const content = (
|
|
141
|
+
<>
|
|
136
142
|
<Avatar
|
|
137
143
|
style="Image"
|
|
138
144
|
modes={avatarModes}
|
|
@@ -150,6 +156,31 @@ function TestimonialsCard({
|
|
|
150
156
|
</Text>
|
|
151
157
|
)}
|
|
152
158
|
</View>
|
|
159
|
+
</>
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
if (onPress) {
|
|
163
|
+
return (
|
|
164
|
+
<Pressable
|
|
165
|
+
style={[containerStyle, style]}
|
|
166
|
+
onPress={onPress}
|
|
167
|
+
disabled={disabled}
|
|
168
|
+
accessibilityRole="button"
|
|
169
|
+
accessibilityLabel={resolvedAccessibilityLabel}
|
|
170
|
+
accessibilityState={{ disabled: !!disabled }}
|
|
171
|
+
>
|
|
172
|
+
{content}
|
|
173
|
+
</Pressable>
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<View
|
|
179
|
+
style={[containerStyle, style]}
|
|
180
|
+
accessibilityRole="text"
|
|
181
|
+
accessibilityLabel={resolvedAccessibilityLabel}
|
|
182
|
+
>
|
|
183
|
+
{content}
|
|
153
184
|
</View>
|
|
154
185
|
)
|
|
155
186
|
}
|
package/src/icons/registry.ts
CHANGED