jfs-components 0.0.3 → 0.0.4
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/Accordion/Accordion.js +217 -0
- package/lib/commonjs/components/Accordion/Accordion.js.map +1 -0
- package/lib/commonjs/components/Accordion/Accordion.mdx +122 -0
- package/lib/commonjs/components/ActionTile/ActionTile.js +93 -0
- package/lib/commonjs/components/ActionTile/ActionTile.js.map +1 -0
- package/lib/commonjs/components/ActionTile/ActionTile.mdx +54 -0
- package/lib/commonjs/components/ActionTile/index.js +14 -0
- package/lib/commonjs/components/ActionTile/index.js.map +1 -0
- package/lib/commonjs/components/CtaCard/CtaCard.js +122 -0
- package/lib/commonjs/components/CtaCard/CtaCard.js.map +1 -0
- package/lib/commonjs/components/CtaCard/CtaCard.mdx +66 -0
- package/lib/commonjs/components/CtaCard/index.js +14 -0
- package/lib/commonjs/components/CtaCard/index.js.map +1 -0
- package/lib/commonjs/components/ThreadHero/ThreadHero.js +114 -0
- package/lib/commonjs/components/ThreadHero/ThreadHero.js.map +1 -0
- package/lib/commonjs/components/ThreadHero/ThreadHero.mdx +69 -0
- package/lib/commonjs/components/TransactionBubble/TransactionBubble.js +101 -0
- package/lib/commonjs/components/TransactionBubble/TransactionBubble.js.map +1 -0
- package/lib/commonjs/components/TransactionBubble/TransactionBubble.mdx +40 -0
- package/lib/commonjs/components/TransactionDetails/TransactionDetails.js +177 -0
- package/lib/commonjs/components/TransactionDetails/TransactionDetails.js.map +1 -0
- package/lib/commonjs/components/TransactionDetails/TransactionDetails.mdx +98 -0
- package/lib/commonjs/components/TransactionStatus/TransactionStatus.js +82 -0
- package/lib/commonjs/components/TransactionStatus/TransactionStatus.js.map +1 -0
- package/lib/commonjs/components/TransactionStatus/TransactionStatus.mdx +41 -0
- package/lib/commonjs/components/index.js +35 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/design-tokens/figma-variables-resolver.js +3 -9
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/module/components/Accordion/Accordion.js +212 -0
- package/lib/module/components/Accordion/Accordion.js.map +1 -0
- package/lib/module/components/Accordion/Accordion.mdx +122 -0
- package/lib/module/components/ActionTile/ActionTile.js +88 -0
- package/lib/module/components/ActionTile/ActionTile.js.map +1 -0
- package/lib/module/components/ActionTile/ActionTile.mdx +54 -0
- package/lib/module/components/ActionTile/index.js +4 -0
- package/lib/module/components/ActionTile/index.js.map +1 -0
- package/lib/module/components/CtaCard/CtaCard.js +117 -0
- package/lib/module/components/CtaCard/CtaCard.js.map +1 -0
- package/lib/module/components/CtaCard/CtaCard.mdx +66 -0
- package/lib/module/components/CtaCard/index.js +4 -0
- package/lib/module/components/CtaCard/index.js.map +1 -0
- package/lib/module/components/ThreadHero/ThreadHero.js +109 -0
- package/lib/module/components/ThreadHero/ThreadHero.js.map +1 -0
- package/lib/module/components/ThreadHero/ThreadHero.mdx +69 -0
- package/lib/module/components/TransactionBubble/TransactionBubble.js +96 -0
- package/lib/module/components/TransactionBubble/TransactionBubble.js.map +1 -0
- package/lib/module/components/TransactionBubble/TransactionBubble.mdx +40 -0
- package/lib/module/components/TransactionDetails/TransactionDetails.js +174 -0
- package/lib/module/components/TransactionDetails/TransactionDetails.js.map +1 -0
- package/lib/module/components/TransactionDetails/TransactionDetails.mdx +98 -0
- package/lib/module/components/TransactionStatus/TransactionStatus.js +77 -0
- package/lib/module/components/TransactionStatus/TransactionStatus.js.map +1 -0
- package/lib/module/components/TransactionStatus/TransactionStatus.mdx +41 -0
- package/lib/module/components/index.js +5 -0
- package/lib/module/components/index.js.map +1 -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/Accordion/Accordion.d.ts +58 -0
- package/lib/typescript/components/Accordion/Accordion.d.ts.map +1 -0
- package/lib/typescript/components/ActionTile/ActionTile.d.ts +26 -0
- package/lib/typescript/components/ActionTile/ActionTile.d.ts.map +1 -0
- package/lib/typescript/components/ActionTile/index.d.ts +2 -0
- package/lib/typescript/components/ActionTile/index.d.ts.map +1 -0
- package/lib/typescript/components/CtaCard/CtaCard.d.ts +61 -0
- package/lib/typescript/components/CtaCard/CtaCard.d.ts.map +1 -0
- package/lib/typescript/components/CtaCard/index.d.ts +2 -0
- package/lib/typescript/components/CtaCard/index.d.ts.map +1 -0
- package/lib/typescript/components/ThreadHero/ThreadHero.d.ts +21 -0
- package/lib/typescript/components/ThreadHero/ThreadHero.d.ts.map +1 -0
- package/lib/typescript/components/TransactionBubble/TransactionBubble.d.ts +24 -0
- package/lib/typescript/components/TransactionBubble/TransactionBubble.d.ts.map +1 -0
- package/lib/typescript/components/TransactionDetails/TransactionDetails.d.ts +57 -0
- package/lib/typescript/components/TransactionDetails/TransactionDetails.d.ts.map +1 -0
- package/lib/typescript/components/TransactionStatus/TransactionStatus.d.ts +16 -0
- package/lib/typescript/components/TransactionStatus/TransactionStatus.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +5 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/icons/registry.d.ts +1 -1
- package/package.json +5 -2
- package/src/components/.token-metadata.json +161 -0
- package/src/components/Accordion/Accordion.mdx +122 -0
- package/src/components/Accordion/Accordion.tsx +279 -0
- package/src/components/ActionTile/ActionTile.mdx +54 -0
- package/src/components/ActionTile/ActionTile.tsx +100 -0
- package/src/components/ActionTile/index.ts +1 -0
- package/src/components/CtaCard/CtaCard.mdx +66 -0
- package/src/components/CtaCard/CtaCard.tsx +185 -0
- package/src/components/CtaCard/index.ts +1 -0
- package/src/components/ThreadHero/ThreadHero.mdx +69 -0
- package/src/components/ThreadHero/ThreadHero.tsx +124 -0
- package/src/components/TransactionBubble/TransactionBubble.mdx +40 -0
- package/src/components/TransactionBubble/TransactionBubble.tsx +113 -0
- package/src/components/TransactionDetails/TransactionDetails.mdx +98 -0
- package/src/components/TransactionDetails/TransactionDetails.tsx +236 -0
- package/src/components/TransactionStatus/TransactionStatus.mdx +41 -0
- package/src/components/TransactionStatus/TransactionStatus.tsx +94 -0
- package/src/components/index.ts +5 -0
- package/src/icons/registry.ts +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Meta, Story, Canvas, PureArgsTable as ArgsTable } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as CtaCardStories from './CtaCard.stories';
|
|
3
|
+
import CtaCard from './CtaCard';
|
|
4
|
+
|
|
5
|
+
<Meta of={CtaCardStories} />
|
|
6
|
+
|
|
7
|
+
# CtaCard
|
|
8
|
+
|
|
9
|
+
`CtaCard` is a component used to display a Call-to-Action with an icon, title, body text, and a button.
|
|
10
|
+
It is designed to be flexible, allowing content to be passed via props or fully customized via slots.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Available Collections and Modes
|
|
14
|
+
|
|
15
|
+
This component does not use any design token collections with multiple modes.
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { CtaCard } from 'jfs-components'; // Adjust import based on your package structure
|
|
20
|
+
|
|
21
|
+
// Basic Usage
|
|
22
|
+
<CtaCard
|
|
23
|
+
title="Lets create your UPI ID"
|
|
24
|
+
body="Send and receive money securely."
|
|
25
|
+
iconName="ic_upi_number"
|
|
26
|
+
buttonLabel="Get started"
|
|
27
|
+
onPressButton={() => console.log('Pressed')}
|
|
28
|
+
/>
|
|
29
|
+
|
|
30
|
+
// Using Slots
|
|
31
|
+
<CtaCard
|
|
32
|
+
titleSlot={<CustomTitle />}
|
|
33
|
+
buttonSlot={<CustomButton />}
|
|
34
|
+
/>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
<Canvas>
|
|
38
|
+
<Story of={CtaCardStories.Default} />
|
|
39
|
+
</Canvas>
|
|
40
|
+
|
|
41
|
+
## Props
|
|
42
|
+
|
|
43
|
+
<ArgsTable of={CtaCard} />
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## Design Tokens
|
|
47
|
+
|
|
48
|
+
This component uses the following design tokens, resolved through `getVariableByName`:
|
|
49
|
+
|
|
50
|
+
- **`ctaCard/background`**
|
|
51
|
+
- **`ctaCard/body/color`**
|
|
52
|
+
- **`ctaCard/body/fontFamily`**
|
|
53
|
+
- **`ctaCard/body/fontSize`**
|
|
54
|
+
- **`ctaCard/body/lineHeight`**
|
|
55
|
+
- **`ctaCard/content/gap`**
|
|
56
|
+
- **`ctaCard/gap`**
|
|
57
|
+
- **`ctaCard/padding/horizontal`**
|
|
58
|
+
- **`ctaCard/padding/vertical`**
|
|
59
|
+
- **`ctaCard/radius`**
|
|
60
|
+
- **`ctaCard/title/color`**
|
|
61
|
+
- **`ctaCard/title/fontFamily`**
|
|
62
|
+
- **`ctaCard/title/fontSize`**
|
|
63
|
+
- **`ctaCard/title/lineHeight`**
|
|
64
|
+
|
|
65
|
+
All tokens support mode-based theming through the `modes` prop.
|
|
66
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default"],"sourceRoot":"../../../../src","sources":["components/CtaCard/index.ts"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { isValidElement, cloneElement } from 'react';
|
|
4
|
+
import { View, Text } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
/**
|
|
8
|
+
* ThreadHero component displaying a central identity with avatar, title, subtitle, and caption.
|
|
9
|
+
*/
|
|
10
|
+
export default function ThreadHero({
|
|
11
|
+
title = 'Subhash Rajan',
|
|
12
|
+
subtitle = 'Banking name: SHIVASHANKAR RAJAN',
|
|
13
|
+
caption,
|
|
14
|
+
renderAvatar,
|
|
15
|
+
modes = {},
|
|
16
|
+
style
|
|
17
|
+
}) {
|
|
18
|
+
// Container Gaps
|
|
19
|
+
const containerGap = Number(getVariableByName('threadHero/gap', modes)) || 8;
|
|
20
|
+
const detailsGap = Number(getVariableByName('threadHero/details/gap', modes)) || 2;
|
|
21
|
+
|
|
22
|
+
// Title Styles
|
|
23
|
+
const titleColor = getVariableByName('threadHero/title/color', modes) || '#191b1e';
|
|
24
|
+
const titleFontSize = Number(getVariableByName('threadHero/title/fontSize', modes)) || 16;
|
|
25
|
+
const titleFontFamily = getVariableByName('threadHero/title/fontFamily', modes) || 'System';
|
|
26
|
+
const titleLineHeight = Number(getVariableByName('threadHero/title/lineHeight', modes)) || 20;
|
|
27
|
+
const titleFontWeight = getVariableByName('threadHero/title/fontWeight', modes) || '600';
|
|
28
|
+
|
|
29
|
+
// Subtitle Styles
|
|
30
|
+
const subtitleColor = getVariableByName('threadHero/subtitle/color', modes) || '#5d5d61';
|
|
31
|
+
const subtitleFontSize = Number(getVariableByName('threadHero/subtitle/fontSize', modes)) || 12;
|
|
32
|
+
const subtitleFontFamily = getVariableByName('threadHero/subtitle/fontFamily', modes) || 'System';
|
|
33
|
+
const subtitleLineHeight = Number(getVariableByName('threadHero/subtitle/lineHeight', modes)) || 18;
|
|
34
|
+
const subtitleFontWeight = getVariableByName('threadHero/subtitle/fontWeight', modes) || '500';
|
|
35
|
+
|
|
36
|
+
// Caption Styles
|
|
37
|
+
const captionColor = getVariableByName('threadHero/caption/color', modes) || '#5d5d61';
|
|
38
|
+
const captionFontSize = Number(getVariableByName('threadHero/caption/fontSize', modes)) || 12;
|
|
39
|
+
const captionFontFamily = getVariableByName('threadHero/caption/fontFamily', modes) || 'System';
|
|
40
|
+
const captionLineHeight = Number(getVariableByName('threadHero/caption/lineHeight', modes)) || 18;
|
|
41
|
+
const captionFontWeight = getVariableByName('threadHero/caption/fontWeight', modes) || '500';
|
|
42
|
+
|
|
43
|
+
// Styles
|
|
44
|
+
const containerStyle = {
|
|
45
|
+
flexDirection: 'column',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
gap: containerGap,
|
|
48
|
+
...style
|
|
49
|
+
};
|
|
50
|
+
const detailsStyle = {
|
|
51
|
+
flexDirection: 'column',
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
gap: detailsGap,
|
|
54
|
+
width: '100%'
|
|
55
|
+
};
|
|
56
|
+
const titleStyle = {
|
|
57
|
+
color: titleColor,
|
|
58
|
+
fontSize: titleFontSize,
|
|
59
|
+
fontFamily: titleFontFamily,
|
|
60
|
+
lineHeight: titleLineHeight,
|
|
61
|
+
fontWeight: titleFontWeight,
|
|
62
|
+
textAlign: 'center',
|
|
63
|
+
minWidth: '100%'
|
|
64
|
+
};
|
|
65
|
+
const subtitleStyle = {
|
|
66
|
+
color: subtitleColor,
|
|
67
|
+
fontSize: subtitleFontSize,
|
|
68
|
+
fontFamily: subtitleFontFamily,
|
|
69
|
+
lineHeight: subtitleLineHeight,
|
|
70
|
+
fontWeight: subtitleFontWeight,
|
|
71
|
+
textAlign: 'center',
|
|
72
|
+
minWidth: '100%'
|
|
73
|
+
};
|
|
74
|
+
const captionStyle = {
|
|
75
|
+
color: captionColor,
|
|
76
|
+
fontSize: captionFontSize,
|
|
77
|
+
fontFamily: captionFontFamily,
|
|
78
|
+
lineHeight: captionLineHeight,
|
|
79
|
+
fontWeight: captionFontWeight,
|
|
80
|
+
textAlign: 'center',
|
|
81
|
+
width: '100%'
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// Process Avatar Slot to inject modes
|
|
85
|
+
const avatarContent = /*#__PURE__*/isValidElement(renderAvatar) ? /*#__PURE__*/cloneElement(renderAvatar, {
|
|
86
|
+
modes
|
|
87
|
+
}) : renderAvatar;
|
|
88
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
89
|
+
style: containerStyle,
|
|
90
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
91
|
+
style: detailsStyle,
|
|
92
|
+
children: [avatarContent, title ? /*#__PURE__*/_jsx(Text, {
|
|
93
|
+
style: titleStyle,
|
|
94
|
+
children: title
|
|
95
|
+
}) : null, subtitle ? /*#__PURE__*/_jsx(Text, {
|
|
96
|
+
style: subtitleStyle,
|
|
97
|
+
numberOfLines: 1,
|
|
98
|
+
ellipsizeMode: "tail",
|
|
99
|
+
children: subtitle
|
|
100
|
+
}) : null]
|
|
101
|
+
}), caption ? /*#__PURE__*/_jsx(Text, {
|
|
102
|
+
style: captionStyle,
|
|
103
|
+
numberOfLines: 1,
|
|
104
|
+
ellipsizeMode: "tail",
|
|
105
|
+
children: caption
|
|
106
|
+
}) : null]
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=ThreadHero.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","isValidElement","cloneElement","View","Text","getVariableByName","jsx","_jsx","jsxs","_jsxs","ThreadHero","title","subtitle","caption","renderAvatar","modes","style","containerGap","Number","detailsGap","titleColor","titleFontSize","titleFontFamily","titleLineHeight","titleFontWeight","subtitleColor","subtitleFontSize","subtitleFontFamily","subtitleLineHeight","subtitleFontWeight","captionColor","captionFontSize","captionFontFamily","captionLineHeight","captionFontWeight","containerStyle","flexDirection","alignItems","gap","detailsStyle","width","titleStyle","color","fontSize","fontFamily","lineHeight","fontWeight","textAlign","minWidth","subtitleStyle","captionStyle","avatarContent","children","numberOfLines","ellipsizeMode"],"sourceRoot":"../../../../src","sources":["components/ThreadHero/ThreadHero.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,cAAc,EAAEC,YAAY,QAAwB,OAAO;AAC3E,SAASC,IAAI,EAAEC,IAAI,QAAwC,cAAc;AACzE,SAASC,iBAAiB,QAAQ,8CAA8C;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAiBhF;AACA;AACA;AACA,eAAe,SAASC,UAAUA,CAAC;EAC/BC,KAAK,GAAG,eAAe;EACvBC,QAAQ,GAAG,kCAAkC;EAC7CC,OAAO;E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Q,EAAEZ,eAAe;IACzBa,UAAU,EAAEZ,iBAAiB;IAC7Ba,UAAU,EAAEZ,iBAAiB;IAC7Ba,UAAU,EAAEZ,iBAAwB;IACpCa,SAAS,EAAE,QAAQ;IACnBP,KAAK,EAAE;EACX,CAAC;;EAED;EACA,MAAMW,aAAa,GAAG,aAAAlD,cAAc,CAACa,YAAY,CAAC,gBAC5CZ,YAAY,CAACY,YAAY,EAA6B;IAAEC;EAAM,CAAC,CAAC,GAChED,YAAY;EAElB,oBACIL,KAAA,CAACN,IAAI;IAACa,KAAK,EAAEmB,cAAe;IAAAiB,QAAA,gBACxB3C,KAAA,CAACN,IAAI;MAACa,KAAK,EAAEuB,YAAa;MAAAa,QAAA,GACrBD,aAAa,EACbxC,KAAK,gBAAGJ,IAAA,CAACH,IAAI;QAACY,KAAK,EAAEyB,UAAW;QAAAW,QAAA,EAAEzC;MAAK,CAAO,CAAC,GAAG,IAAI,EACtDC,QAAQ,gBACLL,IAAA,CAACH,IAAI;QAACY,KAAK,EAAEiC,aAAc;QAACI,aAAa,EAAE,CAAE;QAACC,aAAa,EAAC,MAAM;QAAAF,QAAA,EAC7DxC;MAAQ,CACP,CAAC,GACP,IAAI;IAAA,CACN,CAAC,EACNC,OAAO,gBACJN,IAAA,CAACH,IAAI;MAACY,KAAK,EAAEkC,YAAa;MAACG,aAAa,EAAE,CAAE;MAACC,aAAa,EAAC,MAAM;MAAAF,QAAA,EAC5DvC;IAAO,CACN,CAAC,GACP,IAAI;EAAA,CACN,CAAC;AAEf","ignoreList":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Meta, Story, Canvas, PureArgsTable as ArgsTable } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as ThreadHeroStories from './ThreadHero.stories';
|
|
3
|
+
import ThreadHero from './ThreadHero';
|
|
4
|
+
|
|
5
|
+
<Meta of={ThreadHeroStories} />
|
|
6
|
+
|
|
7
|
+
# ThreadHero
|
|
8
|
+
|
|
9
|
+
The `ThreadHero` component displays a central user identity with an avatar, title, subtitle, and an optional caption.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Available Collections and Modes
|
|
13
|
+
|
|
14
|
+
This component does not use any design token collections with multiple modes.
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import ThreadHero from './ThreadHero';
|
|
19
|
+
import Avatar from '../Avatar/Avatar';
|
|
20
|
+
|
|
21
|
+
<ThreadHero
|
|
22
|
+
title="Subhash Rajan"
|
|
23
|
+
subtitle="Banking name: SHIVASHANKAR RAJAN"
|
|
24
|
+
caption="+91 00000 00000"
|
|
25
|
+
renderAvatar={<Avatar size="small" initials="SR" />}
|
|
26
|
+
/>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Props
|
|
30
|
+
|
|
31
|
+
<ArgsTable of={ThreadHero} />
|
|
32
|
+
|
|
33
|
+
## Stories
|
|
34
|
+
|
|
35
|
+
### Default
|
|
36
|
+
|
|
37
|
+
<Canvas>
|
|
38
|
+
<Story of={ThreadHeroStories.Default} />
|
|
39
|
+
</Canvas>
|
|
40
|
+
|
|
41
|
+
### Without Caption
|
|
42
|
+
|
|
43
|
+
<Canvas>
|
|
44
|
+
<Story of={ThreadHeroStories.WithoutCaption} />
|
|
45
|
+
</Canvas>
|
|
46
|
+
|
|
47
|
+
## Design Tokens
|
|
48
|
+
|
|
49
|
+
This component uses the following design tokens, resolved through `getVariableByName`:
|
|
50
|
+
|
|
51
|
+
- **`threadHero/caption/color`**
|
|
52
|
+
- **`threadHero/caption/fontFamily`**
|
|
53
|
+
- **`threadHero/caption/fontSize`**
|
|
54
|
+
- **`threadHero/caption/fontWeight`**
|
|
55
|
+
- **`threadHero/caption/lineHeight`**
|
|
56
|
+
- **`threadHero/details/gap`**
|
|
57
|
+
- **`threadHero/gap`**
|
|
58
|
+
- **`threadHero/subtitle/color`**
|
|
59
|
+
- **`threadHero/subtitle/fontFamily`**
|
|
60
|
+
- **`threadHero/subtitle/fontSize`**
|
|
61
|
+
- **`threadHero/subtitle/fontWeight`**
|
|
62
|
+
- **`threadHero/subtitle/lineHeight`**
|
|
63
|
+
- **`threadHero/title/color`**
|
|
64
|
+
- **`threadHero/title/fontFamily`**
|
|
65
|
+
- **`threadHero/title/fontSize`**
|
|
66
|
+
- **`threadHero/title/fontWeight`**
|
|
67
|
+
- **`threadHero/title/lineHeight`**
|
|
68
|
+
|
|
69
|
+
All tokens support mode-based theming through the `modes` prop.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, Text } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
import MoneyValue from '../MoneyValue/MoneyValue';
|
|
7
|
+
import NavArrow from '../NavArrow/NavArrow';
|
|
8
|
+
import TransactionStatus from '../TransactionStatus/TransactionStatus';
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
/**
|
|
11
|
+
* TransactionBubble component displaying transaction details in a bubble card.
|
|
12
|
+
*
|
|
13
|
+
* @component
|
|
14
|
+
*/
|
|
15
|
+
export default function TransactionBubble({
|
|
16
|
+
description = 'Payment to Uber India',
|
|
17
|
+
amount = '56',
|
|
18
|
+
currency = '₹',
|
|
19
|
+
status = 'Expired',
|
|
20
|
+
statusDate = '20 Mar 2025',
|
|
21
|
+
modes = {},
|
|
22
|
+
style
|
|
23
|
+
}) {
|
|
24
|
+
// --- Container Tokens ---
|
|
25
|
+
const backgroundColor = getVariableByName('transactionBubble/background', modes) || '#ffffff';
|
|
26
|
+
const borderColor = getVariableByName('transactionBubble/border/color', modes) || '#e5e5e5';
|
|
27
|
+
const borderWidth = Number(getVariableByName('transactionBubble/border/size', modes)) || 1;
|
|
28
|
+
const borderRadius = Number(getVariableByName('transactionBubble/radius', modes)) || 23;
|
|
29
|
+
const padding = Number(getVariableByName('transactionBubble/padding', modes)) || 16;
|
|
30
|
+
const gap = Number(getVariableByName('transactionBubble/gap', modes)) || 8;
|
|
31
|
+
|
|
32
|
+
// --- Description Tokens ---
|
|
33
|
+
const descColor = getVariableByName('transactionBubble/description/color', modes) || '#24262b';
|
|
34
|
+
const descFontSize = Number(getVariableByName('transactionBubble/description/fontSize', modes)) || 14;
|
|
35
|
+
const descLineHeight = Number(getVariableByName('transactionBubble/description/lineHeight', modes)) || 17;
|
|
36
|
+
const descFontFamily = getVariableByName('transactionBubble/description/fontFamily', modes) || 'System';
|
|
37
|
+
|
|
38
|
+
// --- Status Row Tokens ---
|
|
39
|
+
// Status wrapping gap from TransactionBubble definition for the row container
|
|
40
|
+
const statusHeight = Number(getVariableByName('transactionBubble/statusWrap/height', modes)) || 18;
|
|
41
|
+
const containerStyle = {
|
|
42
|
+
backgroundColor,
|
|
43
|
+
borderColor,
|
|
44
|
+
borderWidth,
|
|
45
|
+
borderRadius,
|
|
46
|
+
padding,
|
|
47
|
+
gap,
|
|
48
|
+
alignItems: 'flex-start',
|
|
49
|
+
width: 231,
|
|
50
|
+
// Fixed width from design or prop? Design shows w-[231px]. We can make it auto or fixed. Let's respect style prop.
|
|
51
|
+
...style
|
|
52
|
+
};
|
|
53
|
+
const descriptionStyle = {
|
|
54
|
+
color: descColor,
|
|
55
|
+
fontSize: descFontSize,
|
|
56
|
+
lineHeight: descLineHeight,
|
|
57
|
+
fontFamily: descFontFamily,
|
|
58
|
+
fontWeight: '500' // Hardcoded in design as 'Medium' -> 500
|
|
59
|
+
};
|
|
60
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
61
|
+
style: containerStyle,
|
|
62
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
63
|
+
style: {
|
|
64
|
+
gap: 8,
|
|
65
|
+
width: '100%'
|
|
66
|
+
},
|
|
67
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
68
|
+
style: descriptionStyle,
|
|
69
|
+
numberOfLines: 1,
|
|
70
|
+
ellipsizeMode: "tail",
|
|
71
|
+
children: description
|
|
72
|
+
}), /*#__PURE__*/_jsx(MoneyValue, {
|
|
73
|
+
value: amount,
|
|
74
|
+
currency: currency,
|
|
75
|
+
modes: modes
|
|
76
|
+
})]
|
|
77
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
78
|
+
style: {
|
|
79
|
+
flexDirection: 'row',
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
justifyContent: 'space-between',
|
|
82
|
+
width: '100%',
|
|
83
|
+
height: statusHeight // Enforce height from design
|
|
84
|
+
},
|
|
85
|
+
children: [/*#__PURE__*/_jsx(TransactionStatus, {
|
|
86
|
+
status: status,
|
|
87
|
+
date: statusDate,
|
|
88
|
+
modes: modes
|
|
89
|
+
}), /*#__PURE__*/_jsx(NavArrow, {
|
|
90
|
+
direction: "Forward",
|
|
91
|
+
modes: modes
|
|
92
|
+
})]
|
|
93
|
+
})]
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=TransactionBubble.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","Text","getVariableByName","MoneyValue","NavArrow","TransactionStatus","jsx","_jsx","jsxs","_jsxs","TransactionBubble","description","amount","currency","status","statusDate","modes","style","backgroundColor","borderColor","borderWidth","Number","borderRadius","padding","gap","descColor","descFontSize","descLineHeight","descFontFamily","statusHeight","containerStyle","alignItems","width","descriptionStyle","color","fontSize","lineHeight","fontFamily","fontWeight","children","numberOfLines","ellipsizeMode","value","flexDirection","justifyContent","height","date","direction"],"sourceRoot":"../../../../src","sources":["components/TransactionBubble/TransactionBubble.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,QAAwC,cAAc;AACzE,SAASC,iBAAiB,QAAQ,8CAA8C;AAChF,OAAOC,UAAU,MAAM,0BAA0B;AACjD,OAAOC,QAAQ,MAAM,sBAAsB;AAC3C,OAAOC,iBAAiB,MAAM,wCA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AI,EAAE/B,UAAW;QACjBC,KAAK,EAAEA;MAAM,CAChB,CAAC,eAEFT,IAAA,CAACH,QAAQ;QACL2C,SAAS,EAAC,SAAS;QACnB/B,KAAK,EAAEA;MAAM,CAChB,CAAC;IAAA,CACA,CAAC;EAAA,CACL,CAAC;AAEf","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Meta, Story, Canvas, PureArgsTable as ArgsTable } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as TransactionBubbleStories from './TransactionBubble.stories';
|
|
3
|
+
import TransactionBubble from './TransactionBubble';
|
|
4
|
+
|
|
5
|
+
<Meta of={TransactionBubbleStories} />
|
|
6
|
+
|
|
7
|
+
# TransactionBubble
|
|
8
|
+
|
|
9
|
+
TransactionBubble component with design-token-driven styling.
|
|
10
|
+
|
|
11
|
+
## Available Collections and Modes
|
|
12
|
+
|
|
13
|
+
This component does not use any design token collections with multiple modes.
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
<Canvas>
|
|
17
|
+
<Story of={TransactionBubbleStories.Default} />
|
|
18
|
+
</Canvas>
|
|
19
|
+
|
|
20
|
+
## Props
|
|
21
|
+
|
|
22
|
+
<ArgsTable of={TransactionBubble} />
|
|
23
|
+
|
|
24
|
+
## Design Tokens
|
|
25
|
+
|
|
26
|
+
This component uses the following design tokens, resolved through `getVariableByName`:
|
|
27
|
+
|
|
28
|
+
- **`transactionBubble/background`**
|
|
29
|
+
- **`transactionBubble/border/color`**
|
|
30
|
+
- **`transactionBubble/border/size`**
|
|
31
|
+
- **`transactionBubble/description/color`**
|
|
32
|
+
- **`transactionBubble/description/fontFamily`**
|
|
33
|
+
- **`transactionBubble/description/fontSize`**
|
|
34
|
+
- **`transactionBubble/description/lineHeight`**
|
|
35
|
+
- **`transactionBubble/gap`**
|
|
36
|
+
- **`transactionBubble/padding`**
|
|
37
|
+
- **`transactionBubble/radius`**
|
|
38
|
+
- **`transactionBubble/statusWrap/height`**
|
|
39
|
+
|
|
40
|
+
All tokens support mode-based theming through the `modes` prop.
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, Text } from 'react-native';
|
|
5
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Helper function to recursively clone children and pass modes prop to components that accept it.
|
|
9
|
+
*/
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
function cloneChildrenWithModes(children, modes) {
|
|
12
|
+
const result = React.Children.map(children, child => {
|
|
13
|
+
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
14
|
+
return child;
|
|
15
|
+
}
|
|
16
|
+
const childChildren = child.props?.children;
|
|
17
|
+
const hasChildren = childChildren !== undefined && childChildren !== null;
|
|
18
|
+
const existingModes = child.props?.modes;
|
|
19
|
+
const mergedModes = existingModes ? {
|
|
20
|
+
...modes,
|
|
21
|
+
...existingModes
|
|
22
|
+
} : modes;
|
|
23
|
+
const processedChildren = hasChildren ? cloneChildrenWithModes(React.Children.toArray(childChildren), modes) : undefined;
|
|
24
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
25
|
+
...child.props,
|
|
26
|
+
modes: mergedModes
|
|
27
|
+
}, processedChildren);
|
|
28
|
+
});
|
|
29
|
+
return result || [];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// ===== Item Subcomponent =====
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Item component that displays a label-value pair, used within TransactionDetails.
|
|
36
|
+
* Access via `TransactionDetails.Item`.
|
|
37
|
+
*
|
|
38
|
+
* @component
|
|
39
|
+
* @param {Object} props
|
|
40
|
+
* @param {string} [props.label='Label'] - The label text displayed above the value.
|
|
41
|
+
* @param {string} [props.value='Value'] - The value text displayed below the label.
|
|
42
|
+
* @param {Object} [props.modes={}] - Modes object passed to `getVariableByName` for design tokens.
|
|
43
|
+
* @param {Object} [props.style] - Optional container style overrides.
|
|
44
|
+
* @param {Object} [props.labelStyle] - Optional label text style overrides.
|
|
45
|
+
* @param {Object} [props.valueStyle] - Optional value text style overrides.
|
|
46
|
+
* @param {string} [props.accessibilityLabel] - Accessibility label for screen readers.
|
|
47
|
+
*/
|
|
48
|
+
function Item({
|
|
49
|
+
label = 'Label',
|
|
50
|
+
value = 'Value',
|
|
51
|
+
modes = {},
|
|
52
|
+
style,
|
|
53
|
+
labelStyle,
|
|
54
|
+
valueStyle,
|
|
55
|
+
accessibilityLabel,
|
|
56
|
+
...rest
|
|
57
|
+
}) {
|
|
58
|
+
// Resolve design tokens for Item
|
|
59
|
+
const gap = getVariableByName('detailItem/gap', modes) ?? 4;
|
|
60
|
+
|
|
61
|
+
// Label typography tokens
|
|
62
|
+
const labelColor = getVariableByName('detailItem/label/color', modes) || '#0c0d10';
|
|
63
|
+
const labelFontSize = getVariableByName('detailItem/label/fontSize', modes) || 14;
|
|
64
|
+
const labelFontFamily = getVariableByName('detailItem/label/fontFamily', modes) || 'System';
|
|
65
|
+
const labelLineHeight = getVariableByName('detailItem/label/lineHeight', modes) || 17;
|
|
66
|
+
const labelFontWeightRaw = getVariableByName('detailItem/label/fontWeight', modes) || 500;
|
|
67
|
+
const labelFontWeight = typeof labelFontWeightRaw === 'number' ? labelFontWeightRaw.toString() : labelFontWeightRaw;
|
|
68
|
+
|
|
69
|
+
// Value typography tokens
|
|
70
|
+
const valueColor = getVariableByName('detailItem/value/color', modes) || '#24262b';
|
|
71
|
+
const valueFontSize = getVariableByName('detailItem/value/fontSize', modes) || 14;
|
|
72
|
+
const valueFontFamily = getVariableByName('detailItem/value/fontFamily', modes) || 'System';
|
|
73
|
+
const valueLineHeight = getVariableByName('detailItem/value/lineHeight', modes) || 17;
|
|
74
|
+
const valueFontWeightRaw = getVariableByName('detailItem/value/fontWeight', modes) || 'Medium';
|
|
75
|
+
const valueFontWeight = typeof valueFontWeightRaw === 'number' ? valueFontWeightRaw.toString() : valueFontWeightRaw === 'Medium' ? '500' : valueFontWeightRaw;
|
|
76
|
+
const containerStyle = {
|
|
77
|
+
flexDirection: 'column',
|
|
78
|
+
alignItems: 'flex-start',
|
|
79
|
+
justifyContent: 'center',
|
|
80
|
+
gap
|
|
81
|
+
};
|
|
82
|
+
const labelTextStyle = {
|
|
83
|
+
color: labelColor,
|
|
84
|
+
fontSize: labelFontSize,
|
|
85
|
+
fontFamily: labelFontFamily,
|
|
86
|
+
lineHeight: labelLineHeight,
|
|
87
|
+
fontWeight: labelFontWeight
|
|
88
|
+
};
|
|
89
|
+
const valueTextStyle = {
|
|
90
|
+
color: valueColor,
|
|
91
|
+
fontSize: valueFontSize,
|
|
92
|
+
fontFamily: valueFontFamily,
|
|
93
|
+
lineHeight: valueLineHeight,
|
|
94
|
+
fontWeight: valueFontWeight
|
|
95
|
+
};
|
|
96
|
+
const defaultAccessibilityLabel = accessibilityLabel || `${label}: ${value}`;
|
|
97
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
98
|
+
style: [containerStyle, style],
|
|
99
|
+
accessibilityRole: "text",
|
|
100
|
+
accessibilityLabel: defaultAccessibilityLabel,
|
|
101
|
+
...rest,
|
|
102
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
103
|
+
style: [labelTextStyle, labelStyle],
|
|
104
|
+
accessibilityElementsHidden: true,
|
|
105
|
+
importantForAccessibility: "no",
|
|
106
|
+
children: label
|
|
107
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
108
|
+
style: [valueTextStyle, valueStyle],
|
|
109
|
+
accessibilityElementsHidden: true,
|
|
110
|
+
importantForAccessibility: "no",
|
|
111
|
+
children: value
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// ===== TransactionDetails Component =====
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* TransactionDetails component that displays a list of transaction detail items.
|
|
120
|
+
*
|
|
121
|
+
* This component serves as a container for TransactionDetails.Item children, applying consistent
|
|
122
|
+
* spacing and padding as defined by Figma design tokens.
|
|
123
|
+
*
|
|
124
|
+
* @component
|
|
125
|
+
* @param {Object} props
|
|
126
|
+
* @param {React.ReactNode} [props.children] - TransactionDetails.Item children to render.
|
|
127
|
+
* @param {Object} [props.modes={}] - Modes object passed to `getVariableByName` for design tokens.
|
|
128
|
+
* @param {Object} [props.style] - Optional container style overrides.
|
|
129
|
+
* @param {string} [props.accessibilityLabel] - Accessibility label for screen readers.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```tsx
|
|
133
|
+
* <TransactionDetails modes={{ 'Color Mode': 'Light' }}>
|
|
134
|
+
* <TransactionDetails.Item label="UPI transaction ID" value="101674916166" />
|
|
135
|
+
* <TransactionDetails.Item label="From" value="JioFinance • shivashankar@okjio" />
|
|
136
|
+
* <TransactionDetails.Item label="To" value="JioFinance • shivashankar@okjio" />
|
|
137
|
+
* <TransactionDetails.Item label="Payment method" value="UPI" />
|
|
138
|
+
* </TransactionDetails>
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
function TransactionDetails({
|
|
142
|
+
children,
|
|
143
|
+
modes = {},
|
|
144
|
+
style,
|
|
145
|
+
accessibilityLabel,
|
|
146
|
+
...rest
|
|
147
|
+
}) {
|
|
148
|
+
// Resolve design tokens for TransactionDetails
|
|
149
|
+
const gap = getVariableByName('transationDetails/gap', modes) ?? 16;
|
|
150
|
+
const paddingHorizontal = getVariableByName('transationDetails/padding/horizontal', modes) ?? 0;
|
|
151
|
+
const paddingVertical = getVariableByName('transationDetails/padding/vertical', modes) ?? 0;
|
|
152
|
+
const containerStyle = {
|
|
153
|
+
flexDirection: 'column',
|
|
154
|
+
alignItems: 'flex-start',
|
|
155
|
+
gap,
|
|
156
|
+
paddingHorizontal,
|
|
157
|
+
paddingVertical
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// Process children to pass modes prop
|
|
161
|
+
const processedChildren = children ? cloneChildrenWithModes(React.Children.toArray(children), modes) : null;
|
|
162
|
+
return /*#__PURE__*/_jsx(View, {
|
|
163
|
+
style: [containerStyle, style],
|
|
164
|
+
accessibilityRole: "summary",
|
|
165
|
+
accessibilityLabel: accessibilityLabel || 'Transaction details',
|
|
166
|
+
...rest,
|
|
167
|
+
children: processedChildren
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Attach Item as a static property for compound component pattern
|
|
172
|
+
TransactionDetails.Item = Item;
|
|
173
|
+
export default TransactionDetails;
|
|
174
|
+
//# sourceMappingURL=TransactionDetails.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","Text","getVariableByName","jsx","_jsx","jsxs","_jsxs","cloneChildrenWithModes","children","modes","result","Children","map","child","isValidElement","childChildren","props","hasChildren","undefined","existingModes","mergedModes","processedChildren","toArray","cloneElement","Item","label","value","style","labelStyle","valueStyle","accessibilityLabel","rest","gap","labelColor","labelFontSize","labelFontFamily","labelLineHeight","labelFontWeightRaw","labelFontWeight","toString","valueColor","valueFontSize","valueFontFamily","valueLineHeight","valueFontWeightRaw","valueFontWeight","containerStyle","flexDirection","alignItems","justifyContent","labelTextStyle","color","fontSize","fontFamily","lineHeight","fontWeight","valueTextStyle","defaultAccessibilityLabel","accessibilityRole","accessibilityElementsHidden","importantForAccessibility","TransactionDetails","paddingHorizontal","paddingVertical"],"sourceRoot":"../../../../src","sources":["components/TransactionDetails/TransactionDetails.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,QAAwD,cAAc;AACzF,SAASC,iBAAiB,QAAQ,8CAA8C;;AAEhF;AACA;AACA;AAFA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGA,SAASC,sBAAsBA,CAC7BC,QAAyB,EACzBC,KAA0B,EACP;EACnB,MAAMC,MAAM,GAAGX,KAAK,CAACY,QAAQ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