jfs-components 0.0.21 → 0.0.25
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/assets/fonts/JioType Var.ttf +0 -0
- package/lib/commonjs/components/Accordion/Accordion.js +1 -1
- package/lib/commonjs/components/Accordion/Accordion.js.map +1 -1
- package/lib/commonjs/components/ActionFooter/ActionFooter.js +2 -2
- package/lib/commonjs/components/ActionFooter/ActionFooter.js.map +1 -1
- package/lib/commonjs/components/AppBar/AppBar.js +2 -2
- package/lib/commonjs/components/AppBar/AppBar.js.map +1 -1
- package/lib/commonjs/components/Avatar/Avatar.js +2 -2
- package/lib/commonjs/components/Avatar/Avatar.js.map +1 -1
- package/lib/commonjs/components/Badge/Badge.js +1 -1
- package/lib/commonjs/components/Badge/Badge.js.map +1 -1
- package/lib/commonjs/components/BottomNav/BottomNav.js +2 -2
- package/lib/commonjs/components/BottomNav/BottomNav.js.map +1 -1
- package/lib/commonjs/components/BottomNavItem/BottomNavItem.js +2 -2
- package/lib/commonjs/components/BottomNavItem/BottomNavItem.js.map +1 -1
- package/lib/commonjs/components/Button/Button.js +1 -1
- package/lib/commonjs/components/Button/Button.js.map +1 -1
- package/lib/commonjs/components/Carousel/Carousel.js +341 -0
- package/lib/commonjs/components/Carousel/Carousel.js.map +1 -0
- package/lib/commonjs/components/Carousel/Carousel.mdx +154 -0
- package/lib/commonjs/components/Disclaimer/Disclaimer.js +1 -1
- package/lib/commonjs/components/Disclaimer/Disclaimer.js.map +1 -1
- package/lib/commonjs/components/Divider/Divider.js +2 -2
- package/lib/commonjs/components/Divider/Divider.js.map +1 -1
- package/lib/commonjs/components/Drawer/Drawer.js +10 -3
- package/lib/commonjs/components/Drawer/Drawer.js.map +1 -1
- package/lib/commonjs/components/FilterBar/FilterBar.js +2 -2
- package/lib/commonjs/components/FilterBar/FilterBar.js.map +1 -1
- package/lib/commonjs/components/IconButton/IconButton.js +2 -2
- package/lib/commonjs/components/IconButton/IconButton.js.map +1 -1
- package/lib/commonjs/components/IconCapsule/IconCapsule.js +2 -2
- package/lib/commonjs/components/IconCapsule/IconCapsule.js.map +1 -1
- package/lib/commonjs/components/LazyList/LazyList.js +2 -2
- package/lib/commonjs/components/LazyList/LazyList.js.map +1 -1
- package/lib/commonjs/components/ListGroup/ListGroup.js +1 -1
- package/lib/commonjs/components/ListGroup/ListGroup.js.map +1 -1
- package/lib/commonjs/components/ListItem/ListItem.js +5 -5
- package/lib/commonjs/components/ListItem/ListItem.js.map +1 -1
- package/lib/commonjs/components/MerchantProfile/MerchantProfile.js +1 -1
- package/lib/commonjs/components/MerchantProfile/MerchantProfile.js.map +1 -1
- package/lib/commonjs/components/MoneyValue/MoneyValue.js +1 -1
- package/lib/commonjs/components/MoneyValue/MoneyValue.js.map +1 -1
- package/lib/commonjs/components/NavArrow/NavArrow.js +1 -1
- package/lib/commonjs/components/NavArrow/NavArrow.js.map +1 -1
- package/lib/commonjs/components/PageTitle/PageTitle.js +1 -1
- package/lib/commonjs/components/PageTitle/PageTitle.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButton.js +194 -0
- package/lib/commonjs/components/RadioButton/RadioButton.js.map +1 -0
- package/lib/commonjs/components/RadioButton/RadioButton.mdx +92 -0
- package/lib/commonjs/components/Section/Section.js +4 -4
- package/lib/commonjs/components/Section/Section.js.map +1 -1
- package/lib/commonjs/components/TextInput/TextInput.js +1 -1
- package/lib/commonjs/components/TextInput/TextInput.js.map +1 -1
- package/lib/commonjs/components/TransactionDetails/TransactionDetails.js +2 -2
- package/lib/commonjs/components/TransactionDetails/TransactionDetails.js.map +1 -1
- package/lib/commonjs/components/UpiHandle/UpiHandle.js +4 -2
- package/lib/commonjs/components/UpiHandle/UpiHandle.js.map +1 -1
- package/lib/commonjs/components/index.js +7 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/design-tokens/figma-variables-resolver.js +9 -3
- package/lib/commonjs/design-tokens/figma-variables-resolver.js.map +2 -1
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/module/assets/fonts/JioType Var.ttf +0 -0
- package/lib/module/components/Accordion/Accordion.js +1 -1
- package/lib/module/components/Accordion/Accordion.js.map +1 -1
- package/lib/module/components/ActionFooter/ActionFooter.js +2 -2
- package/lib/module/components/ActionFooter/ActionFooter.js.map +1 -1
- package/lib/module/components/AppBar/AppBar.js +2 -2
- package/lib/module/components/AppBar/AppBar.js.map +1 -1
- package/lib/module/components/Avatar/Avatar.js +2 -2
- package/lib/module/components/Avatar/Avatar.js.map +1 -1
- package/lib/module/components/Badge/Badge.js +1 -1
- package/lib/module/components/Badge/Badge.js.map +1 -1
- package/lib/module/components/BottomNav/BottomNav.js +2 -2
- package/lib/module/components/BottomNav/BottomNav.js.map +1 -1
- package/lib/module/components/BottomNavItem/BottomNavItem.js +2 -2
- package/lib/module/components/BottomNavItem/BottomNavItem.js.map +1 -1
- package/lib/module/components/Button/Button.js +1 -1
- package/lib/module/components/Button/Button.js.map +1 -1
- package/lib/module/components/Carousel/Carousel.js +333 -0
- package/lib/module/components/Carousel/Carousel.js.map +1 -0
- package/lib/module/components/Carousel/Carousel.mdx +154 -0
- package/lib/module/components/Disclaimer/Disclaimer.js +1 -1
- package/lib/module/components/Disclaimer/Disclaimer.js.map +1 -1
- package/lib/module/components/Divider/Divider.js +2 -2
- package/lib/module/components/Divider/Divider.js.map +1 -1
- package/lib/module/components/Drawer/Drawer.js +11 -4
- package/lib/module/components/Drawer/Drawer.js.map +1 -1
- package/lib/module/components/FilterBar/FilterBar.js +2 -2
- package/lib/module/components/FilterBar/FilterBar.js.map +1 -1
- package/lib/module/components/IconButton/IconButton.js +2 -2
- package/lib/module/components/IconButton/IconButton.js.map +1 -1
- package/lib/module/components/IconCapsule/IconCapsule.js +2 -2
- package/lib/module/components/IconCapsule/IconCapsule.js.map +1 -1
- package/lib/module/components/LazyList/LazyList.js +2 -2
- package/lib/module/components/LazyList/LazyList.js.map +1 -1
- package/lib/module/components/ListGroup/ListGroup.js +1 -1
- package/lib/module/components/ListGroup/ListGroup.js.map +1 -1
- package/lib/module/components/ListItem/ListItem.js +5 -5
- package/lib/module/components/ListItem/ListItem.js.map +1 -1
- package/lib/module/components/MerchantProfile/MerchantProfile.js +1 -1
- package/lib/module/components/MerchantProfile/MerchantProfile.js.map +1 -1
- package/lib/module/components/MoneyValue/MoneyValue.js +1 -1
- package/lib/module/components/MoneyValue/MoneyValue.js.map +1 -1
- package/lib/module/components/NavArrow/NavArrow.js +1 -1
- package/lib/module/components/NavArrow/NavArrow.js.map +1 -1
- package/lib/module/components/PageTitle/PageTitle.js +1 -1
- package/lib/module/components/PageTitle/PageTitle.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButton.js +188 -0
- package/lib/module/components/RadioButton/RadioButton.js.map +1 -0
- package/lib/module/components/RadioButton/RadioButton.mdx +92 -0
- package/lib/module/components/Section/Section.js +4 -4
- package/lib/module/components/Section/Section.js.map +1 -1
- package/lib/module/components/TextInput/TextInput.js +1 -1
- package/lib/module/components/TextInput/TextInput.js.map +1 -1
- package/lib/module/components/TransactionDetails/TransactionDetails.js +2 -2
- package/lib/module/components/TransactionDetails/TransactionDetails.js.map +1 -1
- package/lib/module/components/UpiHandle/UpiHandle.js +4 -2
- package/lib/module/components/UpiHandle/UpiHandle.js.map +1 -1
- package/lib/module/components/index.js +1 -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 +1 -2
- package/lib/module/icons/registry.js +1 -1
- package/lib/typescript/components/ActionFooter/ActionFooter.d.ts.map +1 -1
- package/lib/typescript/components/BottomNav/BottomNav.d.ts.map +1 -1
- package/lib/typescript/components/Carousel/Carousel.d.ts +48 -0
- package/lib/typescript/components/Carousel/Carousel.d.ts.map +1 -0
- package/lib/typescript/components/Drawer/Drawer.d.ts.map +1 -1
- package/lib/typescript/components/IconButton/IconButton.d.ts +1 -1
- package/lib/typescript/components/IconCapsule/IconCapsule.d.ts +1 -1
- package/lib/typescript/components/LazyList/LazyList.d.ts.map +1 -1
- package/lib/typescript/components/RadioButton/RadioButton.d.ts +30 -0
- package/lib/typescript/components/RadioButton/RadioButton.d.ts.map +1 -0
- package/lib/typescript/components/Section/Section.d.ts.map +1 -1
- package/lib/typescript/components/UpiHandle/UpiHandle.d.ts +4 -2
- package/lib/typescript/components/UpiHandle/UpiHandle.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +1 -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/assets/fonts/JioType Var.ttf +0 -0
- package/src/components/.token-metadata.json +72 -0
- package/src/components/Accordion/Accordion.tsx +1 -1
- package/src/components/ActionFooter/ActionFooter.tsx +2 -2
- package/src/components/AppBar/AppBar.tsx +2 -2
- package/src/components/Avatar/Avatar.tsx +2 -2
- package/src/components/Badge/Badge.tsx +1 -1
- package/src/components/BottomNav/BottomNav.tsx +2 -2
- package/src/components/BottomNavItem/BottomNavItem.tsx +2 -2
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Carousel/Carousel.mdx +154 -0
- package/src/components/Carousel/Carousel.tsx +472 -0
- package/src/components/Disclaimer/Disclaimer.tsx +1 -1
- package/src/components/Divider/Divider.tsx +2 -2
- package/src/components/Drawer/Drawer.tsx +11 -3
- package/src/components/FilterBar/FilterBar.tsx +2 -2
- package/src/components/IconButton/IconButton.tsx +2 -2
- package/src/components/IconCapsule/IconCapsule.tsx +2 -2
- package/src/components/LazyList/LazyList.tsx +2 -2
- package/src/components/ListGroup/ListGroup.tsx +1 -1
- package/src/components/ListItem/ListItem.tsx +5 -5
- package/src/components/MerchantProfile/MerchantProfile.tsx +1 -1
- package/src/components/MoneyValue/MoneyValue.tsx +1 -1
- package/src/components/NavArrow/NavArrow.tsx +1 -1
- package/src/components/PageTitle/PageTitle.tsx +1 -1
- package/src/components/RadioButton/RadioButton.mdx +92 -0
- package/src/components/RadioButton/RadioButton.tsx +226 -0
- package/src/components/Section/Section.tsx +4 -4
- package/src/components/TextInput/TextInput.tsx +1 -1
- package/src/components/TransactionDetails/TransactionDetails.tsx +2 -2
- package/src/components/UpiHandle/UpiHandle.tsx +6 -3
- package/src/components/index.ts +1 -0
- package/src/icons/registry.ts +1 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Canvas, Meta, Controls } from '@storybook/blocks';
|
|
2
|
+
import * as RadioButtonStories from './RadioButton.stories';
|
|
3
|
+
import { RadioButton } from './RadioButton';
|
|
4
|
+
|
|
5
|
+
<Meta of={RadioButtonStories} />
|
|
6
|
+
|
|
7
|
+
## Available Collections and Modes
|
|
8
|
+
|
|
9
|
+
This component uses the following design token collections. Each collection supports multiple modes that can be configured via the `modes` prop.
|
|
10
|
+
|
|
11
|
+
### Color Mode
|
|
12
|
+
- **Modes:** Light | Dark
|
|
13
|
+
- **Default:** Light
|
|
14
|
+
|
|
15
|
+
### Colors Router
|
|
16
|
+
- **Modes:** POC | Old
|
|
17
|
+
- **Default:** POC
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
# RadioButton
|
|
22
|
+
|
|
23
|
+
A standard RadioButton component. This component is used to select a single option from a set of options.
|
|
24
|
+
|
|
25
|
+
## Default
|
|
26
|
+
|
|
27
|
+
<Canvas of={RadioButtonStories.Default} />
|
|
28
|
+
|
|
29
|
+
<Controls of={RadioButtonStories.Default} />
|
|
30
|
+
|
|
31
|
+
## States
|
|
32
|
+
|
|
33
|
+
<Canvas of={RadioButtonStories.AllStates} />
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import React, { useState } from 'react';
|
|
38
|
+
import { RadioButton } from 'jfs-components';
|
|
39
|
+
import { View, Text } from 'react-native';
|
|
40
|
+
|
|
41
|
+
export default function App() {
|
|
42
|
+
const [selected, setSelected] = useState(false);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<RadioButton
|
|
46
|
+
selected={selected}
|
|
47
|
+
onPress={() => setSelected(!selected)}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## Design Tokens
|
|
55
|
+
|
|
56
|
+
This component uses the following design tokens, resolved through `getVariableByName`:
|
|
57
|
+
|
|
58
|
+
- **`radio/background/color`**
|
|
59
|
+
- **`radio/disabled/background/color`**
|
|
60
|
+
- **`radio/disabled/border/color`**
|
|
61
|
+
- **`radio/disabled/radio/disabled/border/size`**
|
|
62
|
+
- **`radio/disabledSelected/background`**
|
|
63
|
+
- **`radio/disabledSelected/border/color`**
|
|
64
|
+
- **`radio/disabledSelected/selector/background/color`**
|
|
65
|
+
- **`radio/focus/background/color`**
|
|
66
|
+
- **`radio/focus/border/color`**
|
|
67
|
+
- **`radio/focus/border/size`**
|
|
68
|
+
- **`radio/focus/boxShadow/size`**
|
|
69
|
+
- **`radio/focus/shadow/color`**
|
|
70
|
+
- **`radio/focusSelected/background/color`**
|
|
71
|
+
- **`radio/focusSelected/border/size`**
|
|
72
|
+
- **`radio/focusSelected/selector/background/color`**
|
|
73
|
+
- **`radio/height`**
|
|
74
|
+
- **`radio/hover/background/color`**
|
|
75
|
+
- **`radio/hover/border/color`**
|
|
76
|
+
- **`radio/hover/boxShadow/size`**
|
|
77
|
+
- **`radio/hover/shadow/color`**
|
|
78
|
+
- **`radio/hoverSelected/background/color`**
|
|
79
|
+
- **`radio/hoverSelected/border/color`**
|
|
80
|
+
- **`radio/hoverSelected/boxShadow/size`**
|
|
81
|
+
- **`radio/hoverSelected/selector/background/color`**
|
|
82
|
+
- **`radio/hoverSelected/shadow/color`**
|
|
83
|
+
- **`radio/idle/background/color`**
|
|
84
|
+
- **`radio/idle/border/color`**
|
|
85
|
+
- **`radio/selected/background/color`**
|
|
86
|
+
- **`radio/selected/border/color`**
|
|
87
|
+
- **`radio/selected/selector/background/color`**
|
|
88
|
+
- **`radio/selector/size`**
|
|
89
|
+
- **`radio/width`**
|
|
90
|
+
|
|
91
|
+
All tokens support mode-based theming through the `modes` prop.
|
|
92
|
+
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
Pressable,
|
|
4
|
+
View,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
Platform,
|
|
7
|
+
ViewStyle,
|
|
8
|
+
DimensionValue,
|
|
9
|
+
StyleProp,
|
|
10
|
+
} from 'react-native'
|
|
11
|
+
import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
|
|
12
|
+
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Props
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
export interface RadioButtonProps {
|
|
18
|
+
/**
|
|
19
|
+
* Whether the radio button is selected.
|
|
20
|
+
*/
|
|
21
|
+
selected?: boolean
|
|
22
|
+
/**
|
|
23
|
+
* Whether the radio button is disabled.
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean
|
|
26
|
+
/**
|
|
27
|
+
* Function to call when the radio button is pressed.
|
|
28
|
+
*/
|
|
29
|
+
onPress?: () => void
|
|
30
|
+
/**
|
|
31
|
+
* Modes object for design-token resolution.
|
|
32
|
+
*/
|
|
33
|
+
modes?: Record<string, any>
|
|
34
|
+
/**
|
|
35
|
+
* Custom style for the radio button container.
|
|
36
|
+
*/
|
|
37
|
+
style?: StyleProp<ViewStyle>
|
|
38
|
+
/**
|
|
39
|
+
* Test ID for testing.
|
|
40
|
+
*/
|
|
41
|
+
testID?: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// RadioButton
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
|
|
48
|
+
export function RadioButton({
|
|
49
|
+
selected = false,
|
|
50
|
+
disabled = false,
|
|
51
|
+
onPress,
|
|
52
|
+
modes = {},
|
|
53
|
+
style,
|
|
54
|
+
testID,
|
|
55
|
+
}: RadioButtonProps) {
|
|
56
|
+
// ---- Refs & State ----
|
|
57
|
+
const [hovered, setHovered] = useState(false)
|
|
58
|
+
const [focused, setFocused] = useState(false)
|
|
59
|
+
const [pressed, setPressed] = useState(false)
|
|
60
|
+
|
|
61
|
+
// ---- Dimensions ----
|
|
62
|
+
const widthStr = getVariableByName('radio/width', modes) || '18'
|
|
63
|
+
const heightStr = getVariableByName('radio/height', modes) || '18'
|
|
64
|
+
const selectorSizeStr = getVariableByName('radio/selector/size', modes) || '10'
|
|
65
|
+
|
|
66
|
+
const width = parseFloat(widthStr?.toString() || '18')
|
|
67
|
+
const height = parseFloat(heightStr?.toString() || '18')
|
|
68
|
+
const selectorSize = parseFloat(selectorSizeStr?.toString() || '10')
|
|
69
|
+
|
|
70
|
+
// ---- State Logic ----
|
|
71
|
+
// Priority: Disabled -> Focused -> Hover/Pressed -> Idle
|
|
72
|
+
// Note: Design treats Active (Pressed) similar to Selected for some styles,
|
|
73
|
+
// but usually in Radio Buttons, Pressed is a transient state.
|
|
74
|
+
// We will map:
|
|
75
|
+
// - Disabled -> 'disabled'
|
|
76
|
+
// - Focused -> 'focus'
|
|
77
|
+
// - Hovered -> 'hover'
|
|
78
|
+
// - Idle -> 'idle'
|
|
79
|
+
|
|
80
|
+
// We handle `selected` as a separate dimension derived from state.
|
|
81
|
+
|
|
82
|
+
let visualState = 'idle'
|
|
83
|
+
if (disabled) {
|
|
84
|
+
visualState = 'disabled'
|
|
85
|
+
} else if (focused) {
|
|
86
|
+
visualState = 'focus'
|
|
87
|
+
} else if (hovered || pressed) {
|
|
88
|
+
visualState = 'hover'
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Construct token paths based on state + selected
|
|
92
|
+
let prefix = `radio/${visualState}`
|
|
93
|
+
if (visualState === 'idle' && selected) {
|
|
94
|
+
prefix = `radio/selected`
|
|
95
|
+
} else if (selected) {
|
|
96
|
+
prefix = `radio/${visualState}Selected`
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// ---- Colors & Border ----
|
|
100
|
+
|
|
101
|
+
const resolveColor = (path: string, fallback: string) => {
|
|
102
|
+
return getVariableByName(path, modes) || fallback
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Background Color
|
|
106
|
+
let bgColorVar = `${prefix}/background/color`
|
|
107
|
+
// Fix for disabledSelected weirdness if needed
|
|
108
|
+
if (visualState === 'disabled' && selected) {
|
|
109
|
+
// Check specific path from dump: `radio/disabledSelected/background`
|
|
110
|
+
if (!getVariableByName(`${prefix}/background/color`, modes)) {
|
|
111
|
+
bgColorVar = `${prefix}/background`
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Border Color
|
|
116
|
+
let borderColorVar = `${prefix}/border/color`
|
|
117
|
+
|
|
118
|
+
// Border Width
|
|
119
|
+
let borderWidthVar = `${prefix}/border/size`
|
|
120
|
+
// Fix for huge path: `radio/disabled/radio/disabled/border/size`
|
|
121
|
+
if (visualState === 'disabled' && !selected) {
|
|
122
|
+
if (getVariableByName('radio/disabled/radio/disabled/border/size', modes)) {
|
|
123
|
+
borderWidthVar = 'radio/disabled/radio/disabled/border/size'
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Selector Color
|
|
128
|
+
let selectorBgVar = `${prefix}/selector/background/color`
|
|
129
|
+
if (!selected) {
|
|
130
|
+
selectorBgVar = 'transparent'
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Shadows (Glow)
|
|
134
|
+
let shadowSizeVar = `${prefix}/boxShadow/size`
|
|
135
|
+
let shadowColorVar = `${prefix}/shadow/color`
|
|
136
|
+
|
|
137
|
+
// Resolve Values
|
|
138
|
+
const backgroundColor = resolveColor(bgColorVar, 'transparent')
|
|
139
|
+
const borderColor = resolveColor(borderColorVar, 'transparent')
|
|
140
|
+
const borderWidth = parseFloat(getVariableByName(borderWidthVar, modes)?.toString() || '1')
|
|
141
|
+
const selectorColor = resolveColor(selectorBgVar, 'transparent')
|
|
142
|
+
|
|
143
|
+
const shadowSize = parseFloat(getVariableByName(shadowSizeVar, modes)?.toString() || '0')
|
|
144
|
+
const shadowColor = resolveColor(shadowColorVar, 'transparent')
|
|
145
|
+
|
|
146
|
+
// Styles
|
|
147
|
+
const containerStyle: any = {
|
|
148
|
+
width,
|
|
149
|
+
height,
|
|
150
|
+
borderRadius: width / 2, // 9999px -> circle
|
|
151
|
+
borderWidth,
|
|
152
|
+
borderColor,
|
|
153
|
+
backgroundColor,
|
|
154
|
+
justifyContent: 'center',
|
|
155
|
+
alignItems: 'center',
|
|
156
|
+
// Web shadow (ring)
|
|
157
|
+
...(Platform.OS === 'web' && shadowSize > 0 ? {
|
|
158
|
+
boxShadow: `0px 0px 0px ${shadowSize}px ${shadowColor}`,
|
|
159
|
+
} : {}),
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const selectorStyle: ViewStyle = {
|
|
163
|
+
width: selectorSize,
|
|
164
|
+
height: selectorSize,
|
|
165
|
+
borderRadius: selectorSize / 2,
|
|
166
|
+
backgroundColor: selectorColor,
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Dummy block for token extraction (static analysis)
|
|
170
|
+
if (false as boolean) {
|
|
171
|
+
getVariableByName('radio/idle/background/color')
|
|
172
|
+
getVariableByName('radio/idle/border/color')
|
|
173
|
+
getVariableByName('radio/selector/size')
|
|
174
|
+
getVariableByName('radio/width')
|
|
175
|
+
getVariableByName('radio/height')
|
|
176
|
+
getVariableByName('radio/background/color')
|
|
177
|
+
getVariableByName('radio/hover/background/color')
|
|
178
|
+
getVariableByName('radio/hover/border/color')
|
|
179
|
+
getVariableByName('radio/hover/boxShadow/size')
|
|
180
|
+
getVariableByName('radio/hover/shadow/color')
|
|
181
|
+
getVariableByName('radio/selected/background/color')
|
|
182
|
+
getVariableByName('radio/selected/border/color')
|
|
183
|
+
getVariableByName('radio/selected/selector/background/color')
|
|
184
|
+
getVariableByName('radio/hoverSelected/background/color')
|
|
185
|
+
getVariableByName('radio/hoverSelected/border/color')
|
|
186
|
+
getVariableByName('radio/hoverSelected/boxShadow/size')
|
|
187
|
+
getVariableByName('radio/hoverSelected/shadow/color')
|
|
188
|
+
getVariableByName('radio/hoverSelected/selector/background/color')
|
|
189
|
+
getVariableByName('radio/focus/background/color')
|
|
190
|
+
getVariableByName('radio/focus/border/color')
|
|
191
|
+
getVariableByName('radio/focus/border/size')
|
|
192
|
+
getVariableByName('radio/focus/boxShadow/size')
|
|
193
|
+
getVariableByName('radio/focus/shadow/color')
|
|
194
|
+
getVariableByName('radio/focusSelected/background/color')
|
|
195
|
+
getVariableByName('radio/focusSelected/selector/background/color')
|
|
196
|
+
getVariableByName('radio/focusSelected/border/size')
|
|
197
|
+
getVariableByName('radio/disabled/radio/disabled/border/size')
|
|
198
|
+
getVariableByName('radio/disabled/background/color')
|
|
199
|
+
getVariableByName('radio/disabled/border/color')
|
|
200
|
+
getVariableByName('radio/disabledSelected/selector/background/color')
|
|
201
|
+
getVariableByName('radio/disabledSelected/background')
|
|
202
|
+
getVariableByName('radio/disabledSelected/border/color')
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<Pressable
|
|
207
|
+
testID={testID}
|
|
208
|
+
disabled={disabled}
|
|
209
|
+
onPress={onPress}
|
|
210
|
+
onHoverIn={() => setHovered(true)}
|
|
211
|
+
onHoverOut={() => setHovered(false)}
|
|
212
|
+
onFocus={() => setFocused(true)}
|
|
213
|
+
onBlur={() => setFocused(false)}
|
|
214
|
+
onPressIn={() => setPressed(true)}
|
|
215
|
+
onPressOut={() => setPressed(false)}
|
|
216
|
+
style={({ pressed: isPressed }) => [
|
|
217
|
+
containerStyle,
|
|
218
|
+
style,
|
|
219
|
+
]}
|
|
220
|
+
>
|
|
221
|
+
<View style={selectorStyle} />
|
|
222
|
+
</Pressable>
|
|
223
|
+
)
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export default RadioButton
|
|
@@ -189,14 +189,14 @@ function Section({
|
|
|
189
189
|
<View
|
|
190
190
|
style={[containerStyle, style]}
|
|
191
191
|
accessibilityRole={'region' as any}
|
|
192
|
-
accessibilityLabel={
|
|
192
|
+
accessibilityLabel={undefined}
|
|
193
193
|
accessibilityHint={accessibilityHint}
|
|
194
194
|
{...rest}
|
|
195
195
|
>
|
|
196
196
|
{onPress ? (
|
|
197
197
|
<Pressable
|
|
198
198
|
accessibilityRole="button"
|
|
199
|
-
accessibilityLabel={
|
|
199
|
+
accessibilityLabel={undefined}
|
|
200
200
|
accessibilityHint={accessibilityHint || "Opens section details"}
|
|
201
201
|
onPress={onPress}
|
|
202
202
|
onPressIn={(e: any) => {
|
|
@@ -287,7 +287,7 @@ function SectionBento({
|
|
|
287
287
|
upiSlot,
|
|
288
288
|
modes = {},
|
|
289
289
|
style,
|
|
290
|
-
accessibilityLabel =
|
|
290
|
+
accessibilityLabel = undefined,
|
|
291
291
|
accessibilityHint,
|
|
292
292
|
...rest
|
|
293
293
|
}: SectionBentoProps) {
|
|
@@ -321,7 +321,7 @@ function SectionBento({
|
|
|
321
321
|
<View
|
|
322
322
|
style={[containerStyle, style]}
|
|
323
323
|
accessibilityRole={'region' as any}
|
|
324
|
-
accessibilityLabel={
|
|
324
|
+
accessibilityLabel={undefined}
|
|
325
325
|
accessibilityHint={accessibilityHint}
|
|
326
326
|
{...rest}
|
|
327
327
|
>
|
|
@@ -99,7 +99,7 @@ function Item({
|
|
|
99
99
|
<View
|
|
100
100
|
style={[containerStyle, style]}
|
|
101
101
|
accessibilityRole="text"
|
|
102
|
-
accessibilityLabel={
|
|
102
|
+
accessibilityLabel={undefined}
|
|
103
103
|
{...rest}
|
|
104
104
|
>
|
|
105
105
|
<Text
|
|
@@ -185,7 +185,7 @@ function TransactionDetails({
|
|
|
185
185
|
<View
|
|
186
186
|
style={[containerStyle, style]}
|
|
187
187
|
accessibilityRole="summary"
|
|
188
|
-
accessibilityLabel={
|
|
188
|
+
accessibilityLabel={undefined}
|
|
189
189
|
{...rest}
|
|
190
190
|
>
|
|
191
191
|
{processedChildren}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
-
import { Pressable, View, Text, Image, type ViewStyle, type TextStyle, type ImageStyle } from 'react-native'
|
|
2
|
+
import { Pressable, View, Text, Image, type ViewStyle, type TextStyle, type ImageStyle, type ImageSourcePropType } from 'react-native'
|
|
3
3
|
import { getVariableByName } from '../../design-tokens/figma-variables-resolver'
|
|
4
4
|
import { useTokens } from '../../design-tokens/JFSThemeProvider'
|
|
5
5
|
import Icon from '../../icons/Icon'
|
|
@@ -13,6 +13,7 @@ type UpiHandleProps = {
|
|
|
13
13
|
modes?: Record<string, any>;
|
|
14
14
|
showIcon?: boolean;
|
|
15
15
|
iconName?: string;
|
|
16
|
+
avatarSource?: ImageSourcePropType;
|
|
16
17
|
accessibilityLabel?: string;
|
|
17
18
|
accessibilityHint?: string;
|
|
18
19
|
onPress?: () => void;
|
|
@@ -36,6 +37,7 @@ type UpiHandleProps = {
|
|
|
36
37
|
* @param {Object} [props.modes={}] - Modes object passed directly to `getVariableByName`.
|
|
37
38
|
* @param {boolean} [props.showIcon=true] - Toggles the trailing icon visibility.
|
|
38
39
|
* @param {string} [props.iconName='ic_scan_qr_code'] - Icon name from the actions set (e.g. 'ic_qr_code', 'ic_scan_qr_code').
|
|
40
|
+
* @param {ImageSourcePropType} [props.avatarSource] - Optional custom image source for the avatar.
|
|
39
41
|
* @param {string} [props.accessibilityLabel] - Accessibility label for screen readers. If not provided, uses label
|
|
40
42
|
* @param {string} [props.accessibilityHint] - Additional accessibility hint for screen readers
|
|
41
43
|
*/
|
|
@@ -44,6 +46,7 @@ function UpiHandle({
|
|
|
44
46
|
modes: propModes = {},
|
|
45
47
|
showIcon = true,
|
|
46
48
|
iconName = 'ic_scan_qr_code',
|
|
49
|
+
avatarSource,
|
|
47
50
|
onPress,
|
|
48
51
|
disabled,
|
|
49
52
|
accessibilityLabel,
|
|
@@ -137,7 +140,7 @@ function UpiHandle({
|
|
|
137
140
|
<Wrapper
|
|
138
141
|
style={[containerStyle, pressedStyle, focusStyle]}
|
|
139
142
|
accessibilityRole="text"
|
|
140
|
-
accessibilityLabel={
|
|
143
|
+
accessibilityLabel={undefined}
|
|
141
144
|
{...(accessibilityHint !== undefined ? { accessibilityHint } : {})}
|
|
142
145
|
onPress={onPress}
|
|
143
146
|
disabled={(rest as any)?.disabled ?? disabled}
|
|
@@ -160,7 +163,7 @@ function UpiHandle({
|
|
|
160
163
|
{...rest}
|
|
161
164
|
>
|
|
162
165
|
<Image
|
|
163
|
-
source={DEFAULT_AVATAR_IMAGE}
|
|
166
|
+
source={avatarSource || DEFAULT_AVATAR_IMAGE}
|
|
164
167
|
style={avatarBaseStyle}
|
|
165
168
|
resizeMode="cover"
|
|
166
169
|
accessibilityElementsHidden={true}
|
package/src/components/index.ts
CHANGED
|
@@ -47,4 +47,5 @@ export { default as ChipSelect, type ChipSelectProps } from './ChipSelect/ChipSe
|
|
|
47
47
|
export { default as InputSearch, type InputSearchProps } from './InputSearch/InputSearch';
|
|
48
48
|
export { default as SupportText, type SupportTextProps } from './SupportText/SupportText';
|
|
49
49
|
export { default as SupportTextIcon, type SupportTextIconProps } from './SupportText/SupportTextIcon';
|
|
50
|
+
export { default as RadioButton, type RadioButtonProps } from './RadioButton/RadioButton';
|
|
50
51
|
|
package/src/icons/registry.ts
CHANGED