jfs-components 0.0.70 → 0.0.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/lib/commonjs/components/CardAdvisory/CardAdvisory.js +203 -0
- package/lib/commonjs/components/CardCTA/CardCTA.js +198 -16
- package/lib/commonjs/components/CardFinancialCondition/CardFinancialCondition.js +213 -0
- package/lib/commonjs/components/Carousel/Carousel.js +9 -7
- package/lib/commonjs/components/CircularProgressBar/CircularProgressBar.js +147 -0
- package/lib/commonjs/components/CircularProgressBarDoted/CircularProgressBarDoted.js +258 -0
- package/lib/commonjs/components/CircularRating/CircularRating.js +161 -0
- package/lib/commonjs/components/Gauge/Gauge.js +223 -0
- package/lib/commonjs/components/HoldingsCard/HoldingsCard.js +2 -2
- package/lib/commonjs/components/InstitutionBadge/InstitutionBadge.js +132 -0
- package/lib/commonjs/components/ListGroup/ListGroup.js +3 -1
- package/lib/commonjs/components/Nudge/Nudge.js +179 -87
- package/lib/commonjs/components/Radio/Radio.js +194 -0
- package/lib/commonjs/components/RadioButton/RadioButton.js +21 -188
- package/lib/commonjs/components/index.js +56 -0
- package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/module/components/CardAdvisory/CardAdvisory.js +197 -0
- package/lib/module/components/CardCTA/CardCTA.js +199 -17
- package/lib/module/components/CardFinancialCondition/CardFinancialCondition.js +207 -0
- package/lib/module/components/Carousel/Carousel.js +9 -7
- package/lib/module/components/CircularProgressBar/CircularProgressBar.js +141 -0
- package/lib/module/components/CircularProgressBarDoted/CircularProgressBarDoted.js +253 -0
- package/lib/module/components/CircularRating/CircularRating.js +155 -0
- package/lib/module/components/Gauge/Gauge.js +217 -0
- package/lib/module/components/HoldingsCard/HoldingsCard.js +2 -2
- package/lib/module/components/InstitutionBadge/InstitutionBadge.js +127 -0
- package/lib/module/components/ListGroup/ListGroup.js +3 -1
- package/lib/module/components/Nudge/Nudge.js +178 -87
- package/lib/module/components/Radio/Radio.js +188 -0
- package/lib/module/components/RadioButton/RadioButton.js +20 -185
- package/lib/module/components/index.js +12 -0
- package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/module/icons/registry.js +1 -1
- package/lib/typescript/src/components/CardAdvisory/CardAdvisory.d.ts +49 -0
- package/lib/typescript/src/components/CardCTA/CardCTA.d.ts +16 -1
- package/lib/typescript/src/components/CardFinancialCondition/CardFinancialCondition.d.ts +50 -0
- package/lib/typescript/src/components/CircularProgressBar/CircularProgressBar.d.ts +27 -0
- package/lib/typescript/src/components/CircularProgressBarDoted/CircularProgressBarDoted.d.ts +48 -0
- package/lib/typescript/src/components/CircularRating/CircularRating.d.ts +49 -0
- package/lib/typescript/src/components/Gauge/Gauge.d.ts +53 -0
- package/lib/typescript/src/components/InstitutionBadge/InstitutionBadge.d.ts +30 -0
- package/lib/typescript/src/components/Nudge/Nudge.d.ts +14 -11
- package/lib/typescript/src/components/Radio/Radio.d.ts +30 -0
- package/lib/typescript/src/components/RadioButton/RadioButton.d.ts +20 -28
- package/lib/typescript/src/components/index.d.ts +13 -1
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/CardAdvisory/CardAdvisory.tsx +283 -0
- package/src/components/CardCTA/CardCTA.tsx +236 -13
- package/src/components/CardFinancialCondition/CardFinancialCondition.tsx +366 -0
- package/src/components/Carousel/Carousel.tsx +14 -6
- package/src/components/CircularProgressBar/CircularProgressBar.tsx +190 -0
- package/src/components/CircularProgressBarDoted/CircularProgressBarDoted.tsx +357 -0
- package/src/components/CircularRating/CircularRating.tsx +241 -0
- package/src/components/Gauge/Gauge.tsx +303 -0
- package/src/components/HoldingsCard/HoldingsCard.tsx +2 -2
- package/src/components/InstitutionBadge/InstitutionBadge.tsx +216 -0
- package/src/components/ListGroup/ListGroup.tsx +3 -1
- package/src/components/Nudge/Nudge.tsx +222 -82
- package/src/components/Radio/Radio.tsx +227 -0
- package/src/components/RadioButton/RadioButton.tsx +23 -225
- package/src/components/index.ts +13 -1
- package/src/design-tokens/Coin Variables-variables-full.json +1 -1
- package/src/icons/registry.ts +1 -1
|
@@ -1,227 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
* Whether the radio button is disabled.
|
|
25
|
-
*/
|
|
26
|
-
disabled?: boolean
|
|
27
|
-
/**
|
|
28
|
-
* Function to call when the radio button is pressed.
|
|
29
|
-
*/
|
|
30
|
-
onPress?: () => void
|
|
31
|
-
/**
|
|
32
|
-
* Modes object for design-token resolution.
|
|
33
|
-
*/
|
|
34
|
-
modes?: Record<string, any>
|
|
35
|
-
/**
|
|
36
|
-
* Custom style for the radio button container.
|
|
37
|
-
*/
|
|
38
|
-
style?: StyleProp<ViewStyle>
|
|
39
|
-
/**
|
|
40
|
-
* Test ID for testing.
|
|
41
|
-
*/
|
|
42
|
-
testID?: string
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// ---------------------------------------------------------------------------
|
|
46
|
-
// RadioButton
|
|
47
|
-
// ---------------------------------------------------------------------------
|
|
48
|
-
|
|
49
|
-
export function RadioButton({
|
|
50
|
-
selected = false,
|
|
51
|
-
disabled = false,
|
|
52
|
-
onPress,
|
|
53
|
-
modes = EMPTY_MODES,
|
|
54
|
-
style,
|
|
55
|
-
testID,
|
|
56
|
-
}: RadioButtonProps) {
|
|
57
|
-
// ---- Refs & State ----
|
|
58
|
-
const [hovered, setHovered] = useState(false)
|
|
59
|
-
const [focused, setFocused] = useState(false)
|
|
60
|
-
const [pressed, setPressed] = useState(false)
|
|
61
|
-
|
|
62
|
-
// ---- Dimensions ----
|
|
63
|
-
const widthStr = getVariableByName('radio/width', modes) || '18'
|
|
64
|
-
const heightStr = getVariableByName('radio/height', modes) || '18'
|
|
65
|
-
const selectorSizeStr = getVariableByName('radio/selector/size', modes) || '10'
|
|
66
|
-
|
|
67
|
-
const width = parseFloat(widthStr?.toString() || '18')
|
|
68
|
-
const height = parseFloat(heightStr?.toString() || '18')
|
|
69
|
-
const selectorSize = parseFloat(selectorSizeStr?.toString() || '10')
|
|
70
|
-
|
|
71
|
-
// ---- State Logic ----
|
|
72
|
-
// Priority: Disabled -> Focused -> Hover/Pressed -> Idle
|
|
73
|
-
// Note: Design treats Active (Pressed) similar to Selected for some styles,
|
|
74
|
-
// but usually in Radio Buttons, Pressed is a transient state.
|
|
75
|
-
// We will map:
|
|
76
|
-
// - Disabled -> 'disabled'
|
|
77
|
-
// - Focused -> 'focus'
|
|
78
|
-
// - Hovered -> 'hover'
|
|
79
|
-
// - Idle -> 'idle'
|
|
80
|
-
|
|
81
|
-
// We handle `selected` as a separate dimension derived from state.
|
|
82
|
-
|
|
83
|
-
let visualState = 'idle'
|
|
84
|
-
if (disabled) {
|
|
85
|
-
visualState = 'disabled'
|
|
86
|
-
} else if (focused) {
|
|
87
|
-
visualState = 'focus'
|
|
88
|
-
} else if (hovered || pressed) {
|
|
89
|
-
visualState = 'hover'
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Construct token paths based on state + selected
|
|
93
|
-
let prefix = `radio/${visualState}`
|
|
94
|
-
if (visualState === 'idle' && selected) {
|
|
95
|
-
prefix = `radio/selected`
|
|
96
|
-
} else if (selected) {
|
|
97
|
-
prefix = `radio/${visualState}Selected`
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// ---- Colors & Border ----
|
|
101
|
-
|
|
102
|
-
const resolveColor = (path: string, fallback: string) => {
|
|
103
|
-
return getVariableByName(path, modes) || fallback
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Background Color
|
|
107
|
-
let bgColorVar = `${prefix}/background/color`
|
|
108
|
-
// Fix for disabledSelected weirdness if needed
|
|
109
|
-
if (visualState === 'disabled' && selected) {
|
|
110
|
-
// Check specific path from dump: `radio/disabledSelected/background`
|
|
111
|
-
if (!getVariableByName(`${prefix}/background/color`, modes)) {
|
|
112
|
-
bgColorVar = `${prefix}/background`
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// Border Color
|
|
117
|
-
let borderColorVar = `${prefix}/border/color`
|
|
118
|
-
|
|
119
|
-
// Border Width
|
|
120
|
-
let borderWidthVar = `${prefix}/border/size`
|
|
121
|
-
// Fix for huge path: `radio/disabled/radio/disabled/border/size`
|
|
122
|
-
if (visualState === 'disabled' && !selected) {
|
|
123
|
-
if (getVariableByName('radio/disabled/radio/disabled/border/size', modes)) {
|
|
124
|
-
borderWidthVar = 'radio/disabled/radio/disabled/border/size'
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Selector Color
|
|
129
|
-
let selectorBgVar = `${prefix}/selector/background/color`
|
|
130
|
-
if (!selected) {
|
|
131
|
-
selectorBgVar = 'transparent'
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Shadows (Glow)
|
|
135
|
-
let shadowSizeVar = `${prefix}/boxShadow/size`
|
|
136
|
-
let shadowColorVar = `${prefix}/shadow/color`
|
|
137
|
-
|
|
138
|
-
// Resolve Values
|
|
139
|
-
const backgroundColor = resolveColor(bgColorVar, 'transparent')
|
|
140
|
-
const borderColor = resolveColor(borderColorVar, 'transparent')
|
|
141
|
-
const borderWidth = parseFloat(getVariableByName(borderWidthVar, modes)?.toString() || '1')
|
|
142
|
-
const selectorColor = resolveColor(selectorBgVar, 'transparent')
|
|
143
|
-
|
|
144
|
-
const shadowSize = parseFloat(getVariableByName(shadowSizeVar, modes)?.toString() || '0')
|
|
145
|
-
const shadowColor = resolveColor(shadowColorVar, 'transparent')
|
|
146
|
-
|
|
147
|
-
// Styles
|
|
148
|
-
const containerStyle: any = {
|
|
149
|
-
width,
|
|
150
|
-
height,
|
|
151
|
-
borderRadius: width / 2, // 9999px -> circle
|
|
152
|
-
borderWidth,
|
|
153
|
-
borderColor,
|
|
154
|
-
backgroundColor,
|
|
155
|
-
justifyContent: 'center',
|
|
156
|
-
alignItems: 'center',
|
|
157
|
-
// Web shadow (ring)
|
|
158
|
-
...(Platform.OS === 'web' && shadowSize > 0 ? {
|
|
159
|
-
boxShadow: `0px 0px 0px ${shadowSize}px ${shadowColor}`,
|
|
160
|
-
} : {}),
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const selectorStyle: ViewStyle = {
|
|
164
|
-
width: selectorSize,
|
|
165
|
-
height: selectorSize,
|
|
166
|
-
borderRadius: selectorSize / 2,
|
|
167
|
-
backgroundColor: selectorColor,
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// Dummy block for token extraction (static analysis)
|
|
171
|
-
if (false as boolean) {
|
|
172
|
-
getVariableByName('radio/idle/background/color')
|
|
173
|
-
getVariableByName('radio/idle/border/color')
|
|
174
|
-
getVariableByName('radio/selector/size')
|
|
175
|
-
getVariableByName('radio/width')
|
|
176
|
-
getVariableByName('radio/height')
|
|
177
|
-
getVariableByName('radio/background/color')
|
|
178
|
-
getVariableByName('radio/hover/background/color')
|
|
179
|
-
getVariableByName('radio/hover/border/color')
|
|
180
|
-
getVariableByName('radio/hover/boxShadow/size')
|
|
181
|
-
getVariableByName('radio/hover/shadow/color')
|
|
182
|
-
getVariableByName('radio/selected/background/color')
|
|
183
|
-
getVariableByName('radio/selected/border/color')
|
|
184
|
-
getVariableByName('radio/selected/selector/background/color')
|
|
185
|
-
getVariableByName('radio/hoverSelected/background/color')
|
|
186
|
-
getVariableByName('radio/hoverSelected/border/color')
|
|
187
|
-
getVariableByName('radio/hoverSelected/boxShadow/size')
|
|
188
|
-
getVariableByName('radio/hoverSelected/shadow/color')
|
|
189
|
-
getVariableByName('radio/hoverSelected/selector/background/color')
|
|
190
|
-
getVariableByName('radio/focus/background/color')
|
|
191
|
-
getVariableByName('radio/focus/border/color')
|
|
192
|
-
getVariableByName('radio/focus/border/size')
|
|
193
|
-
getVariableByName('radio/focus/boxShadow/size')
|
|
194
|
-
getVariableByName('radio/focus/shadow/color')
|
|
195
|
-
getVariableByName('radio/focusSelected/background/color')
|
|
196
|
-
getVariableByName('radio/focusSelected/selector/background/color')
|
|
197
|
-
getVariableByName('radio/focusSelected/border/size')
|
|
198
|
-
getVariableByName('radio/disabled/radio/disabled/border/size')
|
|
199
|
-
getVariableByName('radio/disabled/background/color')
|
|
200
|
-
getVariableByName('radio/disabled/border/color')
|
|
201
|
-
getVariableByName('radio/disabledSelected/selector/background/color')
|
|
202
|
-
getVariableByName('radio/disabledSelected/background')
|
|
203
|
-
getVariableByName('radio/disabledSelected/border/color')
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return (
|
|
207
|
-
<Pressable
|
|
208
|
-
testID={testID}
|
|
209
|
-
disabled={disabled}
|
|
210
|
-
onPress={onPress}
|
|
211
|
-
onHoverIn={() => setHovered(true)}
|
|
212
|
-
onHoverOut={() => setHovered(false)}
|
|
213
|
-
onFocus={() => setFocused(true)}
|
|
214
|
-
onBlur={() => setFocused(false)}
|
|
215
|
-
onPressIn={() => setPressed(true)}
|
|
216
|
-
onPressOut={() => setPressed(false)}
|
|
217
|
-
style={({ pressed: isPressed }) => [
|
|
218
|
-
containerStyle,
|
|
219
|
-
style,
|
|
220
|
-
]}
|
|
221
|
-
>
|
|
222
|
-
<View style={selectorStyle} />
|
|
223
|
-
</Pressable>
|
|
224
|
-
)
|
|
225
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated `RadioButton` has been renamed to `Radio`.
|
|
3
|
+
*
|
|
4
|
+
* This file is kept as a backward-compatibility shim for teams that may be
|
|
5
|
+
* importing `RadioButton` directly from this deep path:
|
|
6
|
+
*
|
|
7
|
+
* import RadioButton from 'jfs-components/src/components/RadioButton/RadioButton'
|
|
8
|
+
* import { RadioButton, RadioButtonProps } from '...'
|
|
9
|
+
*
|
|
10
|
+
* The recommended public import is now:
|
|
11
|
+
*
|
|
12
|
+
* import { Radio, type RadioProps } from 'jfs-components'
|
|
13
|
+
*
|
|
14
|
+
* Going forward, this component is called `Radio`. This shim only re-exports
|
|
15
|
+
* the new `Radio` component under the old `RadioButton` names; please migrate
|
|
16
|
+
* existing usages to `Radio` at your earliest convenience.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { Radio, type RadioProps } from '../Radio/Radio'
|
|
20
|
+
|
|
21
|
+
export type RadioButtonProps = RadioProps
|
|
22
|
+
|
|
23
|
+
export const RadioButton = Radio
|
|
226
24
|
|
|
227
25
|
export default RadioButton
|
package/src/components/index.ts
CHANGED
|
@@ -7,19 +7,25 @@ export { default as BottomNav } from './BottomNav/BottomNav';
|
|
|
7
7
|
export { default as BottomNavItem } from './BottomNavItem/BottomNavItem';
|
|
8
8
|
export { default as Button, type ButtonProps } from './Button/Button';
|
|
9
9
|
export { default as Card } from './Card/Card';
|
|
10
|
+
export { default as CardAdvisory, type CardAdvisoryProps } from './CardAdvisory/CardAdvisory'
|
|
10
11
|
export { default as Carousel } from './Carousel/Carousel';
|
|
11
12
|
export type { CarouselProps, CarouselItemProps, PaginationProps } from './Carousel/Carousel';
|
|
12
13
|
export { default as Checkbox, type CheckboxProps } from './Checkbox/Checkbox';
|
|
13
14
|
export { default as CardFeedback, type CardFeedbackProps } from './CardFeedback/CardFeedback';
|
|
15
|
+
export { default as CardFinancialCondition, type CardFinancialConditionProps } from './CardFinancialCondition/CardFinancialCondition';
|
|
14
16
|
export { default as Disclaimer } from './Disclaimer/Disclaimer';
|
|
15
17
|
export { default as Divider, type DividerProps, type DividerDirection } from './Divider/Divider';
|
|
16
18
|
export { default as Drawer } from './Drawer/Drawer';
|
|
17
|
-
export { default as CardCTA, type CardCTAProps } from './CardCTA/CardCTA'
|
|
19
|
+
export { default as CardCTA, type CardCTAProps, type CardCTAType } from './CardCTA/CardCTA'
|
|
18
20
|
export { default as DebitCard, type DebitCardProps } from './DebitCard/DebitCard';
|
|
19
21
|
export { default as FilterBar } from './FilterBar/FilterBar';
|
|
20
22
|
export { default as Form, type FormProps } from './Form/Form';
|
|
21
23
|
export { useFormContext } from './Form/Form';
|
|
22
24
|
export { default as FormField, type FormFieldProps, type FormFieldType } from './FormField/FormField';
|
|
25
|
+
export { default as CircularProgressBar, type CircularProgressBarProps } from './CircularProgressBar/CircularProgressBar'
|
|
26
|
+
export { default as CircularProgressBarDoted, type CircularProgressBarDotedProps } from './CircularProgressBarDoted/CircularProgressBarDoted'
|
|
27
|
+
export { default as CircularRating, type CircularRatingProps } from './CircularRating/CircularRating'
|
|
28
|
+
export { default as Gauge, type GaugeProps } from './Gauge/Gauge';
|
|
23
29
|
export { default as HoldingsCard, type HoldingsCardProps } from './HoldingsCard/HoldingsCard';
|
|
24
30
|
export { default as HStack, type HStackProps } from './HStack/HStack';
|
|
25
31
|
export { default as IconButton } from './IconButton/IconButton';
|
|
@@ -61,8 +67,14 @@ export { default as ButtonGroup, type ButtonGroupProps } from './ButtonGroup/But
|
|
|
61
67
|
export { default as CardProviderInfo, type CardProviderInfoProps } from './CardProviderInfo/CardProviderInfo';
|
|
62
68
|
export { default as ChipSelect, type ChipSelectProps } from './ChipSelect/ChipSelect';
|
|
63
69
|
export { default as InputSearch, type InputSearchProps } from './InputSearch/InputSearch';
|
|
70
|
+
export { default as InstitutionBadge, type InstitutionBadgeProps } from './InstitutionBadge/InstitutionBadge';
|
|
64
71
|
export { default as SupportText, type SupportTextProps } from './SupportText/SupportText';
|
|
65
72
|
export { default as SupportTextIcon, type SupportTextIconProps, type SupportTextStatus } from './SupportText/SupportTextIcon';
|
|
73
|
+
export { default as Radio, type RadioProps } from './Radio/Radio';
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated Use `Radio` instead. `RadioButton` is kept as an alias for
|
|
76
|
+
* backward compatibility and will be removed in a future major release.
|
|
77
|
+
*/
|
|
66
78
|
export { default as RadioButton, type RadioButtonProps } from './RadioButton/RadioButton';
|
|
67
79
|
export { default as RechargeCard, type RechargeCardProps } from './RechargeCard/RechargeCard';
|
|
68
80
|
export { default as Tabs, type TabsProps } from './Tabs/Tabs';
|