jfs-components 0.0.45 → 0.0.48
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/ChipSelect/ChipSelect.js +1 -2
- package/lib/commonjs/components/Drawer/demo.xml +18 -0
- package/lib/commonjs/components/FormField/FormField.js +1 -0
- package/lib/commonjs/components/NoteInput/NoteInput.js +1 -2
- package/lib/commonjs/components/Nudge/Nudge.js +143 -0
- package/lib/commonjs/components/PaymentFeedback/PaymentFeedback.js +148 -0
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +131 -0
- package/lib/commonjs/components/SupportText/SupportTextIcon.js +2 -3
- package/lib/commonjs/components/Tabs/TabItem.js +9 -5
- package/lib/commonjs/components/Tabs/Tabs.js +3 -1
- package/lib/commonjs/components/Text/Text.js +7 -1
- package/lib/commonjs/components/Title/Title.js +99 -0
- package/lib/commonjs/components/UpiHandle/UpiHandle.js +5 -2
- package/lib/commonjs/components/index.js +52 -3
- package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/utils/index.js +18 -0
- package/lib/module/components/ChipSelect/ChipSelect.js +1 -2
- package/lib/module/components/Drawer/demo.xml +18 -0
- package/lib/module/components/FormField/FormField.js +1 -0
- package/lib/module/components/NoteInput/NoteInput.js +1 -2
- package/lib/module/components/Nudge/Nudge.js +138 -0
- package/lib/module/components/PaymentFeedback/PaymentFeedback.js +142 -0
- package/lib/module/components/SegmentedControl/SegmentedControl.js +126 -0
- package/lib/module/components/SupportText/SupportTextIcon.js +2 -3
- package/lib/module/components/Tabs/TabItem.js +9 -5
- package/lib/module/components/Tabs/Tabs.js +3 -1
- package/lib/module/components/Text/Text.js +7 -1
- package/lib/module/components/Title/Title.js +94 -0
- package/lib/module/components/UpiHandle/UpiHandle.js +5 -2
- package/lib/module/components/index.js +8 -1
- package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/module/icons/registry.js +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/utils/index.js +3 -0
- package/lib/typescript/src/components/ChipSelect/ChipSelect.d.ts +1 -6
- package/lib/typescript/src/components/LinearMeter/LinearMeter.d.ts +1 -1
- package/lib/typescript/src/components/Nudge/Nudge.d.ts +31 -0
- package/lib/typescript/src/components/PaymentFeedback/PaymentFeedback.d.ts +23 -0
- package/lib/typescript/src/components/RechargeCard/RechargeCard.d.ts +1 -2
- package/lib/typescript/src/components/SegmentedControl/SegmentedControl.d.ts +49 -0
- package/lib/typescript/src/components/SupportText/SupportText.d.ts +1 -1
- package/lib/typescript/src/components/SupportText/SupportTextIcon.d.ts +1 -1
- package/lib/typescript/src/components/Text/Text.d.ts +3 -1
- package/lib/typescript/src/components/Title/Title.d.ts +20 -0
- package/lib/typescript/src/components/UpiHandle/UpiHandle.d.ts +3 -1
- package/lib/typescript/src/components/index.d.ts +13 -5
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/utils/index.d.ts +2 -0
- package/package.json +2 -2
- package/src/components/ChipSelect/ChipSelect.tsx +1 -8
- package/src/components/Drawer/demo.xml +18 -0
- package/src/components/FormField/FormField.tsx +1 -0
- package/src/components/LinearMeter/LinearMeter.tsx +1 -1
- package/src/components/NoteInput/NoteInput.tsx +1 -1
- package/src/components/Nudge/Nudge.tsx +150 -0
- package/src/components/PaymentFeedback/PaymentFeedback.tsx +168 -0
- package/src/components/RechargeCard/RechargeCard.tsx +1 -1
- package/src/components/SegmentedControl/SegmentedControl.tsx +168 -0
- package/src/components/SupportText/SupportText.tsx +1 -1
- package/src/components/SupportText/SupportTextIcon.tsx +4 -3
- package/src/components/Tabs/TabItem.tsx +10 -5
- package/src/components/Tabs/Tabs.tsx +2 -0
- package/src/components/Text/Text.tsx +9 -0
- package/src/components/Title/Title.tsx +137 -0
- package/src/components/UpiHandle/UpiHandle.tsx +6 -2
- package/src/components/index.ts +13 -5
- package/src/design-tokens/Coin Variables-variables-full.json +1 -1
- package/src/icons/registry.ts +1 -1
- package/src/index.ts +1 -0
- package/src/utils/index.ts +1 -0
- package/lib/commonjs/components/PageTitle/PageTitle.js +0 -90
- package/lib/module/components/PageTitle/PageTitle.js +0 -85
- package/lib/typescript/src/components/PageTitle/PageTitle.d.ts +0 -29
- package/src/components/PageTitle/PageTitle.tsx +0 -106
package/lib/commonjs/index.js
CHANGED
|
@@ -45,4 +45,16 @@ Object.keys(_Containers).forEach(function (key) {
|
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
});
|
|
48
|
+
var _utils = require("./utils");
|
|
49
|
+
Object.keys(_utils).forEach(function (key) {
|
|
50
|
+
if (key === "default" || key === "__esModule") return;
|
|
51
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
52
|
+
if (key in exports && exports[key] === _utils[key]) return;
|
|
53
|
+
Object.defineProperty(exports, key, {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () {
|
|
56
|
+
return _utils[key];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
48
60
|
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); }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "cloneChildrenWithModes", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _reactUtils.cloneChildrenWithModes;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "flattenChildren", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _reactUtils.flattenChildren;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _reactUtils = require("./react-utils");
|
|
@@ -13,7 +13,6 @@ function ChipSelect({
|
|
|
13
13
|
label = 'Date',
|
|
14
14
|
active = false,
|
|
15
15
|
icon = 'ic_calendar_week',
|
|
16
|
-
close = true,
|
|
17
16
|
modes = {},
|
|
18
17
|
style,
|
|
19
18
|
labelSlot,
|
|
@@ -87,7 +86,7 @@ function ChipSelect({
|
|
|
87
86
|
name: icon,
|
|
88
87
|
size: iconSize,
|
|
89
88
|
color: textColor
|
|
90
|
-
}), renderLabel(), active &&
|
|
89
|
+
}), renderLabel(), active && /*#__PURE__*/_jsx(Icon, {
|
|
91
90
|
name: "ic_close",
|
|
92
91
|
size: iconSize,
|
|
93
92
|
color: textColor
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<design>
|
|
2
|
+
<ListItem layout="Horizontal" leadingType="Avatar" navArrow="false" showSupportText="true" start="true" supportText="Support Text" title="Aasa Singh" trailing="true">
|
|
3
|
+
<Avatar monogram="MS" style="Image"></Avatar>
|
|
4
|
+
<frame horizontalSizing="FILL" name="text wrap" verticalSizing="HUG">
|
|
5
|
+
<slot name="supportText">
|
|
6
|
+
<text name="support text">₹10,000</text>
|
|
7
|
+
</slot>
|
|
8
|
+
<text name="Title">Aasa Singh</text>
|
|
9
|
+
</frame>
|
|
10
|
+
<frame horizontalSizing="HUG" modes='{"Context":"ListItem"}' name="end wrap" verticalSizing="HUG">
|
|
11
|
+
<slot name="slot">
|
|
12
|
+
<Button label="Button">
|
|
13
|
+
<text name="Label">Button</text>
|
|
14
|
+
</Button>
|
|
15
|
+
</slot>
|
|
16
|
+
</frame>
|
|
17
|
+
</ListItem>
|
|
18
|
+
</design>
|
|
@@ -81,6 +81,7 @@ function useFormField(props) {
|
|
|
81
81
|
borderWidth: inputBorderSize,
|
|
82
82
|
borderRadius: inputRadius,
|
|
83
83
|
paddingHorizontal: inputPaddingH,
|
|
84
|
+
paddingVertical: 0,
|
|
84
85
|
gap: inputGap
|
|
85
86
|
}), [inputBackground, inputBorderColor, inputBorderSize, inputRadius, inputPaddingH, inputGap]);
|
|
86
87
|
const inputTextStyle = useMemo(() => ({
|
|
@@ -47,9 +47,8 @@ export default function NoteInput({
|
|
|
47
47
|
backgroundColor: background,
|
|
48
48
|
borderWidth: borderSize,
|
|
49
49
|
borderColor: borderColor,
|
|
50
|
-
gap: gap
|
|
50
|
+
gap: gap
|
|
51
51
|
// Add specific width when editing if requested by Figma design logic, though flex fits content generically
|
|
52
|
-
alignSelf: 'flex-start'
|
|
53
52
|
};
|
|
54
53
|
const baseTextStyle = {
|
|
55
54
|
color: foreground,
|
|
@@ -0,0 +1,138 @@
|
|
|
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 Button from '../Button/Button';
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
function Nudge({
|
|
11
|
+
variant = 'Default',
|
|
12
|
+
title = 'Split payment',
|
|
13
|
+
body = 'Split this transaction into installments',
|
|
14
|
+
buttonLabel = 'Button',
|
|
15
|
+
onPressButton,
|
|
16
|
+
buttonSlot,
|
|
17
|
+
startSlot,
|
|
18
|
+
children,
|
|
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('nudge/background', modes) || '#f5f5f5';
|
|
30
|
+
const radius = getVariableByName('nudge/radius', modes) || 12;
|
|
31
|
+
const paddingH = getVariableByName('nudge/padding/horizontal', modes) || 12;
|
|
32
|
+
const paddingV = getVariableByName('nudge/padding/vertical', modes) || 12;
|
|
33
|
+
const gap = getVariableByName('nudge/gap', modes) || 6;
|
|
34
|
+
const titleColor = getVariableByName('nudge/title/color', modes) || '#0d0d0f';
|
|
35
|
+
const titleFontSize = getVariableByName('nudge/title/fontSize', modes) || 14;
|
|
36
|
+
const titleFontFamily = getVariableByName('nudge/title/fontFamily', modes) || 'JioType Var';
|
|
37
|
+
const titleLineHeight = getVariableByName('nudge/title/lineHeight', modes) || 15;
|
|
38
|
+
const titleFontWeightRaw = getVariableByName('nudge/title/fontWeight', modes) || 700;
|
|
39
|
+
const titleFontWeight = typeof titleFontWeightRaw === 'number' ? titleFontWeightRaw.toString() : titleFontWeightRaw;
|
|
40
|
+
const bodyColor = getVariableByName('nudge/body/color', modes) || '#1a1c1f';
|
|
41
|
+
const bodyFontSize = getVariableByName('nudge/body/fontSize', modes) || 12;
|
|
42
|
+
const bodyFontFamily = getVariableByName('nudge/body/fontFamily', modes) || 'JioType Var';
|
|
43
|
+
const bodyLineHeight = getVariableByName('nudge/body/lineHeight', modes) || 16;
|
|
44
|
+
const bodyFontWeightRaw = getVariableByName('nudge/body/fontWeight', modes) || 500;
|
|
45
|
+
const bodyFontWeight = typeof bodyFontWeightRaw === 'number' ? bodyFontWeightRaw.toString() : bodyFontWeightRaw;
|
|
46
|
+
const textGap = getVariableByName('nudge/text/gap', modes) || 4;
|
|
47
|
+
const contentGap = getVariableByName('nudge/content/gap', modes) || 8;
|
|
48
|
+
const contentMinHeight = getVariableByName('nudge/content/minHeight', modes) || 20;
|
|
49
|
+
const containerStyle = {
|
|
50
|
+
backgroundColor: background,
|
|
51
|
+
borderRadius: radius,
|
|
52
|
+
paddingHorizontal: paddingH,
|
|
53
|
+
paddingVertical: paddingV,
|
|
54
|
+
gap,
|
|
55
|
+
overflow: 'hidden',
|
|
56
|
+
...(variant === 'Variant2' ? {
|
|
57
|
+
flexDirection: 'column',
|
|
58
|
+
alignItems: 'flex-start'
|
|
59
|
+
} : {
|
|
60
|
+
flexDirection: 'row',
|
|
61
|
+
alignItems: 'flex-start'
|
|
62
|
+
})
|
|
63
|
+
};
|
|
64
|
+
const titleStyle = {
|
|
65
|
+
color: titleColor,
|
|
66
|
+
fontSize: titleFontSize,
|
|
67
|
+
fontFamily: titleFontFamily,
|
|
68
|
+
lineHeight: titleLineHeight,
|
|
69
|
+
fontWeight: titleFontWeight
|
|
70
|
+
};
|
|
71
|
+
const bodyStyle = {
|
|
72
|
+
color: bodyColor,
|
|
73
|
+
fontSize: bodyFontSize,
|
|
74
|
+
fontFamily: bodyFontFamily,
|
|
75
|
+
lineHeight: bodyLineHeight,
|
|
76
|
+
fontWeight: bodyFontWeight
|
|
77
|
+
};
|
|
78
|
+
const processedStartSlot = startSlot ? cloneChildrenWithModes(React.Children.toArray(startSlot), modes) : null;
|
|
79
|
+
const startSlotElement = processedStartSlot && processedStartSlot.length > 0 ? processedStartSlot.length === 1 ? processedStartSlot[0] : processedStartSlot : null;
|
|
80
|
+
if (variant === 'Variant2') {
|
|
81
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
82
|
+
style: [containerStyle, style],
|
|
83
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
84
|
+
style: {
|
|
85
|
+
flexDirection: 'row',
|
|
86
|
+
alignItems: 'center',
|
|
87
|
+
gap: 6,
|
|
88
|
+
width: '100%'
|
|
89
|
+
},
|
|
90
|
+
children: [startSlotElement, /*#__PURE__*/_jsx(Text, {
|
|
91
|
+
style: [titleStyle, {
|
|
92
|
+
flex: 1
|
|
93
|
+
}],
|
|
94
|
+
children: title
|
|
95
|
+
})]
|
|
96
|
+
}), children ? cloneChildrenWithModes(React.Children.toArray(children), modes) : null]
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
const defaultContent = /*#__PURE__*/_jsxs(View, {
|
|
100
|
+
style: {
|
|
101
|
+
gap: contentGap,
|
|
102
|
+
alignItems: 'flex-start',
|
|
103
|
+
width: '100%'
|
|
104
|
+
},
|
|
105
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
106
|
+
style: {
|
|
107
|
+
gap: textGap,
|
|
108
|
+
alignItems: 'flex-start',
|
|
109
|
+
width: '100%'
|
|
110
|
+
},
|
|
111
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
112
|
+
style: titleStyle,
|
|
113
|
+
children: title
|
|
114
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
115
|
+
style: bodyStyle,
|
|
116
|
+
children: body
|
|
117
|
+
})]
|
|
118
|
+
}), buttonSlot ? cloneChildrenWithModes(React.Children.toArray(buttonSlot), modes) : /*#__PURE__*/_jsx(Button, {
|
|
119
|
+
label: buttonLabel,
|
|
120
|
+
onPress: onPressButton,
|
|
121
|
+
modes: modes
|
|
122
|
+
})]
|
|
123
|
+
});
|
|
124
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
125
|
+
style: [containerStyle, style],
|
|
126
|
+
children: [startSlotElement, /*#__PURE__*/_jsx(View, {
|
|
127
|
+
style: {
|
|
128
|
+
flex: 1,
|
|
129
|
+
minWidth: 1,
|
|
130
|
+
minHeight: contentMinHeight,
|
|
131
|
+
justifyContent: 'center',
|
|
132
|
+
overflow: 'hidden'
|
|
133
|
+
},
|
|
134
|
+
children: children ? cloneChildrenWithModes(React.Children.toArray(children), modes) : defaultContent
|
|
135
|
+
})]
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
export default Nudge;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { isValidElement, cloneElement } 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 IconCapsule from '../IconCapsule/IconCapsule';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
export default function PaymentFeedback({
|
|
10
|
+
title = '₹50,000',
|
|
11
|
+
subtitle = 'Payment successful',
|
|
12
|
+
body = 'Your payment has been\nsuccessfully processed.',
|
|
13
|
+
details = '18 March 2025, 4:15 pm\nTransaction ID: TXN121466784',
|
|
14
|
+
showDetails = true,
|
|
15
|
+
iconName = 'ic_confirm',
|
|
16
|
+
renderMedia,
|
|
17
|
+
modes: propModes = {},
|
|
18
|
+
style
|
|
19
|
+
}) {
|
|
20
|
+
const {
|
|
21
|
+
modes: globalModes
|
|
22
|
+
} = useTokens();
|
|
23
|
+
const modes = {
|
|
24
|
+
...globalModes,
|
|
25
|
+
...propModes
|
|
26
|
+
};
|
|
27
|
+
const containerGap = Number(getVariableByName('paymnetFeedback/container/gap', modes)) || 46;
|
|
28
|
+
const messageGap = Number(getVariableByName('paymnetFeedback/message/gap', modes)) || 12;
|
|
29
|
+
const titleColor = getVariableByName('paymnetFeedback/title/color', modes) || '#0d0d0f';
|
|
30
|
+
const titleFontSize = Number(getVariableByName('paymnetFeedback/title/fontSize', modes)) || 36;
|
|
31
|
+
const titleFontFamily = getVariableByName('paymnetFeedback/title/fontFamily', modes) || 'JioType Var';
|
|
32
|
+
const titleLineHeight = Number(getVariableByName('paymnetFeedback/title/lineHeight', modes)) || 36;
|
|
33
|
+
const titleFontWeight = getVariableByName('paymnetFeedback/title/fontWeight', modes) || '900';
|
|
34
|
+
const subtitleColor = getVariableByName('paymnetFeedback/subtitle/color', modes) || '#24262b';
|
|
35
|
+
const subtitleFontSize = Number(getVariableByName('paymnetFeedback/subtitle/fontSize', modes)) || 16;
|
|
36
|
+
const subtitleFontFamily = getVariableByName('paymnetFeedback/subtitle/fontFamily', modes) || 'JioType Var';
|
|
37
|
+
const subtitleLineHeight = Number(getVariableByName('paymnetFeedback/subtitle/lineHeight', modes)) || 19;
|
|
38
|
+
const subtitleFontWeight = getVariableByName('paymnetFeedback/subtitle/fontWeight', modes) || '500';
|
|
39
|
+
const bodyColor = getVariableByName('paymnetFeedback/body/color', modes) || '#24262b';
|
|
40
|
+
const bodyFontSize = Number(getVariableByName('paymnetFeedback/body/fontSize', modes)) || 14;
|
|
41
|
+
const bodyFontFamily = getVariableByName('paymnetFeedback/body/fontFamily', modes) || 'JioType Var';
|
|
42
|
+
const bodyLineHeight = Number(getVariableByName('paymnetFeedback/body/lineHeight', modes)) || 17;
|
|
43
|
+
const bodyFontWeight = getVariableByName('paymnetFeedback/body/fontWeight', modes) || '500';
|
|
44
|
+
const detailsColor = getVariableByName('paymnetFeedback/details/color', modes) || '#24262b';
|
|
45
|
+
const detailsFontSize = Number(getVariableByName('paymnetFeedback/details/fontSize', modes)) || 14;
|
|
46
|
+
const detailsFontFamily = getVariableByName('paymnetFeedback/details/fontFamily', modes) || 'JioType Var';
|
|
47
|
+
const detailsLineHeight = Number(getVariableByName('paymnetFeedback/details/lineHeight', modes)) || 17;
|
|
48
|
+
const detailsFontWeight = getVariableByName('paymnetFeedback/details/fontWeight', modes) || '500';
|
|
49
|
+
const detailsParagraphSpacing = Number(getVariableByName('paymnetFeedback/details/paragraphSpacing', modes)) || 4;
|
|
50
|
+
const containerStyle = {
|
|
51
|
+
flexDirection: 'column',
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
gap: containerGap
|
|
54
|
+
};
|
|
55
|
+
const messageContainerStyle = {
|
|
56
|
+
flexDirection: 'column',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
gap: messageGap,
|
|
59
|
+
width: '100%'
|
|
60
|
+
};
|
|
61
|
+
const subtextContainerStyle = {
|
|
62
|
+
flexDirection: 'column',
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
gap: 4,
|
|
65
|
+
width: '100%'
|
|
66
|
+
};
|
|
67
|
+
const titleStyle = {
|
|
68
|
+
color: titleColor,
|
|
69
|
+
fontSize: titleFontSize,
|
|
70
|
+
fontFamily: titleFontFamily,
|
|
71
|
+
lineHeight: titleLineHeight,
|
|
72
|
+
fontWeight: String(titleFontWeight),
|
|
73
|
+
textAlign: 'center'
|
|
74
|
+
};
|
|
75
|
+
const subtitleStyle = {
|
|
76
|
+
color: subtitleColor,
|
|
77
|
+
fontSize: subtitleFontSize,
|
|
78
|
+
fontFamily: subtitleFontFamily,
|
|
79
|
+
lineHeight: subtitleLineHeight,
|
|
80
|
+
fontWeight: String(subtitleFontWeight),
|
|
81
|
+
textAlign: 'center'
|
|
82
|
+
};
|
|
83
|
+
const bodyStyle = {
|
|
84
|
+
color: bodyColor,
|
|
85
|
+
fontSize: bodyFontSize,
|
|
86
|
+
fontFamily: bodyFontFamily,
|
|
87
|
+
lineHeight: bodyLineHeight,
|
|
88
|
+
fontWeight: String(bodyFontWeight),
|
|
89
|
+
textAlign: 'center'
|
|
90
|
+
};
|
|
91
|
+
const detailsStyle = {
|
|
92
|
+
color: detailsColor,
|
|
93
|
+
fontSize: detailsFontSize,
|
|
94
|
+
fontFamily: detailsFontFamily,
|
|
95
|
+
lineHeight: detailsLineHeight,
|
|
96
|
+
fontWeight: String(detailsFontWeight),
|
|
97
|
+
textAlign: 'center'
|
|
98
|
+
};
|
|
99
|
+
const mediaContent = /*#__PURE__*/isValidElement(renderMedia) ? /*#__PURE__*/cloneElement(renderMedia, {
|
|
100
|
+
modes
|
|
101
|
+
}) : renderMedia;
|
|
102
|
+
const defaultMedia = /*#__PURE__*/_jsx(IconCapsule, {
|
|
103
|
+
iconName: iconName,
|
|
104
|
+
modes: {
|
|
105
|
+
...modes,
|
|
106
|
+
'Icon Capsule Size': 'L',
|
|
107
|
+
Emphasis: 'High',
|
|
108
|
+
'Semantic Intent': 'System',
|
|
109
|
+
AppearanceSystem: 'positive'
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const detailLines = details?.split('\n') ?? [];
|
|
113
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
114
|
+
style: [containerStyle, style],
|
|
115
|
+
children: [mediaContent ?? defaultMedia, /*#__PURE__*/_jsxs(View, {
|
|
116
|
+
style: messageContainerStyle,
|
|
117
|
+
children: [title ? /*#__PURE__*/_jsx(Text, {
|
|
118
|
+
style: titleStyle,
|
|
119
|
+
children: title
|
|
120
|
+
}) : null, /*#__PURE__*/_jsxs(View, {
|
|
121
|
+
style: subtextContainerStyle,
|
|
122
|
+
children: [subtitle ? /*#__PURE__*/_jsx(Text, {
|
|
123
|
+
style: subtitleStyle,
|
|
124
|
+
children: subtitle
|
|
125
|
+
}) : null, body ? /*#__PURE__*/_jsx(Text, {
|
|
126
|
+
style: bodyStyle,
|
|
127
|
+
children: body
|
|
128
|
+
}) : null]
|
|
129
|
+
})]
|
|
130
|
+
}), showDetails && details ? /*#__PURE__*/_jsx(View, {
|
|
131
|
+
style: {
|
|
132
|
+
alignItems: 'center'
|
|
133
|
+
},
|
|
134
|
+
children: detailLines.map((line, i) => /*#__PURE__*/_jsx(Text, {
|
|
135
|
+
style: [detailsStyle, i < detailLines.length - 1 ? {
|
|
136
|
+
marginBottom: detailsParagraphSpacing
|
|
137
|
+
} : undefined],
|
|
138
|
+
children: line
|
|
139
|
+
}, i))
|
|
140
|
+
}) : null]
|
|
141
|
+
});
|
|
142
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useState, useCallback } from 'react';
|
|
4
|
+
import { View, Pressable, Text } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
function SegmentedControlSegment({
|
|
8
|
+
label,
|
|
9
|
+
active,
|
|
10
|
+
onPress,
|
|
11
|
+
modes = {}
|
|
12
|
+
}) {
|
|
13
|
+
const resolvedModes = {
|
|
14
|
+
...modes,
|
|
15
|
+
'SegmentedControl/Segment': active ? 'Active' : 'Idle'
|
|
16
|
+
};
|
|
17
|
+
const paddingHorizontal = getVariableByName('segment/padding/horizontal', resolvedModes) ?? 16;
|
|
18
|
+
const paddingVertical = getVariableByName('segment/padding/vertical', resolvedModes) ?? 12;
|
|
19
|
+
const radius = getVariableByName('segment/radius', resolvedModes) ?? 20;
|
|
20
|
+
const background = getVariableByName('segment/background', resolvedModes) ?? (active ? '#5d00b5' : 'transparent');
|
|
21
|
+
const foreground = getVariableByName('segment/foreground', resolvedModes) ?? (active ? '#ffffff' : '#0c0d10');
|
|
22
|
+
const fontSize = getVariableByName('segment/fontSize', resolvedModes) ?? 16;
|
|
23
|
+
const fontFamily = getVariableByName('segment/fontFamily', resolvedModes) ?? 'JioType Var';
|
|
24
|
+
const lineHeight = getVariableByName('segment/lineHeight', resolvedModes) ?? 19;
|
|
25
|
+
const fontWeight = getVariableByName('segment/fontWeight', resolvedModes) ?? '500';
|
|
26
|
+
const segmentStyle = {
|
|
27
|
+
flex: 1,
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
paddingHorizontal,
|
|
31
|
+
paddingVertical,
|
|
32
|
+
borderRadius: radius,
|
|
33
|
+
backgroundColor: background
|
|
34
|
+
};
|
|
35
|
+
const textStyle = {
|
|
36
|
+
color: foreground,
|
|
37
|
+
fontFamily,
|
|
38
|
+
fontSize,
|
|
39
|
+
lineHeight,
|
|
40
|
+
fontWeight: fontWeight
|
|
41
|
+
};
|
|
42
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
43
|
+
style: ({
|
|
44
|
+
pressed
|
|
45
|
+
}) => [segmentStyle, pressed && {
|
|
46
|
+
opacity: 0.8
|
|
47
|
+
}],
|
|
48
|
+
onPress: onPress,
|
|
49
|
+
accessibilityRole: "tab",
|
|
50
|
+
accessibilityState: {
|
|
51
|
+
selected: active
|
|
52
|
+
},
|
|
53
|
+
accessibilityLabel: label,
|
|
54
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
55
|
+
style: textStyle,
|
|
56
|
+
children: label
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* SegmentedControl component backed by Figma design tokens.
|
|
63
|
+
*
|
|
64
|
+
* Provides a horizontal row of mutually exclusive segments.
|
|
65
|
+
* Supports controlled (`selectedKey` + `onSelectionChange`) and
|
|
66
|
+
* uncontrolled (`defaultSelectedKey`) usage patterns.
|
|
67
|
+
*
|
|
68
|
+
* @component
|
|
69
|
+
* @param {SegmentedControlProps} props
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* const [selected, setSelected] = useState<React.Key>('daily');
|
|
74
|
+
*
|
|
75
|
+
* <SegmentedControl
|
|
76
|
+
* items={[
|
|
77
|
+
* { key: 'daily', label: 'Daily' },
|
|
78
|
+
* { key: 'weekly', label: 'Weekly' },
|
|
79
|
+
* { key: 'monthly', label: 'Monthly' },
|
|
80
|
+
* ]}
|
|
81
|
+
* selectedKey={selected}
|
|
82
|
+
* onSelectionChange={setSelected}
|
|
83
|
+
* modes={{ 'Color Mode': 'Light' }}
|
|
84
|
+
* />
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
function SegmentedControl({
|
|
88
|
+
items,
|
|
89
|
+
selectedKey: controlledSelectedKey,
|
|
90
|
+
defaultSelectedKey,
|
|
91
|
+
onSelectionChange,
|
|
92
|
+
modes = {},
|
|
93
|
+
style
|
|
94
|
+
}) {
|
|
95
|
+
const isControlled = controlledSelectedKey !== undefined;
|
|
96
|
+
const [internalSelectedKey, setInternalSelectedKey] = useState(defaultSelectedKey ?? items[0]?.key);
|
|
97
|
+
const currentSelectedKey = isControlled ? controlledSelectedKey : internalSelectedKey;
|
|
98
|
+
const handlePress = useCallback(key => {
|
|
99
|
+
if (!isControlled) {
|
|
100
|
+
setInternalSelectedKey(key);
|
|
101
|
+
}
|
|
102
|
+
onSelectionChange?.(key);
|
|
103
|
+
}, [isControlled, onSelectionChange]);
|
|
104
|
+
const gap = getVariableByName('segmentedControl/gap', modes) ?? 8;
|
|
105
|
+
const background = getVariableByName('segmentedControl/background', modes) ?? '#f6f3ff';
|
|
106
|
+
const radius = getVariableByName('segmentedControl/radius', modes) ?? 24;
|
|
107
|
+
const containerStyle = {
|
|
108
|
+
flexDirection: 'row',
|
|
109
|
+
alignItems: 'center',
|
|
110
|
+
backgroundColor: background,
|
|
111
|
+
borderRadius: radius,
|
|
112
|
+
gap,
|
|
113
|
+
overflow: 'hidden'
|
|
114
|
+
};
|
|
115
|
+
return /*#__PURE__*/_jsx(View, {
|
|
116
|
+
style: [containerStyle, style],
|
|
117
|
+
accessibilityRole: "tablist",
|
|
118
|
+
children: items.map(item => /*#__PURE__*/_jsx(SegmentedControlSegment, {
|
|
119
|
+
label: item.label,
|
|
120
|
+
active: item.key === currentSelectedKey,
|
|
121
|
+
onPress: () => handlePress(item.key),
|
|
122
|
+
modes: modes
|
|
123
|
+
}, String(item.key)))
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
export default SegmentedControl;
|
|
@@ -8,10 +8,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
8
8
|
const STATUS_ICON_MAP = {
|
|
9
9
|
Neutral: 'ic_info',
|
|
10
10
|
Warning: 'ic_warning',
|
|
11
|
-
// Using ic_warning for Warning
|
|
12
11
|
Error: 'ic_warning',
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
Success: 'ic_status_successful',
|
|
13
|
+
Loading: 'ic_time'
|
|
15
14
|
};
|
|
16
15
|
function SupportTextIcon({
|
|
17
16
|
status = 'Neutral',
|
|
@@ -26,8 +26,12 @@ function TabItem({
|
|
|
26
26
|
const fontFamily = getVariableByName('tabItem/label/fontFamily', modes) ?? 'JioType Var';
|
|
27
27
|
const fontSize = getVariableByName('tabItem/label/size', modes) ?? 14;
|
|
28
28
|
const lineHeight = getVariableByName('tabItem/label/lineHeight', modes) ?? 17;
|
|
29
|
+
const fontWeight = String(getVariableByName('tabItem/label/fontWeight', modes) ?? 500);
|
|
29
30
|
const idleLabelColor = getVariableByName('tabItem/idle/label/color', modes) ?? '#303338';
|
|
30
|
-
const activeLabelColor = getVariableByName('tabItem/active/label/color', modes) ?? '#
|
|
31
|
+
const activeLabelColor = getVariableByName('tabItem/active/label/color', modes) ?? '#000000';
|
|
32
|
+
const indicatorBackground = getVariableByName('tabItem/indicator/background', modes) ?? '#CEA15A';
|
|
33
|
+
const indicatorHeight = getVariableByName('tabItem/indicator/height', modes) ?? 2;
|
|
34
|
+
const indicatorRadius = getVariableByName('tabItem/indicator/radius', modes) ?? 99;
|
|
31
35
|
const labelColor = active ? activeLabelColor : idleLabelColor;
|
|
32
36
|
const containerStyle = {
|
|
33
37
|
flexDirection: 'column',
|
|
@@ -40,16 +44,16 @@ function TabItem({
|
|
|
40
44
|
fontFamily,
|
|
41
45
|
fontSize,
|
|
42
46
|
lineHeight,
|
|
43
|
-
fontWeight
|
|
47
|
+
fontWeight
|
|
44
48
|
};
|
|
45
49
|
const indicatorStyle = {
|
|
46
50
|
position: 'absolute',
|
|
47
51
|
bottom: 0,
|
|
48
52
|
left: 0,
|
|
49
53
|
right: 0,
|
|
50
|
-
height:
|
|
51
|
-
backgroundColor:
|
|
52
|
-
borderRadius:
|
|
54
|
+
height: indicatorHeight,
|
|
55
|
+
backgroundColor: indicatorBackground,
|
|
56
|
+
borderRadius: indicatorRadius
|
|
53
57
|
};
|
|
54
58
|
return /*#__PURE__*/_jsxs(Pressable, {
|
|
55
59
|
style: ({
|
|
@@ -53,11 +53,13 @@ function Tabs({
|
|
|
53
53
|
});
|
|
54
54
|
const containerStyle = {
|
|
55
55
|
flexDirection: 'row',
|
|
56
|
+
alignItems: 'flex-start',
|
|
56
57
|
gap,
|
|
57
58
|
paddingTop,
|
|
58
59
|
paddingBottom,
|
|
59
60
|
paddingLeft,
|
|
60
|
-
paddingRight
|
|
61
|
+
paddingRight,
|
|
62
|
+
overflow: 'hidden'
|
|
61
63
|
};
|
|
62
64
|
if (scrollable) {
|
|
63
65
|
return /*#__PURE__*/_jsx(ScrollView, {
|
|
@@ -4,8 +4,13 @@ import React from 'react';
|
|
|
4
4
|
import { Text as RNText } from 'react-native';
|
|
5
5
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const TEXT_ALIGN_MAP = {
|
|
8
|
+
Left: 'left',
|
|
9
|
+
Center: 'center'
|
|
10
|
+
};
|
|
7
11
|
function Text({
|
|
8
12
|
text = 'Korem ipsum ',
|
|
13
|
+
textAlign = 'Left',
|
|
9
14
|
modes = {},
|
|
10
15
|
style,
|
|
11
16
|
numberOfLines
|
|
@@ -22,7 +27,8 @@ function Text({
|
|
|
22
27
|
fontSize: fontSize,
|
|
23
28
|
fontWeight: String(fontWeight),
|
|
24
29
|
lineHeight: lineHeight,
|
|
25
|
-
letterSpacing: letterSpacing
|
|
30
|
+
letterSpacing: letterSpacing,
|
|
31
|
+
textAlign: TEXT_ALIGN_MAP[textAlign]
|
|
26
32
|
};
|
|
27
33
|
return /*#__PURE__*/_jsx(RNText, {
|
|
28
34
|
style: [textStyle, style],
|