jfs-components 0.1.17 → 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 +15 -0
- package/lib/commonjs/components/AvatarGroup/AvatarGroup.js +41 -20
- 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/ProductMerchandisingCard/ProductMerchandisingCard.js +64 -60
- 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/commonjs/utils/GlassFill/GlassFill.js +69 -73
- package/lib/module/components/AvatarGroup/AvatarGroup.js +43 -21
- 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/ProductMerchandisingCard/ProductMerchandisingCard.js +66 -62
- 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/module/utils/GlassFill/GlassFill.js +69 -72
- 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/lib/typescript/src/utils/GlassFill/GlassFill.d.ts +11 -4
- package/package.json +1 -2
- package/src/components/AvatarGroup/AvatarGroup.tsx +44 -18
- 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/ProductMerchandisingCard/ProductMerchandisingCard.tsx +76 -47
- package/src/components/RechargeCard/RechargeCard.tsx +48 -13
- package/src/components/TestimonialsCard/TestimonialsCard.tsx +37 -6
- package/src/icons/registry.ts +1 -1
- package/src/utils/GlassFill/GlassFill.tsx +59 -56
|
@@ -7,10 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _blur = require("@react-native-community/blur");
|
|
10
|
-
var _maskedView = _interopRequireDefault(require("@react-native-masked-view/masked-view"));
|
|
11
10
|
var _reactNativeSvg = _interopRequireWildcard(require("react-native-svg"));
|
|
12
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
12
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
13
|
const DEFAULT_FALLBACK_DARK = '#1414174a';
|
|
16
14
|
const DEFAULT_FALLBACK_LIGHT = '#ffffff66';
|
|
@@ -20,32 +18,30 @@ const DEFAULT_FALLBACK_LIGHT = '#ffffff66';
|
|
|
20
18
|
const NATIVE_BLUR_NAME = _reactNative.Platform.OS === 'android' ? 'AndroidBlurView' : 'BlurView';
|
|
21
19
|
|
|
22
20
|
/**
|
|
23
|
-
* Alpha stop on
|
|
24
|
-
* position (0 = top of the surface, 1 = bottom); `opacity` is the
|
|
25
|
-
* there (0 =
|
|
21
|
+
* Alpha stop on the no-native-blur fallback gradient. `offset` is the vertical
|
|
22
|
+
* position (0 = top of the surface, 1 = bottom); `opacity` is the tint alpha
|
|
23
|
+
* there (0 = fully clear, 1 = full fallback color).
|
|
26
24
|
*
|
|
27
|
-
* Using several stops (rather than a single linear 0 → 1 ramp)
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* "glass" feel rather than a flat translucent panel.
|
|
25
|
+
* Using several stops (rather than a single linear 0 → 1 ramp) eases the tint
|
|
26
|
+
* in, so it swells smoothly toward the bottom instead of along a hard seam —
|
|
27
|
+
* the soft S-curve that gives the surface its "glass" feel.
|
|
31
28
|
*/
|
|
32
29
|
|
|
33
30
|
/**
|
|
34
|
-
* A single
|
|
35
|
-
* - `
|
|
36
|
-
*
|
|
31
|
+
* A single bottom-anchored band of the progressive blur stack.
|
|
32
|
+
* - `start` is where the band begins, as a fraction from the top (0 = covers
|
|
33
|
+
* the whole surface, 0.8 = only the bottom 20%). Each band runs from `start`
|
|
34
|
+
* to the bottom.
|
|
35
|
+
* - `amount` is the band's own blur strength as a share (0–1) of the peak.
|
|
37
36
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* heavy block), while still giving a genuine variable-radius result — the blur
|
|
43
|
-
* radius grows toward the bottom where the two layers overlap.
|
|
37
|
+
* Because each `BlurView` re-blurs everything rendered behind it, the bands
|
|
38
|
+
* COMPOUND where they overlap (toward the bottom), so the effective radius grows
|
|
39
|
+
* downward without any masking. The top region is covered only by the first,
|
|
40
|
+
* faint band; the bottom is covered by all of them.
|
|
44
41
|
*/
|
|
45
42
|
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
// snapping clear. Also reused for the no-native-blur fallback scrim.
|
|
43
|
+
// Eased tint ramp for the no-native-blur fallback scrim. A faint trace begins
|
|
44
|
+
// near the very top and grows steadily downward.
|
|
49
45
|
const BASE_MASK_STOPS = [{
|
|
50
46
|
offset: 0.0,
|
|
51
47
|
opacity: 0
|
|
@@ -62,26 +58,26 @@ const BASE_MASK_STOPS = [{
|
|
|
62
58
|
offset: 1.0,
|
|
63
59
|
opacity: 1
|
|
64
60
|
}];
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
//
|
|
70
|
-
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
61
|
+
|
|
62
|
+
// Bottom-anchored blur bands (top → bottom). The first band is faint and covers
|
|
63
|
+
// the whole surface so the top reads as barely-there glass; each subsequent band
|
|
64
|
+
// starts lower and adds strength, compounding toward the bottom for a smooth
|
|
65
|
+
// variable-radius result. Quadrature of these shares lands the bottom at ~peak.
|
|
66
|
+
const PROGRESSIVE_BANDS = [{
|
|
67
|
+
start: 0.0,
|
|
68
|
+
amount: 0.18
|
|
69
|
+
}, {
|
|
70
|
+
start: 0.3,
|
|
71
|
+
amount: 0.28
|
|
72
|
+
}, {
|
|
73
|
+
start: 0.52,
|
|
74
|
+
amount: 0.38
|
|
75
|
+
}, {
|
|
76
|
+
start: 0.7,
|
|
77
|
+
amount: 0.5
|
|
78
|
+
}, {
|
|
79
|
+
start: 0.84,
|
|
80
|
+
amount: 0.6
|
|
85
81
|
}];
|
|
86
82
|
|
|
87
83
|
/**
|
|
@@ -114,13 +110,14 @@ const NATIVE_BLUR_SUPPORTED = (() => {
|
|
|
114
110
|
})();
|
|
115
111
|
|
|
116
112
|
/**
|
|
117
|
-
* Vertical
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
113
|
+
* Vertical color-gradient scrim drawn with `react-native-svg` — used as the
|
|
114
|
+
* no-native-blur fallback. Paints `color` at the eased per-stop alpha so the
|
|
115
|
+
* tint swells smoothly from clear (top) to full (bottom), exactly mirroring the
|
|
116
|
+
* old `MaskedView`-over-solid-color fallback but with no native-view masking.
|
|
121
117
|
*/
|
|
122
|
-
function
|
|
118
|
+
function GradientScrim({
|
|
123
119
|
id,
|
|
120
|
+
color,
|
|
124
121
|
stops
|
|
125
122
|
}) {
|
|
126
123
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeSvg.default, {
|
|
@@ -135,7 +132,7 @@ function GradientMask({
|
|
|
135
132
|
y2: "1",
|
|
136
133
|
children: stops.map((s, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Stop, {
|
|
137
134
|
offset: s.offset,
|
|
138
|
-
stopColor:
|
|
135
|
+
stopColor: color,
|
|
139
136
|
stopOpacity: s.opacity
|
|
140
137
|
}, i))
|
|
141
138
|
})
|
|
@@ -200,38 +197,37 @@ function GlassFill({
|
|
|
200
197
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
201
198
|
style: [_reactNative.StyleSheet.absoluteFill, style],
|
|
202
199
|
pointerEvents: "none",
|
|
203
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
stops: BASE_MASK_STOPS
|
|
208
|
-
}),
|
|
209
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
210
|
-
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
211
|
-
backgroundColor: fallbackColor
|
|
212
|
-
}]
|
|
213
|
-
})
|
|
200
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(GradientScrim, {
|
|
201
|
+
id: `${maskId}-fb`,
|
|
202
|
+
color: fallbackColor,
|
|
203
|
+
stops: BASE_MASK_STOPS
|
|
214
204
|
})
|
|
215
205
|
});
|
|
216
206
|
}
|
|
217
207
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
218
208
|
style: [_reactNative.StyleSheet.absoluteFill, style],
|
|
219
209
|
pointerEvents: "none",
|
|
220
|
-
children:
|
|
221
|
-
const amount = Math.max(1, Math.round(peakBlur *
|
|
222
|
-
return
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
210
|
+
children: PROGRESSIVE_BANDS.map((band, i) => {
|
|
211
|
+
const amount = Math.max(1, Math.round(peakBlur * band.amount));
|
|
212
|
+
return (
|
|
213
|
+
/*#__PURE__*/
|
|
214
|
+
// Each band is clipped to start at `band.start` and run to
|
|
215
|
+
// the bottom; its `BlurView` blurs the content (and any
|
|
216
|
+
// lower bands) behind it, so the radius compounds downward.
|
|
217
|
+
(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
218
|
+
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
219
|
+
top: `${band.start * 100}%`,
|
|
220
|
+
overflow: 'hidden'
|
|
221
|
+
}],
|
|
222
|
+
pointerEvents: "none",
|
|
223
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blur.BlurView, {
|
|
224
|
+
style: _reactNative.StyleSheet.absoluteFill,
|
|
225
|
+
blurType: blurType,
|
|
226
|
+
blurAmount: amount,
|
|
227
|
+
reducedTransparencyFallbackColor: fallbackColor
|
|
228
|
+
})
|
|
229
|
+
}, i)
|
|
230
|
+
);
|
|
235
231
|
})
|
|
236
232
|
});
|
|
237
233
|
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useId } from 'react';
|
|
4
4
|
import { View, Platform } from 'react-native';
|
|
5
|
-
import
|
|
6
|
-
import Svg, { Path } from 'react-native-svg';
|
|
5
|
+
import Svg, { Defs, Mask, Path, ForeignObject } from 'react-native-svg';
|
|
7
6
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
8
7
|
import { EMPTY_MODES, flattenChildren } from '../../utils/react-utils';
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
9
|
function AvatarGroup({
|
|
11
10
|
modes = EMPTY_MODES,
|
|
12
11
|
children,
|
|
13
12
|
style,
|
|
14
13
|
...rest
|
|
15
14
|
}) {
|
|
15
|
+
// Stable, collision-free base for the per-avatar SVG mask ids so multiple
|
|
16
|
+
// groups on one screen (and multiple avatars in a group) never clash.
|
|
17
|
+
const rawId = useId();
|
|
18
|
+
const maskBaseId = `avatargroup-mask-${rawId.replace(/[^a-zA-Z0-9_-]/g, '')}`;
|
|
16
19
|
const gap = getVariableByName('avatarGroup/gap', modes);
|
|
17
20
|
const avatarSize = getVariableByName('avatar/size', modes);
|
|
18
21
|
const avatarRadius = getVariableByName('avatar/radius', modes);
|
|
@@ -41,7 +44,11 @@ function AvatarGroup({
|
|
|
41
44
|
y: r
|
|
42
45
|
};
|
|
43
46
|
|
|
44
|
-
// Native
|
|
47
|
+
// Native mask path: the full avatar square MINUS a circular hole where the
|
|
48
|
+
// next (overlapping) avatar sits. Drawn as a single `evenodd` path so the
|
|
49
|
+
// hole is cut out of the square. Filled WHITE because react-native-svg's
|
|
50
|
+
// `<Mask>` is a *luminance* mask (white = visible, black/absent = hidden) —
|
|
51
|
+
// the inverse of the old `@react-native-masked-view` alpha convention.
|
|
45
52
|
const rectPath = `M 0 0 h ${avatarSizeInt} v ${avatarSizeInt} h -${avatarSizeInt} z`;
|
|
46
53
|
const circlePath = `M ${holeCenter.x},${holeCenter.y} m -${holeRadius},0 a ${holeRadius},${holeRadius} 0 1,0 ${holeRadius * 2},0 a ${holeRadius},${holeRadius} 0 1,0 -${holeRadius * 2},0`;
|
|
47
54
|
const maskPath = `${rectPath} ${circlePath}`;
|
|
@@ -99,25 +106,40 @@ function AvatarGroup({
|
|
|
99
106
|
}, index);
|
|
100
107
|
}
|
|
101
108
|
|
|
102
|
-
// Native
|
|
109
|
+
// Native: mask the avatar with react-native-svg instead of the
|
|
110
|
+
// unmaintained `@react-native-masked-view/masked-view`, whose
|
|
111
|
+
// legacy `requireNativeComponent('RNCMaskedView')` resolves to a
|
|
112
|
+
// plain object (crashing "Element type is invalid") under the New
|
|
113
|
+
// Architecture interop. react-native-svg ships a Fabric/codegen
|
|
114
|
+
// `<Mask>` + `<ForeignObject>` that resolves on both architectures;
|
|
115
|
+
// the avatar is hosted inside the `<ForeignObject>` and revealed
|
|
116
|
+
// through the luminance mask.
|
|
117
|
+
const maskId = `${maskBaseId}-${index}`;
|
|
103
118
|
return /*#__PURE__*/_jsx(View, {
|
|
104
119
|
style: wrapperStyle,
|
|
105
|
-
children: /*#__PURE__*/
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
children: /*#__PURE__*/_jsxs(Svg, {
|
|
121
|
+
height: "100%",
|
|
122
|
+
width: "100%",
|
|
123
|
+
viewBox: `0 0 ${avatarSizeInt} ${avatarSizeInt}`,
|
|
124
|
+
children: [/*#__PURE__*/_jsx(Defs, {
|
|
125
|
+
children: /*#__PURE__*/_jsx(Mask, {
|
|
126
|
+
id: maskId,
|
|
127
|
+
maskUnits: "userSpaceOnUse",
|
|
128
|
+
maskContentUnits: "userSpaceOnUse",
|
|
129
|
+
children: /*#__PURE__*/_jsx(Path, {
|
|
130
|
+
d: maskPath,
|
|
131
|
+
fill: "white",
|
|
132
|
+
fillRule: "evenodd"
|
|
133
|
+
})
|
|
118
134
|
})
|
|
119
|
-
}),
|
|
120
|
-
|
|
135
|
+
}), /*#__PURE__*/_jsx(ForeignObject, {
|
|
136
|
+
x: "0",
|
|
137
|
+
y: "0",
|
|
138
|
+
width: avatarSizeInt,
|
|
139
|
+
height: avatarSizeInt,
|
|
140
|
+
mask: `url(#${maskId})`,
|
|
141
|
+
children: clonedChild
|
|
142
|
+
})]
|
|
121
143
|
})
|
|
122
144
|
}, index);
|
|
123
145
|
})
|
|
@@ -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;
|