jfs-components 0.0.48 → 0.0.49
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/assets/cf64a67d5075caa8924d20b4e4e650d47b3ee08b.png +0 -0
- package/lib/commonjs/components/CardCTA/CardCTA.js +141 -0
- package/lib/commonjs/components/DebitCard/DebitCard.js +166 -0
- package/lib/commonjs/components/DebitCard/cf64a67d5075caa8924d20b4e4e650d47b3ee08b.png +0 -0
- package/lib/commonjs/components/Section/Section.js +5 -8
- package/lib/commonjs/components/index.js +10 -3
- package/lib/commonjs/icons/registry.js +2 -2
- package/lib/module/assets/cf64a67d5075caa8924d20b4e4e650d47b3ee08b.png +0 -0
- package/lib/module/components/CardCTA/CardCTA.js +136 -0
- package/lib/module/components/DebitCard/DebitCard.js +161 -0
- package/lib/module/components/DebitCard/cf64a67d5075caa8924d20b4e4e650d47b3ee08b.png +0 -0
- package/lib/module/components/Section/Section.js +5 -8
- package/lib/module/components/index.js +2 -1
- package/lib/module/icons/registry.js +2 -2
- package/lib/typescript/src/components/CardCTA/CardCTA.d.ts +25 -0
- package/lib/typescript/src/components/DebitCard/DebitCard.d.ts +27 -0
- package/lib/typescript/src/components/index.d.ts +2 -1
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/package.json +1 -1
- package/src/assets/cf64a67d5075caa8924d20b4e4e650d47b3ee08b.png +0 -0
- package/src/components/CardCTA/CardCTA.tsx +146 -0
- package/src/components/DebitCard/DebitCard.tsx +185 -0
- package/src/components/DebitCard/cf64a67d5075caa8924d20b4e4e650d47b3ee08b.png +0 -0
- package/src/components/Section/Section.tsx +3 -9
- package/src/components/index.ts +2 -1
- package/src/icons/registry.ts +2136 -29
- package/lib/commonjs/components/CtaCard/CtaCard.js +0 -116
- package/lib/commonjs/components/CtaCard/index.js +0 -13
- package/lib/module/components/CtaCard/CtaCard.js +0 -111
- package/lib/module/components/CtaCard/index.js +0 -3
- package/lib/typescript/src/components/CtaCard/CtaCard.d.ts +0 -61
- package/lib/typescript/src/components/CtaCard/index.d.ts +0 -2
- package/src/components/CtaCard/CtaCard.tsx +0 -180
- package/src/components/CtaCard/index.ts +0 -1
|
Binary file
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, Text } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
import { useTokens } from '../../design-tokens/JFSThemeProvider';
|
|
7
|
+
import { cloneChildrenWithModes } from '../../utils/react-utils';
|
|
8
|
+
import IconCapsule from '../IconCapsule/IconCapsule';
|
|
9
|
+
import Button from '../Button/Button';
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
function CardCTA({
|
|
12
|
+
title = 'If you have 1 line',
|
|
13
|
+
body = 'Then you can have up to 3 lines in the subtext as well. This is for demonstration.',
|
|
14
|
+
iconName = 'ic_upi_number',
|
|
15
|
+
buttonLabel = 'Button',
|
|
16
|
+
onPressButton,
|
|
17
|
+
modes: propModes = {},
|
|
18
|
+
iconSlot,
|
|
19
|
+
buttonSlot,
|
|
20
|
+
style
|
|
21
|
+
}) {
|
|
22
|
+
const {
|
|
23
|
+
modes: globalModes
|
|
24
|
+
} = useTokens();
|
|
25
|
+
const modes = {
|
|
26
|
+
...globalModes,
|
|
27
|
+
...propModes
|
|
28
|
+
};
|
|
29
|
+
const background = getVariableByName('cardCTA/background', modes) || '#ffffff';
|
|
30
|
+
const radius = getVariableByName('cardCTA/radius', modes) || 12;
|
|
31
|
+
const borderSize = getVariableByName('cardCTA/border/size', modes) || 1;
|
|
32
|
+
const borderColor = getVariableByName('cardCTA/border/color', modes) || '#e3e4e4';
|
|
33
|
+
const leftPaddingH = getVariableByName('cardCTA/left-wrap/padding/horizontal', modes) || 16;
|
|
34
|
+
const leftPaddingV = getVariableByName('cardCTA/left-wrap/padding/vertical', modes) || 22;
|
|
35
|
+
const leftGap = getVariableByName('cardCTA/left-wrap/gap', modes) || 16;
|
|
36
|
+
const rightPaddingH = getVariableByName('cardCTA/right-wrap/padding/horizontal', modes) || 16;
|
|
37
|
+
const rightPaddingV = getVariableByName('cardCTA/right-wrap/padding/vertical', modes) || 22;
|
|
38
|
+
const textGap = getVariableByName('cardCTA/text-wrap/gap', modes) || 6;
|
|
39
|
+
const titleColor = getVariableByName('cardCTA/title/color', modes) || '#0c0d10';
|
|
40
|
+
const titleFontFamily = getVariableByName('cardCTA/title/fontFamily', modes) || 'JioType Var';
|
|
41
|
+
const titleFontSize = getVariableByName('cardCTA/title/fontSize', modes) || 16;
|
|
42
|
+
const titleLineHeight = getVariableByName('cardCTA/title/lineHeight', modes) || 17.6;
|
|
43
|
+
const titleFontWeightRaw = getVariableByName('cardCTA/title/fontWeight', modes) || 700;
|
|
44
|
+
const titleFontWeight = typeof titleFontWeightRaw === 'number' ? titleFontWeightRaw.toString() : titleFontWeightRaw;
|
|
45
|
+
const bodyColor = getVariableByName('cardCTA/body/color', modes) || '#13002d';
|
|
46
|
+
const bodyFontFamily = getVariableByName('cardCTA/body/fontFamily', modes) || 'JioType Var';
|
|
47
|
+
const bodyFontSize = getVariableByName('cardCTA/body/fontSize', modes) || 10;
|
|
48
|
+
const bodyLineHeight = getVariableByName('cardCTA/body/lineHeight', modes) || 12;
|
|
49
|
+
const bodyFontWeightRaw = getVariableByName('cardCTA/body/fontWeight', modes) || 400;
|
|
50
|
+
const bodyFontWeight = typeof bodyFontWeightRaw === 'number' ? bodyFontWeightRaw.toString() : bodyFontWeightRaw;
|
|
51
|
+
const containerStyle = {
|
|
52
|
+
backgroundColor: background,
|
|
53
|
+
borderRadius: radius,
|
|
54
|
+
borderWidth: borderSize,
|
|
55
|
+
borderColor,
|
|
56
|
+
flexDirection: 'row',
|
|
57
|
+
overflow: 'hidden'
|
|
58
|
+
};
|
|
59
|
+
const leftWrapStyle = {
|
|
60
|
+
flex: 3,
|
|
61
|
+
paddingHorizontal: leftPaddingH,
|
|
62
|
+
paddingVertical: leftPaddingV,
|
|
63
|
+
gap: leftGap,
|
|
64
|
+
alignItems: 'flex-start',
|
|
65
|
+
justifyContent: 'center'
|
|
66
|
+
};
|
|
67
|
+
const rightWrapStyle = {
|
|
68
|
+
flex: 2,
|
|
69
|
+
paddingHorizontal: rightPaddingH,
|
|
70
|
+
paddingVertical: rightPaddingV,
|
|
71
|
+
alignItems: 'flex-end',
|
|
72
|
+
justifyContent: 'flex-start'
|
|
73
|
+
};
|
|
74
|
+
const textWrapStyle = {
|
|
75
|
+
gap: textGap
|
|
76
|
+
};
|
|
77
|
+
const titleStyle = {
|
|
78
|
+
color: titleColor,
|
|
79
|
+
fontFamily: titleFontFamily,
|
|
80
|
+
fontSize: titleFontSize,
|
|
81
|
+
lineHeight: titleLineHeight,
|
|
82
|
+
fontWeight: titleFontWeight
|
|
83
|
+
};
|
|
84
|
+
const bodyStyle = {
|
|
85
|
+
color: bodyColor,
|
|
86
|
+
fontFamily: bodyFontFamily,
|
|
87
|
+
fontSize: bodyFontSize,
|
|
88
|
+
lineHeight: bodyLineHeight,
|
|
89
|
+
fontWeight: bodyFontWeight
|
|
90
|
+
};
|
|
91
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
92
|
+
style: [containerStyle, style],
|
|
93
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
94
|
+
style: leftWrapStyle,
|
|
95
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
96
|
+
style: textWrapStyle,
|
|
97
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
98
|
+
style: titleStyle,
|
|
99
|
+
children: title
|
|
100
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
101
|
+
style: bodyStyle,
|
|
102
|
+
children: body
|
|
103
|
+
})]
|
|
104
|
+
}), buttonSlot ? cloneChildrenWithModes(buttonSlot, {
|
|
105
|
+
...modes,
|
|
106
|
+
AppearanceBrand: 'Secondary',
|
|
107
|
+
'Button / Size': 'S'
|
|
108
|
+
}) : /*#__PURE__*/_jsx(Button, {
|
|
109
|
+
label: buttonLabel,
|
|
110
|
+
onPress: onPressButton || (() => {}),
|
|
111
|
+
modes: {
|
|
112
|
+
...modes,
|
|
113
|
+
AppearanceBrand: 'Secondary',
|
|
114
|
+
'Button / Size': 'S'
|
|
115
|
+
}
|
|
116
|
+
})]
|
|
117
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
118
|
+
style: rightWrapStyle,
|
|
119
|
+
children: iconSlot ? cloneChildrenWithModes(iconSlot, {
|
|
120
|
+
...modes,
|
|
121
|
+
'IconCapsule / Size': 'M',
|
|
122
|
+
Emphasis: 'Medium',
|
|
123
|
+
AppearanceBrand: 'Secondary'
|
|
124
|
+
}) : /*#__PURE__*/_jsx(IconCapsule, {
|
|
125
|
+
iconName: iconName,
|
|
126
|
+
modes: {
|
|
127
|
+
...modes,
|
|
128
|
+
'IconCapsule / Size': 'M',
|
|
129
|
+
Emphasis: 'Medium',
|
|
130
|
+
AppearanceBrand: 'Secondary'
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
})]
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
export default CardCTA;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, Text, Image } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
import { useTokens } from '../../design-tokens/JFSThemeProvider';
|
|
7
|
+
import { cloneChildrenWithModes } from '../../utils/react-utils';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const defaultCardArt = require('./cf64a67d5075caa8924d20b4e4e650d47b3ee08b.png');
|
|
10
|
+
function DebitCard({
|
|
11
|
+
cardholderName = 'Shruti Shukla',
|
|
12
|
+
cardNumber = '•••• 1234',
|
|
13
|
+
expireDate = '02/28',
|
|
14
|
+
bankName = 'JioFinance',
|
|
15
|
+
cardType = 'Debit',
|
|
16
|
+
cardArtSource = defaultCardArt,
|
|
17
|
+
bankLogoSlot,
|
|
18
|
+
providerLogoSlot,
|
|
19
|
+
modes: propModes = {},
|
|
20
|
+
style
|
|
21
|
+
}) {
|
|
22
|
+
const {
|
|
23
|
+
modes: globalModes
|
|
24
|
+
} = useTokens();
|
|
25
|
+
const modes = {
|
|
26
|
+
...globalModes,
|
|
27
|
+
...propModes
|
|
28
|
+
};
|
|
29
|
+
const background = getVariableByName('debitCard/background', modes) || '#cea15a';
|
|
30
|
+
const radius = getVariableByName('debitCard/radius', modes) || 16;
|
|
31
|
+
const width = getVariableByName('debitCard/width', modes) || 328;
|
|
32
|
+
const height = getVariableByName('debitCard/height', modes) || 224;
|
|
33
|
+
const paddingBottom = getVariableByName('debitCard/padding/bottom', modes) || 24;
|
|
34
|
+
const headerPaddingH = getVariableByName('debitCard/header/padding/horizontal', modes) || 20;
|
|
35
|
+
const headerPaddingTop = getVariableByName('debitCard/header/padding/top', modes) || 16;
|
|
36
|
+
const headerPaddingBottom = getVariableByName('debitCard/header/padding/bottom', modes) || 28;
|
|
37
|
+
const cardArtHeight = getVariableByName('debitCard/cardArt/height', modes) || 50;
|
|
38
|
+
const cardArtRadius = getVariableByName('debitCard/cardArt/radius', modes) || 4;
|
|
39
|
+
const footerGap = getVariableByName('debitCard/footer/gap', modes) || 16;
|
|
40
|
+
const footerPaddingH = getVariableByName('debitCard/footer/padding/horizontal', modes) || 20;
|
|
41
|
+
const footerPaddingTop = getVariableByName('debitCard/footer/padding/top', modes) || 16;
|
|
42
|
+
const foreground = getVariableByName('debitCard/foreground', modes) || '#141414';
|
|
43
|
+
const fontSize = getVariableByName('debitCard/fontSize', modes) || 14;
|
|
44
|
+
const fontFamily = getVariableByName('debitCard/fontFamily', modes) || 'JioType Var';
|
|
45
|
+
const lineHeight = getVariableByName('debitCard/lineHeight', modes) || 17;
|
|
46
|
+
const fontWeightRaw = getVariableByName('debitCard/fontWeight', modes) || 500;
|
|
47
|
+
const fontWeight = typeof fontWeightRaw === 'number' ? fontWeightRaw.toString() : fontWeightRaw;
|
|
48
|
+
const containerStyle = {
|
|
49
|
+
backgroundColor: background,
|
|
50
|
+
borderRadius: radius,
|
|
51
|
+
width,
|
|
52
|
+
height,
|
|
53
|
+
paddingBottom,
|
|
54
|
+
overflow: 'hidden'
|
|
55
|
+
};
|
|
56
|
+
const headerStyle = {
|
|
57
|
+
flexDirection: 'row',
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
justifyContent: 'space-between',
|
|
60
|
+
paddingHorizontal: headerPaddingH,
|
|
61
|
+
paddingTop: headerPaddingTop,
|
|
62
|
+
paddingBottom: headerPaddingBottom,
|
|
63
|
+
overflow: 'hidden'
|
|
64
|
+
};
|
|
65
|
+
const headerLeftStyle = {
|
|
66
|
+
flexDirection: 'row',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
gap: 4
|
|
69
|
+
};
|
|
70
|
+
const headerRightStyle = {
|
|
71
|
+
flexDirection: 'row',
|
|
72
|
+
alignItems: 'center',
|
|
73
|
+
gap: 8
|
|
74
|
+
};
|
|
75
|
+
const headerTextStyle = {
|
|
76
|
+
color: foreground,
|
|
77
|
+
fontFamily,
|
|
78
|
+
fontSize,
|
|
79
|
+
fontWeight,
|
|
80
|
+
lineHeight: fontSize * 1.2
|
|
81
|
+
};
|
|
82
|
+
const cardArtContainerStyle = {
|
|
83
|
+
height: cardArtHeight,
|
|
84
|
+
width: '100%',
|
|
85
|
+
borderRadius: cardArtRadius,
|
|
86
|
+
overflow: 'hidden'
|
|
87
|
+
};
|
|
88
|
+
const cardArtImageStyle = {
|
|
89
|
+
width: '100%',
|
|
90
|
+
height: '100%',
|
|
91
|
+
borderRadius: cardArtRadius
|
|
92
|
+
};
|
|
93
|
+
const footerStyle = {
|
|
94
|
+
flex: 1,
|
|
95
|
+
gap: footerGap,
|
|
96
|
+
paddingHorizontal: footerPaddingH,
|
|
97
|
+
paddingTop: footerPaddingTop,
|
|
98
|
+
overflow: 'hidden'
|
|
99
|
+
};
|
|
100
|
+
const textStyle = {
|
|
101
|
+
color: foreground,
|
|
102
|
+
fontFamily,
|
|
103
|
+
fontSize,
|
|
104
|
+
lineHeight,
|
|
105
|
+
fontWeight
|
|
106
|
+
};
|
|
107
|
+
const stackStyle = {
|
|
108
|
+
flexDirection: 'row',
|
|
109
|
+
alignItems: 'center',
|
|
110
|
+
justifyContent: 'space-between'
|
|
111
|
+
};
|
|
112
|
+
const normalizedCardArt = React.useMemo(() => {
|
|
113
|
+
if (!cardArtSource) return null;
|
|
114
|
+
if (typeof cardArtSource === 'string') return {
|
|
115
|
+
uri: cardArtSource
|
|
116
|
+
};
|
|
117
|
+
return cardArtSource;
|
|
118
|
+
}, [cardArtSource]);
|
|
119
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
120
|
+
style: [containerStyle, style],
|
|
121
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
122
|
+
style: headerStyle,
|
|
123
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
124
|
+
style: headerLeftStyle,
|
|
125
|
+
children: [bankLogoSlot ? cloneChildrenWithModes(bankLogoSlot, modes) : null, /*#__PURE__*/_jsx(Text, {
|
|
126
|
+
style: headerTextStyle,
|
|
127
|
+
children: bankName
|
|
128
|
+
})]
|
|
129
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
130
|
+
style: headerRightStyle,
|
|
131
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
132
|
+
style: headerTextStyle,
|
|
133
|
+
children: cardType
|
|
134
|
+
}), providerLogoSlot ? cloneChildrenWithModes(providerLogoSlot, modes) : null]
|
|
135
|
+
})]
|
|
136
|
+
}), normalizedCardArt && /*#__PURE__*/_jsx(View, {
|
|
137
|
+
style: cardArtContainerStyle,
|
|
138
|
+
children: /*#__PURE__*/_jsx(Image, {
|
|
139
|
+
source: normalizedCardArt,
|
|
140
|
+
style: cardArtImageStyle,
|
|
141
|
+
resizeMode: "cover"
|
|
142
|
+
})
|
|
143
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
144
|
+
style: footerStyle,
|
|
145
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
146
|
+
style: textStyle,
|
|
147
|
+
children: cardNumber
|
|
148
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
149
|
+
style: stackStyle,
|
|
150
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
151
|
+
style: textStyle,
|
|
152
|
+
children: cardholderName
|
|
153
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
154
|
+
style: textStyle,
|
|
155
|
+
children: expireDate
|
|
156
|
+
})]
|
|
157
|
+
})]
|
|
158
|
+
})]
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
export default DebitCard;
|
|
Binary file
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
4
|
import { View, Text, Pressable } from 'react-native';
|
|
5
5
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
-
import
|
|
6
|
+
import NavArrow from '../NavArrow/NavArrow';
|
|
7
7
|
import { usePressableWebSupport } from '../../utils/web-platform-utils';
|
|
8
8
|
import { cloneChildrenWithModes } from '../../utils/react-utils';
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -138,12 +138,9 @@ function Section({
|
|
|
138
138
|
accessibilityElementsHidden: true,
|
|
139
139
|
importantForAccessibility: "no",
|
|
140
140
|
children: title
|
|
141
|
-
}), onPress && /*#__PURE__*/_jsx(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
color: titleColor,
|
|
145
|
-
accessibilityElementsHidden: true,
|
|
146
|
-
importantForAccessibility: "no"
|
|
141
|
+
}), onPress && /*#__PURE__*/_jsx(NavArrow, {
|
|
142
|
+
direction: "Forward",
|
|
143
|
+
modes: modes
|
|
147
144
|
})]
|
|
148
145
|
}), showSupportText && /*#__PURE__*/_jsx(Text, {
|
|
149
146
|
style: supportTextStyle,
|
|
@@ -201,7 +198,7 @@ function Section({
|
|
|
201
198
|
flexDirection: slotDirection,
|
|
202
199
|
gap
|
|
203
200
|
},
|
|
204
|
-
children: slot
|
|
201
|
+
children: cloneChildrenWithModes(React.Children.toArray(slot), modes)
|
|
205
202
|
})]
|
|
206
203
|
});
|
|
207
204
|
}
|
|
@@ -15,7 +15,8 @@ export { default as CardFeedback } from './CardFeedback/CardFeedback';
|
|
|
15
15
|
export { default as Disclaimer } from './Disclaimer/Disclaimer';
|
|
16
16
|
export { default as Divider } from './Divider/Divider';
|
|
17
17
|
export { default as Drawer } from './Drawer/Drawer';
|
|
18
|
-
export { default as
|
|
18
|
+
export { default as CardCTA } from './CardCTA/CardCTA';
|
|
19
|
+
export { default as DebitCard } from './DebitCard/DebitCard';
|
|
19
20
|
export { default as FilterBar } from './FilterBar/FilterBar';
|
|
20
21
|
export { default as Form } from './Form/Form';
|
|
21
22
|
export { useFormContext } from './Form/Form';
|