jfs-components 0.0.77 → 0.0.79
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 +28 -0
- package/lib/commonjs/components/Accordion/Accordion.js +55 -55
- package/lib/commonjs/components/ActionFooter/ActionFooter.js +48 -2
- package/lib/commonjs/components/Attached/Attached.js +144 -0
- package/lib/commonjs/components/Card/Card.js +25 -2
- package/lib/commonjs/components/Checkbox/Checkbox.js +21 -9
- package/lib/commonjs/components/DropdownInput/DropdownInput.js +30 -16
- package/lib/commonjs/components/ExpandableCheckbox/ExpandableCheckbox.js +167 -0
- package/lib/commonjs/components/FormField/FormField.js +14 -1
- package/lib/commonjs/components/FullscreenModal/FullscreenModal.js +353 -0
- package/lib/commonjs/components/ListItem/ListItem.js +46 -24
- package/lib/commonjs/components/MessageField/MessageField.js +318 -0
- package/lib/commonjs/components/NavArrow/NavArrow.js +58 -17
- package/lib/commonjs/components/PlanComparisonCard/PlanComparisonCard.js +328 -0
- package/lib/commonjs/components/Slot/Slot.js +73 -0
- package/lib/commonjs/components/Stepper/Step.js +47 -60
- package/lib/commonjs/components/Stepper/StepLabel.js +40 -10
- package/lib/commonjs/components/Stepper/Stepper.js +15 -17
- package/lib/commonjs/components/SuggestiveSearch/SuggestiveSearch.js +487 -0
- package/lib/commonjs/components/TextInput/TextInput.js +16 -1
- package/lib/commonjs/components/Title/Title.js +10 -2
- package/lib/commonjs/components/index.js +49 -0
- package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/module/components/Accordion/Accordion.js +56 -56
- package/lib/module/components/ActionFooter/ActionFooter.js +50 -4
- package/lib/module/components/Attached/Attached.js +139 -0
- package/lib/module/components/Card/Card.js +25 -2
- package/lib/module/components/Checkbox/Checkbox.js +22 -10
- package/lib/module/components/DropdownInput/DropdownInput.js +30 -16
- package/lib/module/components/ExpandableCheckbox/ExpandableCheckbox.js +161 -0
- package/lib/module/components/FormField/FormField.js +16 -3
- package/lib/module/components/FullscreenModal/FullscreenModal.js +348 -0
- package/lib/module/components/ListItem/ListItem.js +46 -24
- package/lib/module/components/MessageField/MessageField.js +313 -0
- package/lib/module/components/NavArrow/NavArrow.js +59 -18
- package/lib/module/components/PlanComparisonCard/PlanComparisonCard.js +322 -0
- package/lib/module/components/Slot/Slot.js +68 -0
- package/lib/module/components/Stepper/Step.js +48 -61
- package/lib/module/components/Stepper/StepLabel.js +40 -10
- package/lib/module/components/Stepper/Stepper.js +15 -17
- package/lib/module/components/SuggestiveSearch/SuggestiveSearch.js +481 -0
- package/lib/module/components/TextInput/TextInput.js +17 -2
- package/lib/module/components/Title/Title.js +10 -2
- package/lib/module/components/index.js +7 -0
- package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/module/icons/registry.js +1 -1
- package/lib/typescript/src/components/Accordion/Accordion.d.ts +14 -20
- package/lib/typescript/src/components/Attached/Attached.d.ts +61 -0
- package/lib/typescript/src/components/Card/Card.d.ts +9 -2
- package/lib/typescript/src/components/ExpandableCheckbox/ExpandableCheckbox.d.ts +63 -0
- package/lib/typescript/src/components/FullscreenModal/FullscreenModal.d.ts +99 -0
- package/lib/typescript/src/components/ListItem/ListItem.d.ts +15 -5
- package/lib/typescript/src/components/MessageField/MessageField.d.ts +81 -0
- package/lib/typescript/src/components/NavArrow/NavArrow.d.ts +10 -5
- package/lib/typescript/src/components/PlanComparisonCard/PlanComparisonCard.d.ts +64 -0
- package/lib/typescript/src/components/Slot/Slot.d.ts +52 -0
- package/lib/typescript/src/components/Stepper/Step.d.ts +4 -1
- package/lib/typescript/src/components/Stepper/StepLabel.d.ts +4 -1
- package/lib/typescript/src/components/Stepper/Stepper.d.ts +3 -1
- package/lib/typescript/src/components/SuggestiveSearch/SuggestiveSearch.d.ts +123 -0
- package/lib/typescript/src/components/index.d.ts +10 -3
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.tsx +113 -73
- package/src/components/ActionFooter/ActionFooter.tsx +56 -4
- package/src/components/Attached/Attached.tsx +181 -0
- package/src/components/Card/Card.tsx +28 -1
- package/src/components/Checkbox/Checkbox.tsx +22 -9
- package/src/components/DropdownInput/DropdownInput.tsx +67 -39
- package/src/components/ExpandableCheckbox/ExpandableCheckbox.tsx +237 -0
- package/src/components/FormField/FormField.tsx +19 -3
- package/src/components/FullscreenModal/FullscreenModal.tsx +414 -0
- package/src/components/ListItem/ListItem.tsx +55 -25
- package/src/components/MessageField/MessageField.tsx +543 -0
- package/src/components/NavArrow/NavArrow.tsx +81 -17
- package/src/components/PlanComparisonCard/PlanComparisonCard.tsx +426 -0
- package/src/components/Slot/Slot.tsx +91 -0
- package/src/components/Stepper/Step.tsx +52 -51
- package/src/components/Stepper/StepLabel.tsx +46 -9
- package/src/components/Stepper/Stepper.tsx +20 -15
- package/src/components/SuggestiveSearch/SuggestiveSearch.tsx +756 -0
- package/src/components/TextInput/TextInput.tsx +14 -1
- package/src/components/Title/Title.tsx +13 -2
- package/src/components/index.ts +10 -3
- package/src/design-tokens/Coin Variables-variables-full.json +1 -1
- package/src/icons/registry.ts +1 -1
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
10
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
11
|
+
var _Icon = _interopRequireDefault(require("../../icons/Icon"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
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
|
+
/**
|
|
16
|
+
* A single plan column header (the label column has no header of its own).
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Value rendered inside a plan cell.
|
|
21
|
+
* - `string` / `number` → rendered as value text.
|
|
22
|
+
* - `false` → renders the muted "not available" cross icon.
|
|
23
|
+
* - any React node → rendered as-is (e.g. a `Badge`, `MoneyValue`, icon…).
|
|
24
|
+
* - `null` / `undefined` / `true` → empty cell.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const DEFAULT_COLUMNS = [{
|
|
28
|
+
label: 'Your plan'
|
|
29
|
+
}, {
|
|
30
|
+
label: 'JioFinance+',
|
|
31
|
+
brand: true
|
|
32
|
+
}];
|
|
33
|
+
const DEFAULT_ROWS = [{
|
|
34
|
+
label: 'JioPoints multiplier',
|
|
35
|
+
values: ['1x', '1.25x']
|
|
36
|
+
}, {
|
|
37
|
+
label: 'Cashback',
|
|
38
|
+
showInfo: true,
|
|
39
|
+
values: [false, 'Upto ₹5000']
|
|
40
|
+
}, {
|
|
41
|
+
label: 'Bonus JioGold',
|
|
42
|
+
showInfo: true,
|
|
43
|
+
values: [false, '1%']
|
|
44
|
+
}];
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* PlanComparisonCard renders a compact comparison table that pits the user's
|
|
48
|
+
* current plan against one or more alternative plans across a set of feature
|
|
49
|
+
* rows. Implementation of Figma node `4498:2968` (`PlanComparisonCard`).
|
|
50
|
+
*
|
|
51
|
+
* The leading column holds feature labels (with an optional info icon); every
|
|
52
|
+
* other column maps to a plan in `columns`. Each cell value can be plain text,
|
|
53
|
+
* a "not available" cross (`false`), or any custom React node.
|
|
54
|
+
*
|
|
55
|
+
* @component
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* <PlanComparisonCard
|
|
59
|
+
* columns={[{ label: 'Your plan' }, { label: 'JioFinance+', brand: true }]}
|
|
60
|
+
* rows={[
|
|
61
|
+
* { label: 'JioPoints multiplier', values: ['1x', '1.25x'] },
|
|
62
|
+
* { label: 'Cashback', showInfo: true, values: [false, 'Upto ₹5000'] },
|
|
63
|
+
* ]}
|
|
64
|
+
* />
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
/** Keeps every text layer on a single line; columns grow to fit content. */
|
|
68
|
+
const NO_WRAP_TEXT = {
|
|
69
|
+
flexShrink: 0,
|
|
70
|
+
...(_reactNative.Platform.OS === 'web' ? {
|
|
71
|
+
whiteSpace: 'nowrap'
|
|
72
|
+
} : {})
|
|
73
|
+
};
|
|
74
|
+
function PlanComparisonCard({
|
|
75
|
+
columns = DEFAULT_COLUMNS,
|
|
76
|
+
rows = DEFAULT_ROWS,
|
|
77
|
+
labelColumnFlex = 0,
|
|
78
|
+
modes = _reactUtils.EMPTY_MODES,
|
|
79
|
+
style
|
|
80
|
+
}) {
|
|
81
|
+
/** Natural widths from header labels (plan columns only). */
|
|
82
|
+
const [headerWidths, setHeaderWidths] = (0, _react.useState)([]);
|
|
83
|
+
/** Natural widths from table body columns. */
|
|
84
|
+
const [bodyWidths, setBodyWidths] = (0, _react.useState)([]);
|
|
85
|
+
const setMeasuredWidth = (0, _react.useCallback)((setter, index, width) => {
|
|
86
|
+
setter(prev => {
|
|
87
|
+
if (prev[index] === width) return prev;
|
|
88
|
+
const next = [...prev];
|
|
89
|
+
next[index] = width;
|
|
90
|
+
return next;
|
|
91
|
+
});
|
|
92
|
+
}, []);
|
|
93
|
+
const onHeaderColumnLayout = (0, _react.useCallback)((index, event) => {
|
|
94
|
+
setMeasuredWidth(setHeaderWidths, index, event.nativeEvent.layout.width);
|
|
95
|
+
}, [setMeasuredWidth]);
|
|
96
|
+
const onBodyColumnLayout = (0, _react.useCallback)((index, event) => {
|
|
97
|
+
setMeasuredWidth(setBodyWidths, index, event.nativeEvent.layout.width);
|
|
98
|
+
}, [setMeasuredWidth]);
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Shared width for header + body cells in a column (max of natural header
|
|
102
|
+
* label vs body content). No columnGap between columns — gaps would shift
|
|
103
|
+
* headers relative to the flush table grid below.
|
|
104
|
+
*/
|
|
105
|
+
const columnWidthStyle = index => {
|
|
106
|
+
const width = Math.max(headerWidths[index] ?? 0, bodyWidths[index] ?? 0);
|
|
107
|
+
if (width > 0) {
|
|
108
|
+
return {
|
|
109
|
+
width,
|
|
110
|
+
minWidth: width,
|
|
111
|
+
flexShrink: 0,
|
|
112
|
+
flexGrow: 0
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
flexShrink: 0,
|
|
117
|
+
flexGrow: 0
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// Container
|
|
122
|
+
const gap = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/gap', modes) ?? 16;
|
|
123
|
+
|
|
124
|
+
// Header
|
|
125
|
+
const headerFg = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/header/fg', modes) ?? '#ffffff';
|
|
126
|
+
const headerBrandFg = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/header/brand/fg', modes) ?? '#cea15a';
|
|
127
|
+
const headerFontSize = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/header/fontSize', modes) ?? 14;
|
|
128
|
+
const headerFontFamily = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/header/fontFamily', modes) ?? 'JioType Var';
|
|
129
|
+
const headerLineHeight = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/header/lineHeight', modes) ?? 18;
|
|
130
|
+
const headerFontWeight = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/header/fontWeight', modes) ?? '500';
|
|
131
|
+
|
|
132
|
+
// Table
|
|
133
|
+
const tableBackground = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableRow/background', modes) ?? '#141414';
|
|
134
|
+
const tableRadius = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableRow/radius', modes) ?? 16;
|
|
135
|
+
const tableBorderSize = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableRow/border/size', modes) ?? 1;
|
|
136
|
+
const tableBorderColor = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableRow/border/color', modes) ?? '#1e1a14';
|
|
137
|
+
|
|
138
|
+
// Cell
|
|
139
|
+
const cellPadding = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableCell/padding', modes) ?? 12;
|
|
140
|
+
const cellGap = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableCell/gap', modes) ?? 2;
|
|
141
|
+
const cellMinHeight = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableCell/height', modes) ?? 46;
|
|
142
|
+
const cellBorderSize = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableCell/border/size', modes) ?? 1;
|
|
143
|
+
const cellBorderColor = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableCell/border/color', modes) ?? '#1e1a14';
|
|
144
|
+
|
|
145
|
+
// Cell label
|
|
146
|
+
const labelColor = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableCell/label/color', modes) ?? '#ffffff';
|
|
147
|
+
const labelDisabledColor = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableCell/label/disabled/color', modes) ?? '#91949c';
|
|
148
|
+
const labelFontSize = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableCell/label/fontSize', modes) ?? 12;
|
|
149
|
+
const labelFontFamily = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableCell/label/fontFamily', modes) ?? 'JioType Var';
|
|
150
|
+
const labelLineHeight = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableCell/label/lineHeight', modes) ?? 16;
|
|
151
|
+
const labelFontWeight = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableCell/label/fontWeight', modes) ?? '400';
|
|
152
|
+
|
|
153
|
+
// Cell value
|
|
154
|
+
const valueColor = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableCell/value/color', modes) ?? '#ffffff';
|
|
155
|
+
const valueFontSize = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableCell/value/fontSize', modes) ?? 12;
|
|
156
|
+
const valueFontFamily = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableCell/value/fontFamily', modes) ?? 'JioType Var';
|
|
157
|
+
const valueLineHeight = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableCell/value/lineHeight', modes) ?? 16;
|
|
158
|
+
const valueFontWeight = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/tableCell/value/fontWeight', modes) ?? '500';
|
|
159
|
+
|
|
160
|
+
// Icon
|
|
161
|
+
const iconColor = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/icon/color', modes) ?? '#ffffff';
|
|
162
|
+
const iconSize = (0, _figmaVariablesResolver.getVariableByName)('planComparisonCard/icon/size', modes) ?? 16;
|
|
163
|
+
const toWeight = w => typeof w === 'number' ? `${w}` : w;
|
|
164
|
+
const headerTextStyle = {
|
|
165
|
+
...NO_WRAP_TEXT,
|
|
166
|
+
fontFamily: headerFontFamily,
|
|
167
|
+
fontSize: headerFontSize,
|
|
168
|
+
lineHeight: headerLineHeight,
|
|
169
|
+
fontWeight: toWeight(headerFontWeight),
|
|
170
|
+
textAlign: 'center'
|
|
171
|
+
};
|
|
172
|
+
const labelTextStyle = {
|
|
173
|
+
...NO_WRAP_TEXT,
|
|
174
|
+
color: labelColor,
|
|
175
|
+
fontFamily: labelFontFamily,
|
|
176
|
+
fontSize: labelFontSize,
|
|
177
|
+
lineHeight: labelLineHeight,
|
|
178
|
+
fontWeight: toWeight(labelFontWeight)
|
|
179
|
+
};
|
|
180
|
+
const valueTextStyle = {
|
|
181
|
+
...NO_WRAP_TEXT,
|
|
182
|
+
color: valueColor,
|
|
183
|
+
fontFamily: valueFontFamily,
|
|
184
|
+
fontSize: valueFontSize,
|
|
185
|
+
lineHeight: valueLineHeight,
|
|
186
|
+
fontWeight: toWeight(valueFontWeight),
|
|
187
|
+
textAlign: 'center'
|
|
188
|
+
};
|
|
189
|
+
const planHeaderColumnStyle = {
|
|
190
|
+
alignItems: 'center',
|
|
191
|
+
justifyContent: 'center'
|
|
192
|
+
};
|
|
193
|
+
const renderValue = (value, cellKey) => {
|
|
194
|
+
// "Not available" → muted cross icon.
|
|
195
|
+
if (value === false) {
|
|
196
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
197
|
+
name: "ic_close",
|
|
198
|
+
size: iconSize,
|
|
199
|
+
color: labelDisabledColor
|
|
200
|
+
}, cellKey);
|
|
201
|
+
}
|
|
202
|
+
// Empty cell.
|
|
203
|
+
if (value === null || value === undefined || value === true) {
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
// Text content.
|
|
207
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
208
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
209
|
+
style: valueTextStyle,
|
|
210
|
+
children: value
|
|
211
|
+
}, cellKey);
|
|
212
|
+
}
|
|
213
|
+
// Custom node — forward modes so themed children stay in sync.
|
|
214
|
+
return (0, _reactUtils.cloneChildrenWithModes)(value, modes);
|
|
215
|
+
};
|
|
216
|
+
const labelCellStyle = {
|
|
217
|
+
flexDirection: 'row',
|
|
218
|
+
alignItems: 'center',
|
|
219
|
+
gap: cellGap,
|
|
220
|
+
padding: cellPadding,
|
|
221
|
+
minHeight: cellMinHeight,
|
|
222
|
+
flexShrink: 0
|
|
223
|
+
};
|
|
224
|
+
const valueCellStyle = {
|
|
225
|
+
flexDirection: 'row',
|
|
226
|
+
alignItems: 'center',
|
|
227
|
+
justifyContent: 'center',
|
|
228
|
+
padding: cellPadding,
|
|
229
|
+
minHeight: cellMinHeight,
|
|
230
|
+
flexShrink: 0
|
|
231
|
+
};
|
|
232
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
233
|
+
style: [{
|
|
234
|
+
gap,
|
|
235
|
+
alignSelf: 'flex-start'
|
|
236
|
+
}, style],
|
|
237
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
238
|
+
style: {
|
|
239
|
+
flexDirection: 'row',
|
|
240
|
+
alignItems: 'flex-end'
|
|
241
|
+
},
|
|
242
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
243
|
+
style: [columnWidthStyle(0), labelColumnFlex > 0 ? {
|
|
244
|
+
flexGrow: labelColumnFlex
|
|
245
|
+
} : undefined]
|
|
246
|
+
}), columns.map((column, index) => {
|
|
247
|
+
const colIndex = index + 1;
|
|
248
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
249
|
+
onLayout: e => onHeaderColumnLayout(colIndex, e),
|
|
250
|
+
style: [columnWidthStyle(colIndex), planHeaderColumnStyle],
|
|
251
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
252
|
+
style: [headerTextStyle, {
|
|
253
|
+
color: column.brand ? headerBrandFg : headerFg,
|
|
254
|
+
alignSelf: 'center'
|
|
255
|
+
}],
|
|
256
|
+
children: column.label
|
|
257
|
+
})
|
|
258
|
+
}, column.label ?? index);
|
|
259
|
+
})]
|
|
260
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
261
|
+
style: {
|
|
262
|
+
flexDirection: 'row',
|
|
263
|
+
alignSelf: 'flex-start',
|
|
264
|
+
backgroundColor: tableBackground,
|
|
265
|
+
borderWidth: tableBorderSize,
|
|
266
|
+
borderColor: tableBorderColor,
|
|
267
|
+
borderRadius: tableRadius,
|
|
268
|
+
overflow: 'hidden'
|
|
269
|
+
},
|
|
270
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
271
|
+
onLayout: e => onBodyColumnLayout(0, e),
|
|
272
|
+
style: [columnWidthStyle(0), labelColumnFlex > 0 ? {
|
|
273
|
+
flexGrow: labelColumnFlex
|
|
274
|
+
} : undefined],
|
|
275
|
+
children: rows.map((row, rowIndex) => {
|
|
276
|
+
const isLast = rowIndex === rows.length - 1;
|
|
277
|
+
const showInfo = row.showInfo || row.onInfoPress != null;
|
|
278
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
279
|
+
style: [labelCellStyle, {
|
|
280
|
+
borderBottomWidth: isLast ? 0 : cellBorderSize,
|
|
281
|
+
borderBottomColor: cellBorderColor
|
|
282
|
+
}],
|
|
283
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
284
|
+
style: labelTextStyle,
|
|
285
|
+
children: row.label
|
|
286
|
+
}), showInfo && (row.onInfoPress ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
287
|
+
onPress: row.onInfoPress,
|
|
288
|
+
accessibilityRole: "button",
|
|
289
|
+
accessibilityLabel: `More information about ${row.label}`,
|
|
290
|
+
hitSlop: 8,
|
|
291
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
292
|
+
name: "ic_info",
|
|
293
|
+
size: iconSize,
|
|
294
|
+
color: iconColor
|
|
295
|
+
})
|
|
296
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
|
|
297
|
+
name: "ic_info",
|
|
298
|
+
size: iconSize,
|
|
299
|
+
color: iconColor
|
|
300
|
+
}))]
|
|
301
|
+
}, row.key ?? `${row.label}-${rowIndex}`);
|
|
302
|
+
})
|
|
303
|
+
}), columns.map((column, colIndex) => {
|
|
304
|
+
const colIndexWidth = colIndex + 1;
|
|
305
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
306
|
+
onLayout: e => onBodyColumnLayout(colIndexWidth, e),
|
|
307
|
+
style: [columnWidthStyle(colIndexWidth), planHeaderColumnStyle],
|
|
308
|
+
children: rows.map((row, rowIndex) => {
|
|
309
|
+
const isLast = rowIndex === rows.length - 1;
|
|
310
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
311
|
+
style: [valueCellStyle, {
|
|
312
|
+
borderBottomWidth: isLast ? 0 : cellBorderSize,
|
|
313
|
+
borderBottomColor: cellBorderColor
|
|
314
|
+
}],
|
|
315
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
316
|
+
style: {
|
|
317
|
+
flexShrink: 0
|
|
318
|
+
},
|
|
319
|
+
children: renderValue(row.values?.[colIndex], `${rowIndex}-${colIndex}`)
|
|
320
|
+
})
|
|
321
|
+
}, row.key ?? `${row.label}-${rowIndex}`);
|
|
322
|
+
})
|
|
323
|
+
}, column.label ?? colIndex);
|
|
324
|
+
})]
|
|
325
|
+
})]
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
var _default = exports.default = PlanComparisonCard;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
10
|
+
var _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
|
|
11
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
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); }
|
|
14
|
+
/**
|
|
15
|
+
* Slot — a token-driven layout container for grouped slot content.
|
|
16
|
+
*
|
|
17
|
+
* Use `Slot` instead of a raw `View` when you need a vertical or horizontal
|
|
18
|
+
* stack with design-token gap spacing and automatic `modes` propagation to
|
|
19
|
+
* children. Typical usage is nesting a column of actions inside a
|
|
20
|
+
* direction-locked parent such as `ActionFooter`:
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <ActionFooter modes={modes}>
|
|
25
|
+
* <Slot layoutDirection="vertical" modes={modes}>
|
|
26
|
+
* <Button label="Continue" modes={primaryModes} />
|
|
27
|
+
* <Disclaimer disclaimer="Terms apply." modes={modes} />
|
|
28
|
+
* </Slot>
|
|
29
|
+
* </ActionFooter>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
function Slot({
|
|
33
|
+
children,
|
|
34
|
+
layoutDirection = 'vertical',
|
|
35
|
+
alignCrossAxis,
|
|
36
|
+
justifyMainAxis,
|
|
37
|
+
modes: propModes = _reactUtils.EMPTY_MODES,
|
|
38
|
+
style,
|
|
39
|
+
...rest
|
|
40
|
+
}) {
|
|
41
|
+
const {
|
|
42
|
+
modes: globalModes
|
|
43
|
+
} = (0, _JFSThemeProvider.useTokens)();
|
|
44
|
+
const modes = (0, _react.useMemo)(() => ({
|
|
45
|
+
...globalModes,
|
|
46
|
+
...propModes
|
|
47
|
+
}), [globalModes, propModes]);
|
|
48
|
+
const {
|
|
49
|
+
containerStyle,
|
|
50
|
+
processedChildren
|
|
51
|
+
} = (0, _react.useMemo)(() => {
|
|
52
|
+
const gap = (0, _figmaVariablesResolver.getVariableByName)('slot/gap', modes) ?? 8;
|
|
53
|
+
const isHorizontal = layoutDirection === 'horizontal';
|
|
54
|
+
const container = {
|
|
55
|
+
flexDirection: isHorizontal ? 'row' : 'column',
|
|
56
|
+
alignItems: alignCrossAxis ?? (isHorizontal ? 'flex-start' : 'stretch'),
|
|
57
|
+
justifyContent: justifyMainAxis ?? (isHorizontal ? 'center' : undefined),
|
|
58
|
+
alignSelf: 'stretch',
|
|
59
|
+
gap
|
|
60
|
+
};
|
|
61
|
+
const processed = children ? (0, _reactUtils.cloneChildrenWithModes)(children, modes) : null;
|
|
62
|
+
return {
|
|
63
|
+
containerStyle: container,
|
|
64
|
+
processedChildren: processed
|
|
65
|
+
};
|
|
66
|
+
}, [children, modes, layoutDirection, alignCrossAxis, justifyMainAxis]);
|
|
67
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
68
|
+
style: [containerStyle, style],
|
|
69
|
+
...rest,
|
|
70
|
+
children: processedChildren
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
var _default = exports.default = /*#__PURE__*/_react.default.memo(Slot);
|
|
@@ -18,49 +18,45 @@ function Step({
|
|
|
18
18
|
modes = _reactUtils.EMPTY_MODES,
|
|
19
19
|
style,
|
|
20
20
|
index = 0,
|
|
21
|
+
showLine = true,
|
|
21
22
|
connectorStyle,
|
|
22
23
|
title,
|
|
23
24
|
supportingText,
|
|
25
|
+
metaText,
|
|
24
26
|
subtitle = true,
|
|
27
|
+
meta = true,
|
|
25
28
|
status = 'number'
|
|
26
29
|
}) {
|
|
27
|
-
// Container styles
|
|
28
30
|
const minHeight = Number((0, _figmaVariablesResolver.getVariableByName)('steperItem/minHeight', modes)) || 52;
|
|
29
|
-
const gap = Number((0, _figmaVariablesResolver.getVariableByName)('steperItem/gap', modes)) ||
|
|
30
|
-
|
|
31
|
-
// Indicator dimensions and styles
|
|
32
|
-
const indicatorSize = Number((0, _figmaVariablesResolver.getVariableByName)('stepIndicator/size', modes)) || 24;
|
|
31
|
+
const gap = Number((0, _figmaVariablesResolver.getVariableByName)('steperItem/gap', modes)) || 16;
|
|
32
|
+
const indicatorSize = Number((0, _figmaVariablesResolver.getVariableByName)('stepIndicator/size', modes)) || 36;
|
|
33
33
|
const indicatorRadius = Number((0, _figmaVariablesResolver.getVariableByName)('stepIndicator/radius', modes)) || 9999;
|
|
34
|
-
const indicatorBg = (0, _figmaVariablesResolver.getVariableByName)('stepIndicator/background', modes) || '#
|
|
35
|
-
const indicatorBorderColor = (0, _figmaVariablesResolver.getVariableByName)('stepIndicator/border/color', modes) || '#
|
|
34
|
+
const indicatorBg = (0, _figmaVariablesResolver.getVariableByName)('stepIndicator/background', modes) || '#5d00b5';
|
|
35
|
+
const indicatorBorderColor = (0, _figmaVariablesResolver.getVariableByName)('stepIndicator/border/color', modes) || '#5d00b5';
|
|
36
36
|
const indicatorBorderSize = Number((0, _figmaVariablesResolver.getVariableByName)('stepIndicator/border/size', modes)) || 1;
|
|
37
37
|
const iconColor = (0, _figmaVariablesResolver.getVariableByName)('stepIndicator/icon/color', modes) || '#ffffff';
|
|
38
|
-
|
|
39
|
-
// Label styles (for number)
|
|
38
|
+
const stepStatusSize = Number((0, _figmaVariablesResolver.getVariableByName)('stepStatus/size', modes)) || 18;
|
|
40
39
|
const labelFontSize = Number((0, _figmaVariablesResolver.getVariableByName)('stepIndicator/label/fontSize', modes)) || 12;
|
|
41
40
|
const labelFontFamily = (0, _figmaVariablesResolver.getVariableByName)('stepIndicator/label/fontFamily', modes) || undefined;
|
|
42
41
|
const labelLineHeight = Number((0, _figmaVariablesResolver.getVariableByName)('stepIndicator/label/lineHeight', modes)) || 14;
|
|
43
42
|
const labelFontWeight = (0, _figmaVariablesResolver.getVariableByName)('stepIndicator/label/fontWeight', modes) || '500';
|
|
44
|
-
|
|
45
|
-
// Vertical line styles
|
|
46
43
|
const lineSize = Number((0, _figmaVariablesResolver.getVariableByName)('steperItem/lineSize', modes)) || 2;
|
|
47
|
-
const lineColor = (0, _figmaVariablesResolver.getVariableByName)('steperItem/line', modes) || '#
|
|
44
|
+
const lineColor = (0, _figmaVariablesResolver.getVariableByName)('steperItem/line', modes) || '#5d00b5';
|
|
48
45
|
const badgeWrapGap = Number((0, _figmaVariablesResolver.getVariableByName)('steperItem/badgeWrap/gap', modes)) || 2;
|
|
49
46
|
const containerStyle = {
|
|
50
47
|
flexDirection: 'row',
|
|
51
48
|
minHeight,
|
|
49
|
+
gap,
|
|
52
50
|
...style
|
|
53
51
|
};
|
|
54
|
-
|
|
55
|
-
// FIX: This wrapper should NOT expand. It should be exact width of the indicator.
|
|
56
52
|
const indicatorWrapperStyle = {
|
|
57
53
|
flexDirection: 'column',
|
|
58
54
|
alignItems: 'center',
|
|
59
55
|
width: indicatorSize,
|
|
60
56
|
flexGrow: 0,
|
|
61
|
-
// Do NOT grow
|
|
62
57
|
flexShrink: 0,
|
|
63
|
-
gap: badgeWrapGap
|
|
58
|
+
gap: badgeWrapGap,
|
|
59
|
+
alignSelf: 'stretch'
|
|
64
60
|
};
|
|
65
61
|
const indicatorStyle = {
|
|
66
62
|
width: indicatorSize,
|
|
@@ -73,6 +69,12 @@ function Step({
|
|
|
73
69
|
justifyContent: 'center',
|
|
74
70
|
overflow: 'hidden'
|
|
75
71
|
};
|
|
72
|
+
const stepStatusContainerStyle = {
|
|
73
|
+
width: stepStatusSize,
|
|
74
|
+
height: stepStatusSize,
|
|
75
|
+
alignItems: 'center',
|
|
76
|
+
justifyContent: 'center'
|
|
77
|
+
};
|
|
76
78
|
const labelStyle = {
|
|
77
79
|
color: iconColor,
|
|
78
80
|
fontSize: labelFontSize,
|
|
@@ -81,24 +83,19 @@ function Step({
|
|
|
81
83
|
lineHeight: labelLineHeight,
|
|
82
84
|
textAlign: 'center'
|
|
83
85
|
};
|
|
84
|
-
|
|
85
|
-
// Combine base line style with injected connectorStyle
|
|
86
86
|
const lineStyle = {
|
|
87
87
|
width: lineSize,
|
|
88
88
|
backgroundColor: lineColor,
|
|
89
89
|
flexGrow: 1,
|
|
90
|
-
|
|
91
|
-
...connectorStyle
|
|
90
|
+
minHeight: 1,
|
|
91
|
+
...connectorStyle
|
|
92
92
|
};
|
|
93
|
-
|
|
94
|
-
// Helper for icons
|
|
95
93
|
const renderIcon = () => {
|
|
96
94
|
switch (status) {
|
|
97
95
|
case 'complete':
|
|
98
|
-
// Checkmark
|
|
99
96
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.default, {
|
|
100
|
-
width:
|
|
101
|
-
height:
|
|
97
|
+
width: stepStatusSize,
|
|
98
|
+
height: stepStatusSize,
|
|
102
99
|
viewBox: "0 0 24 24",
|
|
103
100
|
fill: "none",
|
|
104
101
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Path, {
|
|
@@ -110,10 +107,9 @@ function Step({
|
|
|
110
107
|
})
|
|
111
108
|
});
|
|
112
109
|
case 'error':
|
|
113
|
-
// X mark
|
|
114
110
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.default, {
|
|
115
|
-
width:
|
|
116
|
-
height:
|
|
111
|
+
width: stepStatusSize,
|
|
112
|
+
height: stepStatusSize,
|
|
117
113
|
viewBox: "0 0 24 24",
|
|
118
114
|
fill: "none",
|
|
119
115
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Path, {
|
|
@@ -125,10 +121,9 @@ function Step({
|
|
|
125
121
|
})
|
|
126
122
|
});
|
|
127
123
|
case 'warning':
|
|
128
|
-
// Exclamation / Triangle
|
|
129
124
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.default, {
|
|
130
|
-
width:
|
|
131
|
-
height:
|
|
125
|
+
width: stepStatusSize,
|
|
126
|
+
height: stepStatusSize,
|
|
132
127
|
viewBox: "0 0 24 24",
|
|
133
128
|
fill: "none",
|
|
134
129
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.Path, {
|
|
@@ -147,46 +142,38 @@ function Step({
|
|
|
147
142
|
});
|
|
148
143
|
}
|
|
149
144
|
};
|
|
150
|
-
|
|
151
|
-
// Clone children to pass modes if they are StepLabel
|
|
152
|
-
const childrenWithProps = _react.default.Children.map(children, child => {
|
|
153
|
-
if (/*#__PURE__*/_react.default.isValidElement(child)) {
|
|
154
|
-
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
155
|
-
modes
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
return child;
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
// Determine if we have content to pad
|
|
162
|
-
// Default padding bottom to 16 if line is shown, but also respect connectorStyle display
|
|
163
|
-
// If display is none, we probably don't want the padding bottom either.
|
|
164
|
-
const isLineHidden = connectorStyle?.display === 'none';
|
|
165
|
-
const contentPaddingBottom = isLineHidden ? 0 : 16;
|
|
145
|
+
const hasSlotChildren = _react.default.Children.count(children) > 0;
|
|
166
146
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
167
147
|
style: containerStyle,
|
|
168
148
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
169
149
|
style: indicatorWrapperStyle,
|
|
170
150
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
171
151
|
style: indicatorStyle,
|
|
172
|
-
children:
|
|
173
|
-
|
|
152
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
153
|
+
style: stepStatusContainerStyle,
|
|
154
|
+
children: renderIcon()
|
|
155
|
+
})
|
|
156
|
+
}), showLine ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
174
157
|
style: lineStyle
|
|
175
|
-
})]
|
|
176
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
177
|
-
style: {
|
|
178
|
-
width: gap
|
|
179
|
-
}
|
|
158
|
+
}) : null]
|
|
180
159
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
181
160
|
style: {
|
|
182
|
-
flex: 1
|
|
183
|
-
paddingBottom: contentPaddingBottom
|
|
161
|
+
flex: 1
|
|
184
162
|
},
|
|
185
|
-
children:
|
|
186
|
-
title
|
|
187
|
-
|
|
163
|
+
children: hasSlotChildren ? (0, _reactUtils.cloneChildrenWithModes)(children, modes) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_StepLabel.StepLabel, {
|
|
164
|
+
...(title !== undefined ? {
|
|
165
|
+
title
|
|
166
|
+
} : {}),
|
|
167
|
+
...(supportingText !== undefined ? {
|
|
168
|
+
supportingText
|
|
169
|
+
} : {}),
|
|
170
|
+
...(metaText !== undefined ? {
|
|
171
|
+
metaText
|
|
172
|
+
} : {}),
|
|
173
|
+
subtitle: subtitle,
|
|
174
|
+
meta: meta,
|
|
188
175
|
modes: modes
|
|
189
|
-
})
|
|
176
|
+
})
|
|
190
177
|
})]
|
|
191
178
|
});
|
|
192
179
|
}
|