jfs-components 0.0.74 → 0.0.78
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 +109 -0
- package/lib/commonjs/components/Accordion/Accordion.js +55 -55
- package/lib/commonjs/components/ActionFooter/ActionFooter.js +193 -82
- package/lib/commonjs/components/Avatar/Avatar.js +20 -0
- package/lib/commonjs/components/Badge/Badge.js +23 -0
- package/lib/commonjs/components/Button/Button.js +37 -0
- 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 +355 -0
- package/lib/commonjs/components/IconButton/IconButton.js +20 -0
- package/lib/commonjs/components/Image/Image.js +26 -1
- package/lib/commonjs/components/ListItem/ListItem.js +25 -10
- package/lib/commonjs/components/LottiePlayer/LottiePlayer.js +116 -0
- package/lib/commonjs/components/LottiePlayer/LottiePlayer.web.js +82 -0
- package/lib/commonjs/components/LottiePlayer/loadNativeLottieView.js +74 -0
- package/lib/commonjs/components/LottiePlayer/loadWebLottieView.js +50 -0
- package/lib/commonjs/components/MessageField/MessageField.js +318 -0
- package/lib/commonjs/components/NavArrow/NavArrow.js +58 -17
- package/lib/commonjs/components/PageHero/PageHero.js +41 -5
- package/lib/commonjs/components/RechargeCard/RechargeCard.js +32 -17
- 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/Text/Text.js +31 -1
- package/lib/commonjs/components/TextInput/TextInput.js +16 -1
- package/lib/commonjs/components/Title/Title.js +10 -2
- package/lib/commonjs/components/index.js +35 -0
- package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/commonjs/icons/Icon.js +16 -0
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/skeleton/Skeleton.js +234 -0
- package/lib/commonjs/skeleton/SkeletonGroup.js +140 -0
- package/lib/commonjs/skeleton/index.js +58 -0
- package/lib/commonjs/skeleton/shimmer-tokens.js +189 -0
- package/lib/commonjs/skeleton/useReducedMotion.js +64 -0
- package/lib/module/components/Accordion/Accordion.js +56 -56
- package/lib/module/components/ActionFooter/ActionFooter.js +193 -83
- package/lib/module/components/Avatar/Avatar.js +19 -0
- package/lib/module/components/Badge/Badge.js +23 -0
- package/lib/module/components/Button/Button.js +37 -0
- 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 +350 -0
- package/lib/module/components/IconButton/IconButton.js +20 -0
- package/lib/module/components/Image/Image.js +25 -1
- package/lib/module/components/ListItem/ListItem.js +25 -10
- package/lib/module/components/LottiePlayer/LottiePlayer.js +111 -0
- package/lib/module/components/LottiePlayer/LottiePlayer.web.js +77 -0
- package/lib/module/components/LottiePlayer/loadNativeLottieView.js +69 -0
- package/lib/module/components/LottiePlayer/loadWebLottieView.js +45 -0
- package/lib/module/components/MessageField/MessageField.js +313 -0
- package/lib/module/components/NavArrow/NavArrow.js +59 -18
- package/lib/module/components/PageHero/PageHero.js +41 -5
- package/lib/module/components/RechargeCard/RechargeCard.js +33 -17
- 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/Text/Text.js +31 -1
- package/lib/module/components/TextInput/TextInput.js +17 -2
- package/lib/module/components/Title/Title.js +10 -2
- package/lib/module/components/index.js +5 -0
- package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/module/icons/Icon.js +16 -0
- package/lib/module/icons/registry.js +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/skeleton/Skeleton.js +229 -0
- package/lib/module/skeleton/SkeletonGroup.js +133 -0
- package/lib/module/skeleton/index.js +6 -0
- package/lib/module/skeleton/shimmer-tokens.js +181 -0
- package/lib/module/skeleton/useReducedMotion.js +61 -0
- package/lib/typescript/src/components/Accordion/Accordion.d.ts +14 -20
- package/lib/typescript/src/components/ActionFooter/ActionFooter.d.ts +26 -21
- package/lib/typescript/src/components/Avatar/Avatar.d.ts +7 -1
- package/lib/typescript/src/components/Badge/Badge.d.ts +7 -1
- package/lib/typescript/src/components/Button/Button.d.ts +8 -1
- 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/IconButton/IconButton.d.ts +7 -1
- package/lib/typescript/src/components/Image/Image.d.ts +8 -1
- package/lib/typescript/src/components/LottiePlayer/LottiePlayer.d.ts +85 -0
- package/lib/typescript/src/components/LottiePlayer/LottiePlayer.web.d.ts +28 -0
- package/lib/typescript/src/components/LottiePlayer/loadNativeLottieView.d.ts +11 -0
- package/lib/typescript/src/components/LottiePlayer/loadWebLottieView.d.ts +11 -0
- 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/PageHero/PageHero.d.ts +31 -5
- 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/Text/Text.d.ts +20 -1
- package/lib/typescript/src/components/index.d.ts +8 -3
- package/lib/typescript/src/icons/Icon.d.ts +7 -1
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/skeleton/Skeleton.d.ts +60 -0
- package/lib/typescript/src/skeleton/SkeletonGroup.d.ts +78 -0
- package/lib/typescript/src/skeleton/index.d.ts +5 -0
- package/lib/typescript/src/skeleton/shimmer-tokens.d.ts +160 -0
- package/lib/typescript/src/skeleton/useReducedMotion.d.ts +15 -0
- package/package.json +11 -1
- package/src/components/Accordion/Accordion.tsx +113 -73
- package/src/components/ActionFooter/ActionFooter.tsx +210 -92
- package/src/components/Avatar/Avatar.tsx +26 -0
- package/src/components/Badge/Badge.tsx +27 -0
- package/src/components/Button/Button.tsx +40 -0
- 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/IconButton/IconButton.tsx +27 -0
- package/src/components/Image/Image.tsx +25 -0
- package/src/components/ListItem/ListItem.tsx +21 -10
- package/src/components/LottiePlayer/LottiePlayer.tsx +145 -0
- package/src/components/LottiePlayer/LottiePlayer.web.tsx +94 -0
- package/src/components/LottiePlayer/loadNativeLottieView.tsx +87 -0
- package/src/components/LottiePlayer/loadWebLottieView.tsx +64 -0
- package/src/components/MessageField/MessageField.tsx +543 -0
- package/src/components/NavArrow/NavArrow.tsx +81 -17
- package/src/components/PageHero/PageHero.tsx +61 -4
- package/src/components/RechargeCard/RechargeCard.tsx +32 -24
- 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/Text/Text.tsx +54 -0
- package/src/components/TextInput/TextInput.tsx +14 -1
- package/src/components/Title/Title.tsx +13 -2
- package/src/components/index.ts +8 -3
- package/src/design-tokens/Coin Variables-variables-full.json +1 -1
- package/src/icons/Icon.tsx +17 -0
- package/src/icons/registry.ts +1 -1
- package/src/index.ts +1 -0
- package/src/skeleton/Skeleton.tsx +298 -0
- package/src/skeleton/SkeletonGroup.tsx +193 -0
- package/src/skeleton/index.ts +10 -0
- package/src/skeleton/shimmer-tokens.ts +221 -0
- package/src/skeleton/useReducedMotion.ts +72 -0
|
@@ -7,7 +7,23 @@ import AvatarGroup from '../AvatarGroup/AvatarGroup';
|
|
|
7
7
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
8
8
|
import { EMPTY_MODES } from '../../utils/react-utils';
|
|
9
9
|
import MoneyValue from '../MoneyValue/MoneyValue';
|
|
10
|
+
|
|
11
|
+
// Defaults applied to the inner ButtonGroup so the card matches Figma out of
|
|
12
|
+
// the box. They are spread *before* the caller's `modes` so any consumer can
|
|
13
|
+
// override an individual key (e.g. swap the size to "M").
|
|
10
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
const DEFAULT_BUTTON_GROUP_MODES = {
|
|
16
|
+
AppearanceBrand: 'Secondary',
|
|
17
|
+
'Button / Size': 'S',
|
|
18
|
+
Emphasis: 'High'
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Defaults applied to the inner MoneyValue so the price renders at the
|
|
22
|
+
// 36 px / 900-weight scale defined for cards in Figma. Same merge rule as
|
|
23
|
+
// the button group — consumer `modes` override these.
|
|
24
|
+
const DEFAULT_MONEY_VALUE_MODES = {
|
|
25
|
+
Context3: 'Balance & Cards'
|
|
26
|
+
};
|
|
11
27
|
/**
|
|
12
28
|
* RechargeCard component implementation from Figma node 2235:937.
|
|
13
29
|
* Displays a recharge plan with price, validity, data, and subscription details.
|
|
@@ -23,17 +39,19 @@ export default function RechargeCard({
|
|
|
23
39
|
modes = EMPTY_MODES,
|
|
24
40
|
style
|
|
25
41
|
}) {
|
|
26
|
-
// Container Tokens
|
|
27
|
-
const backgroundColor = getVariableByName('rechargeCard/background', modes) || '#
|
|
42
|
+
// Container Tokens (defaults mirror Figma node 2235:937).
|
|
43
|
+
const backgroundColor = getVariableByName('rechargeCard/background', modes) || '#ffffff';
|
|
28
44
|
const paddingHorizontal = parseInt(getVariableByName('rechargeCard/padding/horizontal', modes) || 16, 10);
|
|
29
45
|
const paddingVertical = parseInt(getVariableByName('rechargeCard/padding/vertical', modes) || 20, 10);
|
|
30
46
|
const gap = parseInt(getVariableByName('rechargeCard/gap', modes) || 20, 10);
|
|
31
47
|
const radius = parseInt(getVariableByName('rechargeCard/radius', modes) || 20, 10);
|
|
32
|
-
const minWidth = parseInt(getVariableByName('rechargeCard/minWidth', modes) ||
|
|
48
|
+
const minWidth = parseInt(getVariableByName('rechargeCard/minWidth', modes) || 312, 10);
|
|
49
|
+
const strokeWidth = parseInt(getVariableByName('rechargeCard/strokeWidth', modes) || 1, 10);
|
|
50
|
+
const strokeColor = getVariableByName('rechargeCard/stroke/color', modes) || '#ebebed';
|
|
33
51
|
|
|
34
52
|
// Header Tokens
|
|
35
53
|
const headerGap = parseInt(getVariableByName('rechargeCard/header/gap', modes) || 4, 10);
|
|
36
|
-
const titleColor = getVariableByName('rechargeCard/title/color', modes) || '#
|
|
54
|
+
const titleColor = getVariableByName('rechargeCard/title/color', modes) || '#000000';
|
|
37
55
|
const titleFontSize = parseInt(getVariableByName('rechargeCard/title/fontSize', modes) || 12, 10);
|
|
38
56
|
const titleFontFamily = getVariableByName('rechargeCard/title/fontFamily', modes) || 'JioType Var';
|
|
39
57
|
const titleLineHeight = parseInt(getVariableByName('rechargeCard/title/lineHeight', modes) || 14, 10);
|
|
@@ -44,30 +62,25 @@ export default function RechargeCard({
|
|
|
44
62
|
const specItemGap = parseInt(getVariableByName('rechargeCard/specItem/gap', modes) || 4, 10);
|
|
45
63
|
|
|
46
64
|
// Spec Label Tokens
|
|
47
|
-
const specLabelColor = getVariableByName('rechargeCard/specItem/label/color', modes) || '#
|
|
65
|
+
const specLabelColor = getVariableByName('rechargeCard/specItem/label/color', modes) || '#000000';
|
|
48
66
|
const specLabelFontSize = parseInt(getVariableByName('rechargeCard/specItem/label/fontSize', modes) || 12, 10);
|
|
49
67
|
const specLabelFontFamily = getVariableByName('rechargeCard/specItem/label/fontFamily', modes) || 'JioType Var';
|
|
50
68
|
const specLabelLineHeight = parseInt(getVariableByName('rechargeCard/specItem/label/lineHeight', modes) || 14, 10);
|
|
51
69
|
const specLabelFontWeight = getVariableByName('rechargeCard/specItem/label/fontWeight', modes) || '500';
|
|
52
70
|
|
|
53
71
|
// Spec Value Tokens
|
|
54
|
-
const specValueColor = getVariableByName('rechargeCard/specItem/value/color', modes) || '#
|
|
72
|
+
const specValueColor = getVariableByName('rechargeCard/specItem/value/color', modes) || '#000000';
|
|
55
73
|
const specValueFontSize = parseInt(getVariableByName('rechargeCard/specItem/value/fontSize', modes) || 14, 10);
|
|
56
74
|
const specValueFontFamily = getVariableByName('rechargeCard/specItem/value/fontFamily', modes) || 'JioType Var';
|
|
57
75
|
const specValueLineHeight = parseInt(getVariableByName('rechargeCard/specItem/value/lineHeight', modes) || 17, 10);
|
|
58
76
|
const specValueFontWeight = getVariableByName('rechargeCard/specItem/value/fontWeight', modes) || '500';
|
|
59
77
|
|
|
60
78
|
// Disclaimer Tokens
|
|
61
|
-
const disclaimerColor = getVariableByName('rechargeCard/disclaimer/color', modes) || '#
|
|
79
|
+
const disclaimerColor = getVariableByName('rechargeCard/disclaimer/color', modes) || '#000000';
|
|
62
80
|
const disclaimerFontSize = parseInt(getVariableByName('rechargeCard/disclaimer/fontSize', modes) || 10, 10);
|
|
63
81
|
const disclaimerFontFamily = getVariableByName('rechargeCard/disclaimer/fontFamily', modes) || 'JioType Var';
|
|
64
82
|
const disclaimerLineHeight = parseInt(getVariableByName('rechargeCard/disclaimer/lineHeight', modes) || 13, 10);
|
|
65
83
|
const disclaimerFontWeight = getVariableByName('rechargeCard/disclaimer/fontWeight', modes) || '400';
|
|
66
|
-
|
|
67
|
-
// Button Group Tokens
|
|
68
|
-
// Handled by ButtonGroup component directly
|
|
69
|
-
|
|
70
|
-
// Helpers
|
|
71
84
|
const resolveFontWeight = weight => typeof weight === 'number' ? weight.toString() : weight;
|
|
72
85
|
|
|
73
86
|
// Pass modes to subscription children (e.g. AvatarGroup)
|
|
@@ -80,6 +93,8 @@ export default function RechargeCard({
|
|
|
80
93
|
paddingVertical,
|
|
81
94
|
gap,
|
|
82
95
|
borderRadius: radius,
|
|
96
|
+
borderWidth: strokeWidth,
|
|
97
|
+
borderColor: strokeColor,
|
|
83
98
|
minWidth,
|
|
84
99
|
alignItems: 'flex-start'
|
|
85
100
|
}, style],
|
|
@@ -100,7 +115,10 @@ export default function RechargeCard({
|
|
|
100
115
|
}), /*#__PURE__*/_jsx(MoneyValue, {
|
|
101
116
|
value: price,
|
|
102
117
|
currency: "\u20B9",
|
|
103
|
-
modes:
|
|
118
|
+
modes: {
|
|
119
|
+
...DEFAULT_MONEY_VALUE_MODES,
|
|
120
|
+
...modes
|
|
121
|
+
}
|
|
104
122
|
})]
|
|
105
123
|
}), /*#__PURE__*/_jsxs(View, {
|
|
106
124
|
style: {
|
|
@@ -189,10 +207,8 @@ export default function RechargeCard({
|
|
|
189
207
|
children: disclaimer
|
|
190
208
|
}), /*#__PURE__*/_jsx(ButtonGroup, {
|
|
191
209
|
modes: {
|
|
192
|
-
...
|
|
193
|
-
|
|
194
|
-
"Button / Size": "S",
|
|
195
|
-
"Emphasis": "High"
|
|
210
|
+
...DEFAULT_BUTTON_GROUP_MODES,
|
|
211
|
+
...modes
|
|
196
212
|
},
|
|
197
213
|
children: actions
|
|
198
214
|
})]
|
|
@@ -5,56 +5,52 @@ import { View, Text } from 'react-native';
|
|
|
5
5
|
import Svg, { Path } from 'react-native-svg';
|
|
6
6
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
7
7
|
import { StepLabel } from './StepLabel';
|
|
8
|
-
import { EMPTY_MODES } from '../../utils/react-utils';
|
|
8
|
+
import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils';
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
export function Step({
|
|
11
11
|
children,
|
|
12
12
|
modes = EMPTY_MODES,
|
|
13
13
|
style,
|
|
14
14
|
index = 0,
|
|
15
|
+
showLine = true,
|
|
15
16
|
connectorStyle,
|
|
16
17
|
title,
|
|
17
18
|
supportingText,
|
|
19
|
+
metaText,
|
|
18
20
|
subtitle = true,
|
|
21
|
+
meta = true,
|
|
19
22
|
status = 'number'
|
|
20
23
|
}) {
|
|
21
|
-
// Container styles
|
|
22
24
|
const minHeight = Number(getVariableByName('steperItem/minHeight', modes)) || 52;
|
|
23
|
-
const gap = Number(getVariableByName('steperItem/gap', modes)) ||
|
|
24
|
-
|
|
25
|
-
// Indicator dimensions and styles
|
|
26
|
-
const indicatorSize = Number(getVariableByName('stepIndicator/size', modes)) || 24;
|
|
25
|
+
const gap = Number(getVariableByName('steperItem/gap', modes)) || 16;
|
|
26
|
+
const indicatorSize = Number(getVariableByName('stepIndicator/size', modes)) || 36;
|
|
27
27
|
const indicatorRadius = Number(getVariableByName('stepIndicator/radius', modes)) || 9999;
|
|
28
|
-
const indicatorBg = getVariableByName('stepIndicator/background', modes) || '#
|
|
29
|
-
const indicatorBorderColor = getVariableByName('stepIndicator/border/color', modes) || '#
|
|
28
|
+
const indicatorBg = getVariableByName('stepIndicator/background', modes) || '#5d00b5';
|
|
29
|
+
const indicatorBorderColor = getVariableByName('stepIndicator/border/color', modes) || '#5d00b5';
|
|
30
30
|
const indicatorBorderSize = Number(getVariableByName('stepIndicator/border/size', modes)) || 1;
|
|
31
31
|
const iconColor = getVariableByName('stepIndicator/icon/color', modes) || '#ffffff';
|
|
32
|
-
|
|
33
|
-
// Label styles (for number)
|
|
32
|
+
const stepStatusSize = Number(getVariableByName('stepStatus/size', modes)) || 18;
|
|
34
33
|
const labelFontSize = Number(getVariableByName('stepIndicator/label/fontSize', modes)) || 12;
|
|
35
34
|
const labelFontFamily = getVariableByName('stepIndicator/label/fontFamily', modes) || undefined;
|
|
36
35
|
const labelLineHeight = Number(getVariableByName('stepIndicator/label/lineHeight', modes)) || 14;
|
|
37
36
|
const labelFontWeight = getVariableByName('stepIndicator/label/fontWeight', modes) || '500';
|
|
38
|
-
|
|
39
|
-
// Vertical line styles
|
|
40
37
|
const lineSize = Number(getVariableByName('steperItem/lineSize', modes)) || 2;
|
|
41
|
-
const lineColor = getVariableByName('steperItem/line', modes) || '#
|
|
38
|
+
const lineColor = getVariableByName('steperItem/line', modes) || '#5d00b5';
|
|
42
39
|
const badgeWrapGap = Number(getVariableByName('steperItem/badgeWrap/gap', modes)) || 2;
|
|
43
40
|
const containerStyle = {
|
|
44
41
|
flexDirection: 'row',
|
|
45
42
|
minHeight,
|
|
43
|
+
gap,
|
|
46
44
|
...style
|
|
47
45
|
};
|
|
48
|
-
|
|
49
|
-
// FIX: This wrapper should NOT expand. It should be exact width of the indicator.
|
|
50
46
|
const indicatorWrapperStyle = {
|
|
51
47
|
flexDirection: 'column',
|
|
52
48
|
alignItems: 'center',
|
|
53
49
|
width: indicatorSize,
|
|
54
50
|
flexGrow: 0,
|
|
55
|
-
// Do NOT grow
|
|
56
51
|
flexShrink: 0,
|
|
57
|
-
gap: badgeWrapGap
|
|
52
|
+
gap: badgeWrapGap,
|
|
53
|
+
alignSelf: 'stretch'
|
|
58
54
|
};
|
|
59
55
|
const indicatorStyle = {
|
|
60
56
|
width: indicatorSize,
|
|
@@ -67,6 +63,12 @@ export function Step({
|
|
|
67
63
|
justifyContent: 'center',
|
|
68
64
|
overflow: 'hidden'
|
|
69
65
|
};
|
|
66
|
+
const stepStatusContainerStyle = {
|
|
67
|
+
width: stepStatusSize,
|
|
68
|
+
height: stepStatusSize,
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
justifyContent: 'center'
|
|
71
|
+
};
|
|
70
72
|
const labelStyle = {
|
|
71
73
|
color: iconColor,
|
|
72
74
|
fontSize: labelFontSize,
|
|
@@ -75,24 +77,19 @@ export function Step({
|
|
|
75
77
|
lineHeight: labelLineHeight,
|
|
76
78
|
textAlign: 'center'
|
|
77
79
|
};
|
|
78
|
-
|
|
79
|
-
// Combine base line style with injected connectorStyle
|
|
80
80
|
const lineStyle = {
|
|
81
81
|
width: lineSize,
|
|
82
82
|
backgroundColor: lineColor,
|
|
83
83
|
flexGrow: 1,
|
|
84
|
-
|
|
85
|
-
...connectorStyle
|
|
84
|
+
minHeight: 1,
|
|
85
|
+
...connectorStyle
|
|
86
86
|
};
|
|
87
|
-
|
|
88
|
-
// Helper for icons
|
|
89
87
|
const renderIcon = () => {
|
|
90
88
|
switch (status) {
|
|
91
89
|
case 'complete':
|
|
92
|
-
// Checkmark
|
|
93
90
|
return /*#__PURE__*/_jsx(Svg, {
|
|
94
|
-
width:
|
|
95
|
-
height:
|
|
91
|
+
width: stepStatusSize,
|
|
92
|
+
height: stepStatusSize,
|
|
96
93
|
viewBox: "0 0 24 24",
|
|
97
94
|
fill: "none",
|
|
98
95
|
children: /*#__PURE__*/_jsx(Path, {
|
|
@@ -104,10 +101,9 @@ export function Step({
|
|
|
104
101
|
})
|
|
105
102
|
});
|
|
106
103
|
case 'error':
|
|
107
|
-
// X mark
|
|
108
104
|
return /*#__PURE__*/_jsx(Svg, {
|
|
109
|
-
width:
|
|
110
|
-
height:
|
|
105
|
+
width: stepStatusSize,
|
|
106
|
+
height: stepStatusSize,
|
|
111
107
|
viewBox: "0 0 24 24",
|
|
112
108
|
fill: "none",
|
|
113
109
|
children: /*#__PURE__*/_jsx(Path, {
|
|
@@ -119,10 +115,9 @@ export function Step({
|
|
|
119
115
|
})
|
|
120
116
|
});
|
|
121
117
|
case 'warning':
|
|
122
|
-
// Exclamation / Triangle
|
|
123
118
|
return /*#__PURE__*/_jsx(Svg, {
|
|
124
|
-
width:
|
|
125
|
-
height:
|
|
119
|
+
width: stepStatusSize,
|
|
120
|
+
height: stepStatusSize,
|
|
126
121
|
viewBox: "0 0 24 24",
|
|
127
122
|
fill: "none",
|
|
128
123
|
children: /*#__PURE__*/_jsx(Path, {
|
|
@@ -141,46 +136,38 @@ export function Step({
|
|
|
141
136
|
});
|
|
142
137
|
}
|
|
143
138
|
};
|
|
144
|
-
|
|
145
|
-
// Clone children to pass modes if they are StepLabel
|
|
146
|
-
const childrenWithProps = React.Children.map(children, child => {
|
|
147
|
-
if (/*#__PURE__*/React.isValidElement(child)) {
|
|
148
|
-
return /*#__PURE__*/React.cloneElement(child, {
|
|
149
|
-
modes
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
return child;
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
// Determine if we have content to pad
|
|
156
|
-
// Default padding bottom to 16 if line is shown, but also respect connectorStyle display
|
|
157
|
-
// If display is none, we probably don't want the padding bottom either.
|
|
158
|
-
const isLineHidden = connectorStyle?.display === 'none';
|
|
159
|
-
const contentPaddingBottom = isLineHidden ? 0 : 16;
|
|
139
|
+
const hasSlotChildren = React.Children.count(children) > 0;
|
|
160
140
|
return /*#__PURE__*/_jsxs(View, {
|
|
161
141
|
style: containerStyle,
|
|
162
142
|
children: [/*#__PURE__*/_jsxs(View, {
|
|
163
143
|
style: indicatorWrapperStyle,
|
|
164
144
|
children: [/*#__PURE__*/_jsx(View, {
|
|
165
145
|
style: indicatorStyle,
|
|
166
|
-
children:
|
|
167
|
-
|
|
146
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
147
|
+
style: stepStatusContainerStyle,
|
|
148
|
+
children: renderIcon()
|
|
149
|
+
})
|
|
150
|
+
}), showLine ? /*#__PURE__*/_jsx(View, {
|
|
168
151
|
style: lineStyle
|
|
169
|
-
})]
|
|
170
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
171
|
-
style: {
|
|
172
|
-
width: gap
|
|
173
|
-
}
|
|
152
|
+
}) : null]
|
|
174
153
|
}), /*#__PURE__*/_jsx(View, {
|
|
175
154
|
style: {
|
|
176
|
-
flex: 1
|
|
177
|
-
paddingBottom: contentPaddingBottom
|
|
155
|
+
flex: 1
|
|
178
156
|
},
|
|
179
|
-
children:
|
|
180
|
-
title
|
|
181
|
-
|
|
157
|
+
children: hasSlotChildren ? cloneChildrenWithModes(children, modes) : /*#__PURE__*/_jsx(StepLabel, {
|
|
158
|
+
...(title !== undefined ? {
|
|
159
|
+
title
|
|
160
|
+
} : {}),
|
|
161
|
+
...(supportingText !== undefined ? {
|
|
162
|
+
supportingText
|
|
163
|
+
} : {}),
|
|
164
|
+
...(metaText !== undefined ? {
|
|
165
|
+
metaText
|
|
166
|
+
} : {}),
|
|
167
|
+
subtitle: subtitle,
|
|
168
|
+
meta: meta,
|
|
182
169
|
modes: modes
|
|
183
|
-
})
|
|
170
|
+
})
|
|
184
171
|
})]
|
|
185
172
|
});
|
|
186
173
|
}
|
|
@@ -8,24 +8,42 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
export function StepLabel({
|
|
9
9
|
title = 'Stepper Item',
|
|
10
10
|
supportingText,
|
|
11
|
+
metaText,
|
|
12
|
+
subtitle = true,
|
|
13
|
+
meta = true,
|
|
11
14
|
modes = EMPTY_MODES,
|
|
12
15
|
style
|
|
13
16
|
}) {
|
|
14
|
-
// Title styles
|
|
15
17
|
const titleColor = getVariableByName('steperItem/title/color', modes) || '#0d0d0f';
|
|
16
18
|
const titleFontSize = Number(getVariableByName('steperItem/title/fontSize', modes)) || 14;
|
|
17
19
|
const titleFontFamily = getVariableByName('steperItem/title/fontFamily', modes) || undefined;
|
|
18
20
|
const titleLineHeight = Number(getVariableByName('steperItem/title/lineHeight', modes)) || 18;
|
|
19
21
|
const titleFontWeight = getVariableByName('steperItem/title/fontWeight', modes) || '700';
|
|
20
22
|
|
|
21
|
-
// Subtitle
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
// The Subtitle (supportingText) and Meta both default to the "Neutral"
|
|
24
|
+
// AppearanceBrand. A caller-supplied `AppearanceBrand` still wins (it is
|
|
25
|
+
// spread after the default), so each remains overridable. The Title keeps
|
|
26
|
+
// its own appearance resolution.
|
|
27
|
+
const subtitleModes = {
|
|
28
|
+
AppearanceBrand: 'Neutral',
|
|
29
|
+
...modes
|
|
30
|
+
};
|
|
31
|
+
const metaModes = {
|
|
32
|
+
AppearanceBrand: 'Neutral',
|
|
33
|
+
...modes
|
|
34
|
+
};
|
|
35
|
+
const subtitleColor = getVariableByName('steperItem/subtitle/color', subtitleModes) || '#3d4047';
|
|
36
|
+
const subtitleFontSize = Number(getVariableByName('steperItem/subtitle/fontSize', subtitleModes)) || 12;
|
|
37
|
+
const subtitleFontFamily = getVariableByName('steperItem/subtitle/fontFamily', subtitleModes) || undefined;
|
|
38
|
+
const subtitleLineHeight = Number(getVariableByName('steperItem/subtitle/lineHeight', subtitleModes)) || 16;
|
|
39
|
+
const subtitleFontWeight = getVariableByName('steperItem/subtitle/fontWeight', subtitleModes) || '400';
|
|
40
|
+
const metaColor = getVariableByName('steperItem/meta/color', metaModes) || '#f7ab21';
|
|
41
|
+
const metaFontSize = Number(getVariableByName('steperItem/meta/fontSize', metaModes)) || 10;
|
|
42
|
+
// The Figma variable is authored as "fontFamily Copy" (with a space + suffix).
|
|
43
|
+
// Match the literal Figma name to avoid a missing-variable warning.
|
|
44
|
+
const metaFontFamily = getVariableByName('steperItem/meta/fontFamily Copy', metaModes) || undefined;
|
|
45
|
+
const metaLineHeight = Number(getVariableByName('steperItem/meta/lineHeight', metaModes)) || 12;
|
|
46
|
+
const metaFontWeight = getVariableByName('steperItem/meta/fontWeight', metaModes) || '700';
|
|
29
47
|
const textGap = Number(getVariableByName('steperItem/textWrap/gap', modes)) || 2;
|
|
30
48
|
const titleStyle = {
|
|
31
49
|
color: titleColor,
|
|
@@ -41,6 +59,15 @@ export function StepLabel({
|
|
|
41
59
|
fontWeight: subtitleFontWeight,
|
|
42
60
|
lineHeight: subtitleLineHeight
|
|
43
61
|
};
|
|
62
|
+
const metaStyle = {
|
|
63
|
+
color: metaColor,
|
|
64
|
+
fontSize: metaFontSize,
|
|
65
|
+
fontFamily: metaFontFamily,
|
|
66
|
+
fontWeight: metaFontWeight,
|
|
67
|
+
lineHeight: metaLineHeight
|
|
68
|
+
};
|
|
69
|
+
const showSubtitle = subtitle && !!supportingText;
|
|
70
|
+
const showMeta = meta && !!metaText;
|
|
44
71
|
return /*#__PURE__*/_jsxs(View, {
|
|
45
72
|
style: [{
|
|
46
73
|
gap: textGap,
|
|
@@ -49,9 +76,12 @@ export function StepLabel({
|
|
|
49
76
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
50
77
|
style: titleStyle,
|
|
51
78
|
children: title
|
|
52
|
-
}),
|
|
79
|
+
}), showSubtitle ? /*#__PURE__*/_jsx(Text, {
|
|
53
80
|
style: subtitleStyle,
|
|
54
81
|
children: supportingText
|
|
82
|
+
}) : null, showMeta ? /*#__PURE__*/_jsx(Text, {
|
|
83
|
+
style: metaStyle,
|
|
84
|
+
children: metaText
|
|
55
85
|
}) : null]
|
|
56
86
|
});
|
|
57
87
|
}
|
|
@@ -13,7 +13,6 @@ export default function Stepper({
|
|
|
13
13
|
modes = EMPTY_MODES,
|
|
14
14
|
style
|
|
15
15
|
}) {
|
|
16
|
-
// Stepper container styles
|
|
17
16
|
const paddingHorizontal = Number(getVariableByName('stepper/padding/horizontal', modes)) || 8;
|
|
18
17
|
const paddingVertical = Number(getVariableByName('stepper/padding/vertical', modes)) || 0;
|
|
19
18
|
const gap = Number(getVariableByName('stepper/gap', modes)) || 2;
|
|
@@ -23,25 +22,24 @@ export default function Stepper({
|
|
|
23
22
|
gap,
|
|
24
23
|
...style
|
|
25
24
|
};
|
|
26
|
-
|
|
27
|
-
// Inject index and connectorStyle logic into Step children
|
|
28
25
|
const steps = React.Children.toArray(children);
|
|
29
|
-
const
|
|
30
|
-
if (/*#__PURE__*/React.isValidElement(child))
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
const stepsWithProps = steps.map((child, stepIndex) => {
|
|
27
|
+
if (! /*#__PURE__*/React.isValidElement(child)) return child;
|
|
28
|
+
const isLast = stepIndex === steps.length - 1;
|
|
29
|
+
const childProps = child.props || {};
|
|
30
|
+
const childModes = childProps.modes ? {
|
|
31
|
+
...modes,
|
|
32
|
+
...childProps.modes
|
|
33
|
+
} : modes;
|
|
34
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
35
|
+
...childProps,
|
|
36
|
+
index: childProps.index ?? stepIndex,
|
|
37
|
+
modes: childModes,
|
|
38
|
+
showLine: childProps.showLine !== undefined ? childProps.showLine : !isLast
|
|
39
|
+
});
|
|
42
40
|
});
|
|
43
41
|
return /*#__PURE__*/_jsx(View, {
|
|
44
42
|
style: containerStyle,
|
|
45
|
-
children:
|
|
43
|
+
children: stepsWithProps
|
|
46
44
|
});
|
|
47
45
|
}
|