jfs-components 0.0.1 → 0.0.2
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/ActionFooter/ActionFooter.js +124 -0
- package/lib/commonjs/components/ActionFooter/ActionFooter.js.map +1 -0
- package/lib/commonjs/components/ActionFooter/ActionFooter.mdx +101 -0
- package/lib/commonjs/components/Button/Button.js +1 -1
- package/lib/commonjs/components/Button/Button.js.map +1 -1
- package/lib/commonjs/components/Button/Button.mdx +2 -2
- package/lib/commonjs/components/CardFeedback/CardFeedback.js +47 -11
- package/lib/commonjs/components/CardFeedback/CardFeedback.js.map +1 -1
- package/lib/commonjs/components/CardFeedback/CardFeedback.mdx +1 -0
- package/lib/commonjs/components/Divider/Divider.js +63 -0
- package/lib/commonjs/components/Divider/Divider.js.map +1 -0
- package/lib/commonjs/components/Divider/Divider.mdx +91 -0
- package/lib/commonjs/components/ListItem/ListItem.js +24 -13
- package/lib/commonjs/components/ListItem/ListItem.js.map +1 -1
- package/lib/commonjs/components/ListItem/ListItem.mdx +46 -5
- package/lib/commonjs/components/MerchantProfile/MerchantProfile.js +133 -0
- package/lib/commonjs/components/MerchantProfile/MerchantProfile.js.map +1 -0
- package/lib/commonjs/components/MerchantProfile/MerchantProfile.mdx +139 -0
- package/lib/commonjs/components/MoneyValue/MoneyValue.mdx +4 -0
- package/lib/commonjs/components/NavArrow/NavArrow.js +90 -0
- package/lib/commonjs/components/NavArrow/NavArrow.js.map +1 -0
- package/lib/commonjs/components/NavArrow/NavArrow.mdx +123 -0
- package/lib/commonjs/components/Section/Section.mdx +4 -4
- package/lib/commonjs/components/Stepper/Step.mdx +1 -1
- package/lib/commonjs/components/index.js +28 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/design-tokens/JFS Variables-variables-full.json +18633 -1
- package/lib/commonjs/design-tokens/figma-variables-resolver.js.map +1 -2
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/module/components/ActionFooter/ActionFooter.js +119 -0
- package/lib/module/components/ActionFooter/ActionFooter.js.map +1 -0
- package/lib/module/components/ActionFooter/ActionFooter.mdx +101 -0
- package/lib/module/components/Button/Button.js +1 -1
- package/lib/module/components/Button/Button.js.map +1 -1
- package/lib/module/components/Button/Button.mdx +2 -2
- package/lib/module/components/CardFeedback/CardFeedback.js +46 -11
- package/lib/module/components/CardFeedback/CardFeedback.js.map +1 -1
- package/lib/module/components/CardFeedback/CardFeedback.mdx +1 -0
- package/lib/module/components/Divider/Divider.js +58 -0
- package/lib/module/components/Divider/Divider.js.map +1 -0
- package/lib/module/components/Divider/Divider.mdx +91 -0
- package/lib/module/components/ListItem/ListItem.js +24 -13
- package/lib/module/components/ListItem/ListItem.js.map +1 -1
- package/lib/module/components/ListItem/ListItem.mdx +46 -5
- package/lib/module/components/MerchantProfile/MerchantProfile.js +128 -0
- package/lib/module/components/MerchantProfile/MerchantProfile.js.map +1 -0
- package/lib/module/components/MerchantProfile/MerchantProfile.mdx +139 -0
- package/lib/module/components/MoneyValue/MoneyValue.mdx +4 -0
- package/lib/module/components/NavArrow/NavArrow.js +84 -0
- package/lib/module/components/NavArrow/NavArrow.js.map +1 -0
- package/lib/module/components/NavArrow/NavArrow.mdx +123 -0
- package/lib/module/components/Section/Section.mdx +4 -4
- package/lib/module/components/Stepper/Step.mdx +1 -1
- package/lib/module/components/index.js +4 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/design-tokens/JFS Variables-variables-full.json +18633 -1
- package/lib/module/design-tokens/figma-variables-resolver.js +2 -2
- package/lib/module/design-tokens/figma-variables-resolver.js.map +2 -1
- package/lib/module/icons/registry.js +1 -1
- package/lib/typescript/components/ActionFooter/ActionFooter.d.ts +58 -0
- package/lib/typescript/components/ActionFooter/ActionFooter.d.ts.map +1 -0
- package/lib/typescript/components/CardFeedback/CardFeedback.d.ts +4 -3
- package/lib/typescript/components/CardFeedback/CardFeedback.d.ts.map +1 -1
- package/lib/typescript/components/Divider/Divider.d.ts +50 -0
- package/lib/typescript/components/Divider/Divider.d.ts.map +1 -0
- package/lib/typescript/components/ListItem/ListItem.d.ts +4 -3
- package/lib/typescript/components/ListItem/ListItem.d.ts.map +1 -1
- package/lib/typescript/components/MerchantProfile/MerchantProfile.d.ts +68 -0
- package/lib/typescript/components/MerchantProfile/MerchantProfile.d.ts.map +1 -0
- package/lib/typescript/components/NavArrow/NavArrow.d.ts +35 -0
- package/lib/typescript/components/NavArrow/NavArrow.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +4 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/icons/registry.d.ts +1 -1
- package/package.json +2 -2
- package/src/components/.token-metadata.json +99 -11
- package/src/components/ActionFooter/ActionFooter.mdx +101 -0
- package/src/components/ActionFooter/ActionFooter.tsx +142 -0
- package/src/components/Button/Button.mdx +2 -2
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/CardFeedback/CardFeedback.mdx +1 -0
- package/src/components/CardFeedback/CardFeedback.tsx +37 -12
- package/src/components/Divider/Divider.mdx +91 -0
- package/src/components/Divider/Divider.tsx +91 -0
- package/src/components/ListItem/ListItem.mdx +46 -5
- package/src/components/ListItem/ListItem.tsx +22 -11
- package/src/components/MerchantProfile/MerchantProfile.mdx +139 -0
- package/src/components/MerchantProfile/MerchantProfile.tsx +174 -0
- package/src/components/MoneyValue/MoneyValue.mdx +4 -0
- package/src/components/NavArrow/NavArrow.mdx +123 -0
- package/src/components/NavArrow/NavArrow.tsx +108 -0
- package/src/components/Section/Section.mdx +4 -4
- package/src/components/Stepper/Step.mdx +1 -1
- package/src/components/index.ts +4 -0
- package/src/design-tokens/JFS Variables-variables-full.json +18633 -1
- package/src/icons/registry.ts +1 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { Meta, Story, Canvas, PureArgsTable as ArgsTable } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as MerchantProfileStories from './MerchantProfile.stories';
|
|
3
|
+
import MerchantProfile from './MerchantProfile';
|
|
4
|
+
import { AccessibilitySection, AnatomySection, UsageConstraintsSection } from '../docs/DocSections';
|
|
5
|
+
|
|
6
|
+
<Meta of={MerchantProfileStories} />
|
|
7
|
+
|
|
8
|
+
# MerchantProfile
|
|
9
|
+
|
|
10
|
+
Displays a merchant's identity in a centered vertical layout with an avatar, title, and subtitle. Commonly used on payment confirmation screens, transaction receipts, and merchant identification flows.
|
|
11
|
+
|
|
12
|
+
## Props
|
|
13
|
+
|
|
14
|
+
<ArgsTable of={MerchantProfile} />
|
|
15
|
+
|
|
16
|
+
## Available Collections and Modes
|
|
17
|
+
|
|
18
|
+
This component does not use any design token collections with multiple modes.
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
The default configuration shows the typical merchant profile layout:
|
|
22
|
+
|
|
23
|
+
<Canvas>
|
|
24
|
+
<Story of={MerchantProfileStories.Default} />
|
|
25
|
+
</Canvas>
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
### Short Name
|
|
30
|
+
|
|
31
|
+
For merchants with shorter names:
|
|
32
|
+
|
|
33
|
+
<Canvas>
|
|
34
|
+
<Story of={MerchantProfileStories.ShortName} />
|
|
35
|
+
</Canvas>
|
|
36
|
+
|
|
37
|
+
### Long Name
|
|
38
|
+
|
|
39
|
+
Handles longer merchant names gracefully with text wrapping:
|
|
40
|
+
|
|
41
|
+
<Canvas>
|
|
42
|
+
<Story of={MerchantProfileStories.LongName} />
|
|
43
|
+
</Canvas>
|
|
44
|
+
|
|
45
|
+
### Without Subtitle
|
|
46
|
+
|
|
47
|
+
When only the merchant name is needed:
|
|
48
|
+
|
|
49
|
+
<Canvas>
|
|
50
|
+
<Story of={MerchantProfileStories.WithoutSubtitle} />
|
|
51
|
+
</Canvas>
|
|
52
|
+
|
|
53
|
+
### Multiple Profiles
|
|
54
|
+
|
|
55
|
+
Multiple profiles displayed in a list:
|
|
56
|
+
|
|
57
|
+
<Canvas>
|
|
58
|
+
<Story of={MerchantProfileStories.MultipleProfiles} />
|
|
59
|
+
</Canvas>
|
|
60
|
+
|
|
61
|
+
## Component Usage
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { MerchantProfile } from 'jsf-components';
|
|
65
|
+
|
|
66
|
+
function PaymentConfirmation() {
|
|
67
|
+
return (
|
|
68
|
+
<View style={{ flex: 1 }}>
|
|
69
|
+
<MerchantProfile
|
|
70
|
+
title="Uber India Systems Private Limited"
|
|
71
|
+
subtitle="UPI ID: uberindia@ybl"
|
|
72
|
+
modes={{}}
|
|
73
|
+
/>
|
|
74
|
+
|
|
75
|
+
{/* Payment amount and other details */}
|
|
76
|
+
</View>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Custom Avatar
|
|
82
|
+
|
|
83
|
+
You can customize the avatar using the `avatarProps` prop:
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
<MerchantProfile
|
|
87
|
+
title="Amazon Pay"
|
|
88
|
+
subtitle="UPI ID: amazonpay@apl"
|
|
89
|
+
avatarProps={{
|
|
90
|
+
imageSource: 'https://example.com/merchant-logo.png',
|
|
91
|
+
modes: { 'Avatar Size': 'XL' },
|
|
92
|
+
}}
|
|
93
|
+
/>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
<AccessibilitySection
|
|
97
|
+
items={[
|
|
98
|
+
'The component uses `accessibilityRole="header"` to identify it as a header region.',
|
|
99
|
+
'A default accessibility label is generated from the title and subtitle.',
|
|
100
|
+
'Provide a custom `accessibilityLabel` for more context if needed.',
|
|
101
|
+
'The Avatar child component handles its own accessibility attributes.',
|
|
102
|
+
]}
|
|
103
|
+
/>
|
|
104
|
+
|
|
105
|
+
<AnatomySection>
|
|
106
|
+
<ul>
|
|
107
|
+
<li><strong>Avatar</strong> — circular merchant logo/image at the top.</li>
|
|
108
|
+
<li><strong>Title</strong> — bold merchant name centered below the avatar.</li>
|
|
109
|
+
<li><strong>Subtitle</strong> — lighter text, typically the UPI ID or additional info.</li>
|
|
110
|
+
</ul>
|
|
111
|
+
</AnatomySection>
|
|
112
|
+
|
|
113
|
+
<UsageConstraintsSection
|
|
114
|
+
items={[
|
|
115
|
+
'Keep titles concise; very long names will wrap but may affect layout balance.',
|
|
116
|
+
'Use consistent modes across the MerchantProfile and its siblings for visual harmony.',
|
|
117
|
+
'The component is designed for centered layouts; avoid placing in left-aligned contexts.',
|
|
118
|
+
'For interactive merchant profiles (e.g., tappable), wrap in a Pressable component.',
|
|
119
|
+
]}
|
|
120
|
+
/>
|
|
121
|
+
|
|
122
|
+
## Design Tokens
|
|
123
|
+
|
|
124
|
+
This component uses the following design tokens, resolved through `getVariableByName`:
|
|
125
|
+
|
|
126
|
+
- **`merchantProfile/gap`**
|
|
127
|
+
- **`merchantProfile/padding/horizontal`**
|
|
128
|
+
- **`merchantProfile/subtitle/color`**
|
|
129
|
+
- **`merchantProfile/subtitle/fontFamily`**
|
|
130
|
+
- **`merchantProfile/subtitle/fontSize`**
|
|
131
|
+
- **`merchantProfile/subtitle/fontWeight`**
|
|
132
|
+
- **`merchantProfile/subtitle/lineHeight`**
|
|
133
|
+
- **`merchantProfile/title/color`**
|
|
134
|
+
- **`merchantProfile/title/fontFamily`**
|
|
135
|
+
- **`merchantProfile/title/fontSize`**
|
|
136
|
+
- **`merchantProfile/title/fontWeight`**
|
|
137
|
+
- **`merchantProfile/title/lineHeight`**
|
|
138
|
+
|
|
139
|
+
All tokens support mode-based theming through the `modes` prop.
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
type ViewStyle,
|
|
6
|
+
type TextStyle,
|
|
7
|
+
type StyleProp,
|
|
8
|
+
} from 'react-native'
|
|
9
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
|
|
10
|
+
import Avatar, { type AvatarProps } from '../Avatar/Avatar'
|
|
11
|
+
|
|
12
|
+
export type MerchantProfileProps = {
|
|
13
|
+
/**
|
|
14
|
+
* The merchant's display name or title
|
|
15
|
+
*/
|
|
16
|
+
title?: string
|
|
17
|
+
/**
|
|
18
|
+
* Subtitle text, typically the UPI ID or additional merchant info
|
|
19
|
+
*/
|
|
20
|
+
subtitle?: string
|
|
21
|
+
/**
|
|
22
|
+
* Mode configuration passed to the token resolver.
|
|
23
|
+
* Also passed to the Avatar child component for consistent theming.
|
|
24
|
+
*/
|
|
25
|
+
modes?: Record<string, any>
|
|
26
|
+
/**
|
|
27
|
+
* Optional style overrides for the container
|
|
28
|
+
*/
|
|
29
|
+
style?: StyleProp<ViewStyle>
|
|
30
|
+
/**
|
|
31
|
+
* Props to pass to the Avatar component
|
|
32
|
+
*/
|
|
33
|
+
avatarProps?: Partial<AvatarProps>
|
|
34
|
+
/**
|
|
35
|
+
* Accessibility label for the merchant profile region
|
|
36
|
+
*/
|
|
37
|
+
accessibilityLabel?: string
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* MerchantProfile component that displays a merchant's identity.
|
|
42
|
+
*
|
|
43
|
+
* This component shows a centered profile layout with:
|
|
44
|
+
* - A circular avatar image
|
|
45
|
+
* - A title (merchant name)
|
|
46
|
+
* - A subtitle (typically UPI ID)
|
|
47
|
+
*
|
|
48
|
+
* All styling values are resolved from Figma design tokens using the provided modes.
|
|
49
|
+
*
|
|
50
|
+
* @component
|
|
51
|
+
* @param {Object} props - Component props
|
|
52
|
+
* @param {string} [props.title="Uber India Systems Private Limited"] - The merchant's display name
|
|
53
|
+
* @param {string} [props.subtitle="UPI ID: uberindia@ybl"] - Subtitle text, typically the UPI ID
|
|
54
|
+
* @param {Object} [props.modes={}] - Mode configuration for design tokens
|
|
55
|
+
* @param {Object} [props.style] - Optional style overrides for the container
|
|
56
|
+
* @param {Object} [props.avatarProps] - Props to pass to the Avatar component
|
|
57
|
+
* @param {string} [props.accessibilityLabel] - Accessibility label for the region
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* // Basic usage
|
|
62
|
+
* <MerchantProfile
|
|
63
|
+
* title="Uber India Systems Private Limited"
|
|
64
|
+
* subtitle="UPI ID: uberindia@ybl"
|
|
65
|
+
* modes={{}}
|
|
66
|
+
* />
|
|
67
|
+
*
|
|
68
|
+
* // With custom avatar
|
|
69
|
+
* <MerchantProfile
|
|
70
|
+
* title="Amazon Pay"
|
|
71
|
+
* subtitle="UPI ID: amazonpay@apl"
|
|
72
|
+
* avatarProps={{ imageSource: 'https://example.com/logo.png' }}
|
|
73
|
+
* />
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
function MerchantProfile({
|
|
77
|
+
title = 'Uber India Systems Private Limited',
|
|
78
|
+
subtitle = 'UPI ID: uberindia@ybl',
|
|
79
|
+
modes = {},
|
|
80
|
+
style,
|
|
81
|
+
avatarProps,
|
|
82
|
+
accessibilityLabel,
|
|
83
|
+
}: MerchantProfileProps) {
|
|
84
|
+
// Resolve design tokens with fallback values matching Figma design
|
|
85
|
+
const gap = getVariableByName('merchantProfile/gap', modes) ?? 12
|
|
86
|
+
const paddingHorizontal = getVariableByName('merchantProfile/padding/horizontal', modes) ?? 16
|
|
87
|
+
|
|
88
|
+
// Title typography tokens
|
|
89
|
+
const titleColor = getVariableByName('merchantProfile/title/color', modes) ?? '#0c0d10'
|
|
90
|
+
const titleFontSize = getVariableByName('merchantProfile/title/fontSize', modes) ?? 16
|
|
91
|
+
const titleLineHeight = getVariableByName('merchantProfile/title/lineHeight', modes) ?? 18
|
|
92
|
+
const titleFontFamily = getVariableByName('merchantProfile/title/fontFamily', modes) ?? 'System'
|
|
93
|
+
const titleFontWeightRaw = getVariableByName('merchantProfile/title/fontWeight', modes) ?? 700
|
|
94
|
+
const titleFontWeight = typeof titleFontWeightRaw === 'number'
|
|
95
|
+
? titleFontWeightRaw.toString()
|
|
96
|
+
: titleFontWeightRaw
|
|
97
|
+
|
|
98
|
+
// Subtitle typography tokens
|
|
99
|
+
const subtitleColor = getVariableByName('merchantProfile/subtitle/color', modes) ?? '#191b1e'
|
|
100
|
+
const subtitleFontSize = getVariableByName('merchantProfile/subtitle/fontSize', modes) ?? 12
|
|
101
|
+
const subtitleLineHeight = getVariableByName('merchantProfile/subtitle/lineHeight', modes) ?? 16
|
|
102
|
+
const subtitleFontFamily = getVariableByName('merchantProfile/subtitle/fontFamily', modes) ?? 'System'
|
|
103
|
+
const subtitleFontWeightRaw = getVariableByName('merchantProfile/subtitle/fontWeight', modes) ?? 500
|
|
104
|
+
const subtitleFontWeight = typeof subtitleFontWeightRaw === 'number'
|
|
105
|
+
? subtitleFontWeightRaw.toString()
|
|
106
|
+
: subtitleFontWeightRaw
|
|
107
|
+
|
|
108
|
+
// Container style
|
|
109
|
+
const containerStyle: ViewStyle = {
|
|
110
|
+
alignItems: 'center',
|
|
111
|
+
paddingHorizontal,
|
|
112
|
+
gap,
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Title text style
|
|
116
|
+
const titleTextStyle: TextStyle = {
|
|
117
|
+
color: titleColor,
|
|
118
|
+
fontSize: titleFontSize,
|
|
119
|
+
lineHeight: titleLineHeight,
|
|
120
|
+
fontFamily: titleFontFamily,
|
|
121
|
+
fontWeight: titleFontWeight as TextStyle['fontWeight'],
|
|
122
|
+
textAlign: 'center',
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Subtitle text style
|
|
126
|
+
const subtitleTextStyle: TextStyle = {
|
|
127
|
+
color: subtitleColor,
|
|
128
|
+
fontSize: subtitleFontSize,
|
|
129
|
+
lineHeight: subtitleLineHeight,
|
|
130
|
+
fontFamily: subtitleFontFamily,
|
|
131
|
+
fontWeight: subtitleFontWeight as TextStyle['fontWeight'],
|
|
132
|
+
textAlign: 'center',
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Default accessibility label
|
|
136
|
+
const defaultAccessibilityLabel = accessibilityLabel ||
|
|
137
|
+
`Merchant profile for ${title}${subtitle ? `, ${subtitle}` : ''}`
|
|
138
|
+
|
|
139
|
+
// Avatar modes - use provided modes to ensure consistent theming
|
|
140
|
+
// Override to use a larger avatar size for the merchant profile
|
|
141
|
+
const avatarModes = {
|
|
142
|
+
...modes,
|
|
143
|
+
...(avatarProps?.modes || {}),
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<View
|
|
148
|
+
style={[containerStyle, style]}
|
|
149
|
+
accessibilityRole="header"
|
|
150
|
+
accessibilityLabel={defaultAccessibilityLabel}
|
|
151
|
+
>
|
|
152
|
+
<Avatar
|
|
153
|
+
style="Image"
|
|
154
|
+
modes={avatarModes}
|
|
155
|
+
{...avatarProps}
|
|
156
|
+
/>
|
|
157
|
+
<Text
|
|
158
|
+
style={titleTextStyle}
|
|
159
|
+
accessibilityRole="text"
|
|
160
|
+
>
|
|
161
|
+
{title}
|
|
162
|
+
</Text>
|
|
163
|
+
<Text
|
|
164
|
+
style={subtitleTextStyle}
|
|
165
|
+
accessibilityRole="text"
|
|
166
|
+
>
|
|
167
|
+
{subtitle}
|
|
168
|
+
</Text>
|
|
169
|
+
</View>
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export default MerchantProfile
|
|
174
|
+
|
|
@@ -16,6 +16,10 @@ This component uses the following design token collections. Each collection supp
|
|
|
16
16
|
### Color Mode
|
|
17
17
|
- **Modes:** Light | Dark
|
|
18
18
|
- **Default:** Light
|
|
19
|
+
|
|
20
|
+
### Context3
|
|
21
|
+
- **Modes:** Default | Transaction Bubble
|
|
22
|
+
- **Default:** Default
|
|
19
23
|
## Usage
|
|
20
24
|
|
|
21
25
|
<Canvas>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { Meta, Story, Canvas, PureArgsTable as ArgsTable } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as NavArrowStories from './NavArrow.stories';
|
|
3
|
+
import NavArrow from './NavArrow';
|
|
4
|
+
|
|
5
|
+
<Meta of={NavArrowStories} />
|
|
6
|
+
|
|
7
|
+
# NavArrow
|
|
8
|
+
|
|
9
|
+
A small navigation arrow component that displays a chevron for Back or Forward navigation. Commonly used in navigation headers, list items, or anywhere directional navigation cues are needed.
|
|
10
|
+
|
|
11
|
+
## Available Collections and Modes
|
|
12
|
+
|
|
13
|
+
This component uses the following design token collections. Each collection supports multiple modes that can be configured via the `modes` prop.
|
|
14
|
+
|
|
15
|
+
### Color Mode
|
|
16
|
+
- **Modes:** Light | Dark
|
|
17
|
+
- **Default:** Light
|
|
18
|
+
|
|
19
|
+
### Context2
|
|
20
|
+
- **Modes:** Default | AppBar
|
|
21
|
+
- **Default:** Default
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### Basic Usage
|
|
25
|
+
|
|
26
|
+
<Canvas>
|
|
27
|
+
<Story of={NavArrowStories.Default} />
|
|
28
|
+
</Canvas>
|
|
29
|
+
|
|
30
|
+
### Direction Variants
|
|
31
|
+
|
|
32
|
+
The NavArrow supports two directions:
|
|
33
|
+
|
|
34
|
+
- **Back** — Left-pointing chevron (‹) for backward navigation
|
|
35
|
+
- **Forward** — Right-pointing chevron (›) for forward navigation
|
|
36
|
+
|
|
37
|
+
<Canvas>
|
|
38
|
+
<Story of={NavArrowStories.AllDirections} />
|
|
39
|
+
</Canvas>
|
|
40
|
+
|
|
41
|
+
### Usage Examples
|
|
42
|
+
|
|
43
|
+
```jsx
|
|
44
|
+
import { NavArrow } from 'jfs-components';
|
|
45
|
+
|
|
46
|
+
// Basic back arrow
|
|
47
|
+
<NavArrow direction="Back" />
|
|
48
|
+
|
|
49
|
+
// Forward arrow
|
|
50
|
+
<NavArrow direction="Forward" />
|
|
51
|
+
|
|
52
|
+
// With custom modes (for theming)
|
|
53
|
+
<NavArrow direction="Back" modes={{ 'Color Mode': 'Dark' }} />
|
|
54
|
+
|
|
55
|
+
// With accessibility label
|
|
56
|
+
<NavArrow
|
|
57
|
+
direction="Back"
|
|
58
|
+
accessibilityLabel="Navigate to previous screen"
|
|
59
|
+
/>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Usage in a Header
|
|
63
|
+
|
|
64
|
+
```jsx
|
|
65
|
+
import { View, Text, Pressable } from 'react-native';
|
|
66
|
+
import { NavArrow } from 'jfs-components';
|
|
67
|
+
|
|
68
|
+
function Header({ title, onBack }) {
|
|
69
|
+
return (
|
|
70
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', padding: 16 }}>
|
|
71
|
+
<Pressable onPress={onBack} style={{ padding: 8 }}>
|
|
72
|
+
<NavArrow direction="Back" />
|
|
73
|
+
</Pressable>
|
|
74
|
+
<Text style={{ marginLeft: 8, fontSize: 18, fontWeight: '600' }}>
|
|
75
|
+
{title}
|
|
76
|
+
</Text>
|
|
77
|
+
</View>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Usage in a List Item
|
|
83
|
+
|
|
84
|
+
```jsx
|
|
85
|
+
import { View, Text, Pressable } from 'react-native';
|
|
86
|
+
import { NavArrow } from 'jfs-components';
|
|
87
|
+
|
|
88
|
+
function NavigableListItem({ label, onPress }) {
|
|
89
|
+
return (
|
|
90
|
+
<Pressable
|
|
91
|
+
onPress={onPress}
|
|
92
|
+
style={{
|
|
93
|
+
flexDirection: 'row',
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
justifyContent: 'space-between',
|
|
96
|
+
padding: 16
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
<Text>{label}</Text>
|
|
100
|
+
<NavArrow direction="Forward" />
|
|
101
|
+
</Pressable>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Props
|
|
107
|
+
|
|
108
|
+
<ArgsTable of={NavArrow} />
|
|
109
|
+
|
|
110
|
+
## Design Tokens
|
|
111
|
+
|
|
112
|
+
This component uses the following design tokens, resolved through `getVariableByName`:
|
|
113
|
+
|
|
114
|
+
- **`navArrow/background`**
|
|
115
|
+
- **`navArrow/height`**
|
|
116
|
+
- **`navArrow/icon/color`**
|
|
117
|
+
- **`navArrow/icon/height`**
|
|
118
|
+
- **`navArrow/icon/strokeWeight`**
|
|
119
|
+
- **`navArrow/icon/width`**
|
|
120
|
+
- **`navArrow/radius`**
|
|
121
|
+
- **`navArrow/width`**
|
|
122
|
+
|
|
123
|
+
All tokens support mode-based theming through the `modes` prop.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { View, type ViewStyle } from 'react-native'
|
|
3
|
+
import Svg, { Path } from 'react-native-svg'
|
|
4
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
|
|
5
|
+
|
|
6
|
+
type NavArrowDirection = 'Back' | 'Forward'
|
|
7
|
+
|
|
8
|
+
type NavArrowProps = {
|
|
9
|
+
/** Direction of the arrow: 'Back' (left chevron) or 'Forward' (right chevron) */
|
|
10
|
+
direction?: NavArrowDirection
|
|
11
|
+
/** Modes used to resolve design tokens */
|
|
12
|
+
modes?: Record<string, any>
|
|
13
|
+
/** Optional additional container style */
|
|
14
|
+
style?: ViewStyle
|
|
15
|
+
/** Accessibility label for the arrow */
|
|
16
|
+
accessibilityLabel?: string
|
|
17
|
+
} & Omit<React.ComponentProps<typeof View>, 'style' | 'accessibilityLabel'>
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* NavArrow component that displays a small chevron arrow for navigation.
|
|
21
|
+
*
|
|
22
|
+
* This component uses design tokens for all visual properties:
|
|
23
|
+
* - navArrow/icon/color - chevron stroke color
|
|
24
|
+
* - navArrow/icon/width - icon width
|
|
25
|
+
* - navArrow/icon/height - icon height
|
|
26
|
+
* - navArrow/icon/strokeWeight - stroke width
|
|
27
|
+
* - navArrow/width - container width
|
|
28
|
+
* - navArrow/height - container height
|
|
29
|
+
* - navArrow/radius - border radius
|
|
30
|
+
* - navArrow/background - background color
|
|
31
|
+
*
|
|
32
|
+
* @component
|
|
33
|
+
* @param {Object} props
|
|
34
|
+
* @param {'Back'|'Forward'} [props.direction='Back'] - Arrow direction
|
|
35
|
+
* @param {Object} [props.modes={}] - Modes for design token resolution
|
|
36
|
+
* @param {Object} [props.style] - Additional container styles
|
|
37
|
+
*/
|
|
38
|
+
function NavArrow({
|
|
39
|
+
direction = 'Back',
|
|
40
|
+
modes = {},
|
|
41
|
+
style,
|
|
42
|
+
accessibilityLabel,
|
|
43
|
+
...rest
|
|
44
|
+
}: NavArrowProps) {
|
|
45
|
+
// Resolve design tokens
|
|
46
|
+
const iconColor =
|
|
47
|
+
(getVariableByName('navArrow/icon/color', modes) as string) || '#24262b'
|
|
48
|
+
const iconWidth =
|
|
49
|
+
Number(getVariableByName('navArrow/icon/width', modes)) || 4
|
|
50
|
+
const iconHeight =
|
|
51
|
+
Number(getVariableByName('navArrow/icon/height', modes)) || 8
|
|
52
|
+
const strokeWeight =
|
|
53
|
+
Number(getVariableByName('navArrow/icon/strokeWeight', modes)) || 2
|
|
54
|
+
const containerWidth =
|
|
55
|
+
Number(getVariableByName('navArrow/width', modes)) || 6
|
|
56
|
+
const containerHeight =
|
|
57
|
+
Number(getVariableByName('navArrow/height', modes)) || 10
|
|
58
|
+
const borderRadius =
|
|
59
|
+
Number(getVariableByName('navArrow/radius', modes)) || 0
|
|
60
|
+
const backgroundColor =
|
|
61
|
+
(getVariableByName('navArrow/background', modes) as string) || 'transparent'
|
|
62
|
+
|
|
63
|
+
const containerStyle: ViewStyle = {
|
|
64
|
+
width: containerWidth,
|
|
65
|
+
height: containerHeight,
|
|
66
|
+
borderRadius,
|
|
67
|
+
backgroundColor,
|
|
68
|
+
alignItems: 'center',
|
|
69
|
+
justifyContent: 'center',
|
|
70
|
+
...(style || {}),
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const defaultAccessibilityLabel =
|
|
74
|
+
accessibilityLabel || (direction === 'Back' ? 'Go back' : 'Go forward')
|
|
75
|
+
|
|
76
|
+
// SVG path for chevron - draws a simple ">" shape
|
|
77
|
+
// For Back direction, we flip horizontally with scaleX(-1)
|
|
78
|
+
// The path creates a chevron pointing right by default
|
|
79
|
+
const chevronPath = `M1 1L${iconWidth - 1} ${iconHeight / 2}L1 ${iconHeight - 1}`
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<View
|
|
83
|
+
style={containerStyle}
|
|
84
|
+
accessibilityRole="image"
|
|
85
|
+
accessibilityLabel={defaultAccessibilityLabel}
|
|
86
|
+
{...rest}
|
|
87
|
+
>
|
|
88
|
+
<Svg
|
|
89
|
+
width={iconWidth}
|
|
90
|
+
height={iconHeight}
|
|
91
|
+
viewBox={`0 0 ${iconWidth} ${iconHeight}`}
|
|
92
|
+
style={direction === 'Back' ? { transform: [{ scaleX: -1 }] } : undefined}
|
|
93
|
+
>
|
|
94
|
+
<Path
|
|
95
|
+
d={chevronPath}
|
|
96
|
+
stroke={iconColor}
|
|
97
|
+
strokeWidth={strokeWeight}
|
|
98
|
+
strokeLinecap="round"
|
|
99
|
+
strokeLinejoin="round"
|
|
100
|
+
fill="none"
|
|
101
|
+
/>
|
|
102
|
+
</Svg>
|
|
103
|
+
</View>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export default NavArrow
|
|
108
|
+
|
|
@@ -13,6 +13,10 @@ Section component that mirrors the Figma "Section" component.
|
|
|
13
13
|
|
|
14
14
|
This component uses the following design token collections. Each collection supports multiple modes that can be configured via the `modes` prop.
|
|
15
15
|
|
|
16
|
+
### Color Mode
|
|
17
|
+
- **Modes:** Light | Dark
|
|
18
|
+
- **Default:** Light
|
|
19
|
+
|
|
16
20
|
### Padding
|
|
17
21
|
- **Modes:** Default | None
|
|
18
22
|
- **Default:** Default
|
|
@@ -20,10 +24,6 @@ This component uses the following design token collections. Each collection supp
|
|
|
20
24
|
### Appearance.Brand
|
|
21
25
|
- **Modes:** Primary | Secondary | Neutral
|
|
22
26
|
- **Default:** Primary
|
|
23
|
-
|
|
24
|
-
### Color Mode
|
|
25
|
-
- **Modes:** Light | Dark
|
|
26
|
-
- **Default:** Light
|
|
27
27
|
## Usage
|
|
28
28
|
|
|
29
29
|
<Canvas>
|
|
@@ -12,7 +12,7 @@ A component representing a single step within a Stepper process. It displays an
|
|
|
12
12
|
|
|
13
13
|
This component uses the following design token collections. Each collection supports multiple modes that can be configured via the `modes` prop.
|
|
14
14
|
|
|
15
|
-
### Status
|
|
15
|
+
### Step Status
|
|
16
16
|
- **Modes:** active | inactive | complete | error | warning
|
|
17
17
|
- **Default:** active
|
|
18
18
|
|
package/src/components/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { default as ActionFooter, type ActionFooterProps } from './ActionFooter/ActionFooter';
|
|
1
2
|
export { default as AppBar } from './AppBar/AppBar';
|
|
2
3
|
export { default as Avatar, type AvatarProps } from './Avatar/Avatar';
|
|
3
4
|
export { default as AvatarGroup } from './AvatarGroup/AvatarGroup';
|
|
@@ -8,6 +9,7 @@ export { default as Button, type ButtonProps } from './Button/Button';
|
|
|
8
9
|
export { default as Card } from './Card/Card';
|
|
9
10
|
export { default as CardFeedback } from './CardFeedback/CardFeedback';
|
|
10
11
|
export { default as Disclaimer } from './Disclaimer/Disclaimer';
|
|
12
|
+
export { default as Divider, type DividerProps, type DividerDirection } from './Divider/Divider';
|
|
11
13
|
export { default as Drawer } from './Drawer/Drawer';
|
|
12
14
|
export { default as FilterBar } from './FilterBar/FilterBar';
|
|
13
15
|
export { default as IconButton } from './IconButton/IconButton';
|
|
@@ -16,7 +18,9 @@ export { default as LazyList } from './LazyList/LazyList';
|
|
|
16
18
|
export { default as ListGroup } from './ListGroup/ListGroup';
|
|
17
19
|
export { default as ListItem } from './ListItem/ListItem';
|
|
18
20
|
export { default as MediaCard } from './MediaCard/MediaCard';
|
|
21
|
+
export { default as MerchantProfile, type MerchantProfileProps } from './MerchantProfile/MerchantProfile';
|
|
19
22
|
export { default as MoneyValue } from './MoneyValue/MoneyValue';
|
|
23
|
+
export { default as NavArrow } from './NavArrow/NavArrow';
|
|
20
24
|
export { default as PageTitle } from './PageTitle/PageTitle';
|
|
21
25
|
export { default as Section } from './Section/Section';
|
|
22
26
|
export { default as Stepper } from './Stepper/Stepper';
|