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.
Files changed (66) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/lib/commonjs/components/CardAdvisory/CardAdvisory.js +203 -0
  3. package/lib/commonjs/components/CardCTA/CardCTA.js +198 -16
  4. package/lib/commonjs/components/CardFinancialCondition/CardFinancialCondition.js +213 -0
  5. package/lib/commonjs/components/Carousel/Carousel.js +9 -7
  6. package/lib/commonjs/components/CircularProgressBar/CircularProgressBar.js +147 -0
  7. package/lib/commonjs/components/CircularProgressBarDoted/CircularProgressBarDoted.js +258 -0
  8. package/lib/commonjs/components/CircularRating/CircularRating.js +161 -0
  9. package/lib/commonjs/components/Gauge/Gauge.js +223 -0
  10. package/lib/commonjs/components/HoldingsCard/HoldingsCard.js +2 -2
  11. package/lib/commonjs/components/InstitutionBadge/InstitutionBadge.js +132 -0
  12. package/lib/commonjs/components/ListGroup/ListGroup.js +3 -1
  13. package/lib/commonjs/components/Nudge/Nudge.js +179 -87
  14. package/lib/commonjs/components/Radio/Radio.js +194 -0
  15. package/lib/commonjs/components/RadioButton/RadioButton.js +21 -188
  16. package/lib/commonjs/components/index.js +56 -0
  17. package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
  18. package/lib/commonjs/icons/registry.js +1 -1
  19. package/lib/module/components/CardAdvisory/CardAdvisory.js +197 -0
  20. package/lib/module/components/CardCTA/CardCTA.js +199 -17
  21. package/lib/module/components/CardFinancialCondition/CardFinancialCondition.js +207 -0
  22. package/lib/module/components/Carousel/Carousel.js +9 -7
  23. package/lib/module/components/CircularProgressBar/CircularProgressBar.js +141 -0
  24. package/lib/module/components/CircularProgressBarDoted/CircularProgressBarDoted.js +253 -0
  25. package/lib/module/components/CircularRating/CircularRating.js +155 -0
  26. package/lib/module/components/Gauge/Gauge.js +217 -0
  27. package/lib/module/components/HoldingsCard/HoldingsCard.js +2 -2
  28. package/lib/module/components/InstitutionBadge/InstitutionBadge.js +127 -0
  29. package/lib/module/components/ListGroup/ListGroup.js +3 -1
  30. package/lib/module/components/Nudge/Nudge.js +178 -87
  31. package/lib/module/components/Radio/Radio.js +188 -0
  32. package/lib/module/components/RadioButton/RadioButton.js +20 -185
  33. package/lib/module/components/index.js +12 -0
  34. package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
  35. package/lib/module/icons/registry.js +1 -1
  36. package/lib/typescript/src/components/CardAdvisory/CardAdvisory.d.ts +49 -0
  37. package/lib/typescript/src/components/CardCTA/CardCTA.d.ts +16 -1
  38. package/lib/typescript/src/components/CardFinancialCondition/CardFinancialCondition.d.ts +50 -0
  39. package/lib/typescript/src/components/CircularProgressBar/CircularProgressBar.d.ts +27 -0
  40. package/lib/typescript/src/components/CircularProgressBarDoted/CircularProgressBarDoted.d.ts +48 -0
  41. package/lib/typescript/src/components/CircularRating/CircularRating.d.ts +49 -0
  42. package/lib/typescript/src/components/Gauge/Gauge.d.ts +53 -0
  43. package/lib/typescript/src/components/InstitutionBadge/InstitutionBadge.d.ts +30 -0
  44. package/lib/typescript/src/components/Nudge/Nudge.d.ts +14 -11
  45. package/lib/typescript/src/components/Radio/Radio.d.ts +30 -0
  46. package/lib/typescript/src/components/RadioButton/RadioButton.d.ts +20 -28
  47. package/lib/typescript/src/components/index.d.ts +13 -1
  48. package/lib/typescript/src/icons/registry.d.ts +1 -1
  49. package/package.json +1 -1
  50. package/src/components/CardAdvisory/CardAdvisory.tsx +283 -0
  51. package/src/components/CardCTA/CardCTA.tsx +236 -13
  52. package/src/components/CardFinancialCondition/CardFinancialCondition.tsx +366 -0
  53. package/src/components/Carousel/Carousel.tsx +14 -6
  54. package/src/components/CircularProgressBar/CircularProgressBar.tsx +190 -0
  55. package/src/components/CircularProgressBarDoted/CircularProgressBarDoted.tsx +357 -0
  56. package/src/components/CircularRating/CircularRating.tsx +241 -0
  57. package/src/components/Gauge/Gauge.tsx +303 -0
  58. package/src/components/HoldingsCard/HoldingsCard.tsx +2 -2
  59. package/src/components/InstitutionBadge/InstitutionBadge.tsx +216 -0
  60. package/src/components/ListGroup/ListGroup.tsx +3 -1
  61. package/src/components/Nudge/Nudge.tsx +222 -82
  62. package/src/components/Radio/Radio.tsx +227 -0
  63. package/src/components/RadioButton/RadioButton.tsx +23 -225
  64. package/src/components/index.ts +13 -1
  65. package/src/design-tokens/Coin Variables-variables-full.json +1 -1
  66. package/src/icons/registry.ts +1 -1
@@ -4,33 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
7
+ var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
10
10
  var _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
11
11
  var _reactUtils = require("../../utils/react-utils");
12
12
  var _Button = _interopRequireDefault(require("../Button/Button"));
13
+ var _Icon = _interopRequireDefault(require("../../icons/Icon"));
13
14
  var _jsxRuntime = require("react/jsx-runtime");
14
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- function Nudge({
16
- variant = 'Default',
17
- title = 'Split payment',
18
- body = 'Split this transaction into installments',
19
- buttonLabel = 'Button',
20
- onPressButton,
21
- buttonSlot,
22
- startSlot,
23
- children,
24
- modes: propModes = _reactUtils.EMPTY_MODES,
25
- style
26
- }) {
27
- const {
28
- modes: globalModes
29
- } = (0, _JFSThemeProvider.useTokens)();
30
- const modes = {
31
- ...globalModes,
32
- ...propModes
33
- };
16
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
17
+ function toFontWeight(value, fallback) {
18
+ if (typeof value === 'number') return value.toString();
19
+ if (typeof value === 'string') return value;
20
+ return fallback;
21
+ }
22
+ function resolveNudgeTokens(modes) {
34
23
  const background = (0, _figmaVariablesResolver.getVariableByName)('nudge/background', modes) || '#f5f5f5';
35
24
  const radius = (0, _figmaVariablesResolver.getVariableByName)('nudge/radius', modes) || 12;
36
25
  const paddingH = (0, _figmaVariablesResolver.getVariableByName)('nudge/padding/horizontal', modes) || 12;
@@ -38,106 +27,209 @@ function Nudge({
38
27
  const gap = (0, _figmaVariablesResolver.getVariableByName)('nudge/gap', modes) || 6;
39
28
  const titleColor = (0, _figmaVariablesResolver.getVariableByName)('nudge/title/color', modes) || '#0d0d0f';
40
29
  const titleFontSize = (0, _figmaVariablesResolver.getVariableByName)('nudge/title/fontSize', modes) || 14;
41
- const titleFontFamily = (0, _figmaVariablesResolver.getVariableByName)('nudge/title/fontFamily', modes) || 'JioType Var';
30
+ const titleFontFamily = (0, _figmaVariablesResolver.getVariableByName)('nudge/title/fontFamily', modes) || 'System';
42
31
  const titleLineHeight = (0, _figmaVariablesResolver.getVariableByName)('nudge/title/lineHeight', modes) || 15;
43
- const titleFontWeightRaw = (0, _figmaVariablesResolver.getVariableByName)('nudge/title/fontWeight', modes) || 700;
44
- const titleFontWeight = typeof titleFontWeightRaw === 'number' ? titleFontWeightRaw.toString() : titleFontWeightRaw;
32
+ const titleFontWeight = toFontWeight((0, _figmaVariablesResolver.getVariableByName)('nudge/title/fontWeight', modes), '700');
45
33
  const bodyColor = (0, _figmaVariablesResolver.getVariableByName)('nudge/body/color', modes) || '#1a1c1f';
46
34
  const bodyFontSize = (0, _figmaVariablesResolver.getVariableByName)('nudge/body/fontSize', modes) || 12;
47
- const bodyFontFamily = (0, _figmaVariablesResolver.getVariableByName)('nudge/body/fontFamily', modes) || 'JioType Var';
35
+ const bodyFontFamily = (0, _figmaVariablesResolver.getVariableByName)('nudge/body/fontFamily', modes) || 'System';
48
36
  const bodyLineHeight = (0, _figmaVariablesResolver.getVariableByName)('nudge/body/lineHeight', modes) || 16;
49
- const bodyFontWeightRaw = (0, _figmaVariablesResolver.getVariableByName)('nudge/body/fontWeight', modes) || 500;
50
- const bodyFontWeight = typeof bodyFontWeightRaw === 'number' ? bodyFontWeightRaw.toString() : bodyFontWeightRaw;
37
+ const bodyFontWeight = toFontWeight((0, _figmaVariablesResolver.getVariableByName)('nudge/body/fontWeight', modes), '500');
51
38
  const textGap = (0, _figmaVariablesResolver.getVariableByName)('nudge/text/gap', modes) || 4;
52
39
  const contentGap = (0, _figmaVariablesResolver.getVariableByName)('nudge/content/gap', modes) || 8;
53
40
  const contentMinHeight = (0, _figmaVariablesResolver.getVariableByName)('nudge/content/minHeight', modes) || 20;
54
- const containerStyle = {
55
- backgroundColor: background,
56
- borderRadius: radius,
57
- paddingHorizontal: paddingH,
58
- paddingVertical: paddingV,
59
- gap,
60
- overflow: 'hidden',
61
- ...(variant === 'Variant2' ? {
41
+ const startSlotGap = (0, _figmaVariablesResolver.getVariableByName)('nudge/startSlot/gap', modes) || 4;
42
+ return {
43
+ containerBaseStyle: {
44
+ backgroundColor: background,
45
+ borderRadius: radius,
46
+ paddingHorizontal: paddingH,
47
+ paddingVertical: paddingV,
48
+ gap: gap,
49
+ overflow: 'hidden'
50
+ },
51
+ prominentContainerStyle: {
52
+ flexDirection: 'row',
53
+ alignItems: 'flex-start'
54
+ },
55
+ compactContainerStyle: {
56
+ flexDirection: 'row',
57
+ alignItems: 'center'
58
+ },
59
+ detailedContainerStyle: {
62
60
  flexDirection: 'column',
63
61
  alignItems: 'flex-start'
64
- } : {
62
+ },
63
+ contentStyle: {
64
+ flex: 1,
65
+ minWidth: 1,
66
+ minHeight: contentMinHeight,
67
+ justifyContent: 'center',
68
+ overflow: 'hidden'
69
+ },
70
+ compactOuterContentStyle: {
71
+ flex: 1,
72
+ minWidth: 1,
73
+ alignSelf: 'stretch',
74
+ justifyContent: 'center'
75
+ },
76
+ compactContentWrapStyle: {
65
77
  flexDirection: 'row',
78
+ alignItems: 'center',
79
+ gap: contentGap,
80
+ width: '100%'
81
+ },
82
+ textWrapStyle: {
83
+ gap: textGap,
84
+ alignItems: 'flex-start',
85
+ width: '100%'
86
+ },
87
+ compactTextWrapStyle: {
88
+ flex: 1,
89
+ minWidth: 1,
66
90
  alignItems: 'flex-start'
67
- })
68
- };
69
- const titleStyle = {
70
- color: titleColor,
71
- fontSize: titleFontSize,
72
- fontFamily: titleFontFamily,
73
- lineHeight: titleLineHeight,
74
- fontWeight: titleFontWeight
75
- };
76
- const bodyStyle = {
77
- color: bodyColor,
78
- fontSize: bodyFontSize,
79
- fontFamily: bodyFontFamily,
80
- lineHeight: bodyLineHeight,
81
- fontWeight: bodyFontWeight
91
+ },
92
+ headerStyle: {
93
+ flexDirection: 'row',
94
+ alignItems: 'center',
95
+ gap: gap,
96
+ width: '100%'
97
+ },
98
+ detailSlotStyle: {
99
+ gap: (0, _figmaVariablesResolver.getVariableByName)('slot/gap', modes) || 8,
100
+ width: '100%'
101
+ },
102
+ titleTextStyle: {
103
+ color: titleColor,
104
+ fontSize: titleFontSize,
105
+ fontFamily: titleFontFamily,
106
+ lineHeight: titleLineHeight,
107
+ fontWeight: titleFontWeight
108
+ },
109
+ bodyTextStyle: {
110
+ color: bodyColor,
111
+ fontSize: bodyFontSize,
112
+ fontFamily: bodyFontFamily,
113
+ lineHeight: bodyLineHeight,
114
+ fontWeight: bodyFontWeight
115
+ },
116
+ iconColor: (0, _figmaVariablesResolver.getVariableByName)('appearance/nudge/icon/color', modes) || '#5d00b5',
117
+ iconSize: (0, _figmaVariablesResolver.getVariableByName)('nudge/icon/size', modes) || 20,
118
+ startSlotGap: startSlotGap
82
119
  };
83
- const processedStartSlot = startSlot ? (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(startSlot), modes) : null;
84
- const startSlotElement = processedStartSlot && processedStartSlot.length > 0 ? processedStartSlot.length === 1 ? processedStartSlot[0] : processedStartSlot : null;
85
- if (variant === 'Variant2') {
120
+ }
121
+ function NudgeImpl({
122
+ type = 'stacked-prominent',
123
+ title = 'Split payment',
124
+ body = 'Split this transaction into installments',
125
+ buttonLabel = 'Button',
126
+ onPressButton,
127
+ buttonSlot,
128
+ startSlot,
129
+ children,
130
+ modes: propModes = _reactUtils.EMPTY_MODES,
131
+ style
132
+ }) {
133
+ const {
134
+ modes: globalModes
135
+ } = (0, _JFSThemeProvider.useTokens)();
136
+ const modes = (0, _react.useMemo)(() => globalModes === _reactUtils.EMPTY_MODES && propModes === _reactUtils.EMPTY_MODES ? _reactUtils.EMPTY_MODES : {
137
+ ...globalModes,
138
+ ...propModes
139
+ }, [globalModes, propModes]);
140
+ const tokens = (0, _react.useMemo)(() => resolveNudgeTokens(modes), [modes]);
141
+ const startSlotElement = (0, _react.useMemo)(() => {
142
+ if (startSlot === null || startSlot === false) return null;
143
+ if (startSlot !== undefined) {
144
+ const processed = (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(startSlot), modes);
145
+ return processed.length === 1 ? processed[0] : processed;
146
+ }
147
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
148
+ name: "ic_ai_sparkle",
149
+ size: tokens.iconSize,
150
+ color: tokens.iconColor,
151
+ accessibilityElementsHidden: true,
152
+ importantForAccessibility: "no"
153
+ });
154
+ }, [startSlot, modes, tokens.iconColor, tokens.iconSize]);
155
+ const startSlotWrapper = startSlotElement ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
156
+ style: {
157
+ gap: tokens.startSlotGap,
158
+ alignItems: 'center'
159
+ },
160
+ children: startSlotElement
161
+ }) : null;
162
+ const processedChildren = (0, _react.useMemo)(() => {
163
+ if (!children) return null;
164
+ const processed = (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(children), modes);
165
+ return processed.length === 1 ? processed[0] : processed;
166
+ }, [children, modes]);
167
+ const buttonElement = buttonSlot ? (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(buttonSlot), modes) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
168
+ label: buttonLabel,
169
+ modes: modes,
170
+ ...(onPressButton ? {
171
+ onPress: onPressButton
172
+ } : {})
173
+ });
174
+ if (type === 'stacked-detailed') {
86
175
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
87
- style: [containerStyle, style],
176
+ style: [tokens.containerBaseStyle, tokens.detailedContainerStyle, style],
88
177
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
89
- style: {
90
- flexDirection: 'row',
91
- alignItems: 'center',
92
- gap: 6,
93
- width: '100%'
94
- },
95
- children: [startSlotElement, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
96
- style: [titleStyle, {
178
+ style: tokens.headerStyle,
179
+ children: [startSlotWrapper, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
180
+ style: [tokens.titleTextStyle, {
97
181
  flex: 1
98
182
  }],
99
183
  children: title
100
184
  })]
101
- }), children ? (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(children), modes) : null]
185
+ }), processedChildren ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
186
+ style: tokens.detailSlotStyle,
187
+ children: processedChildren
188
+ }) : null]
189
+ });
190
+ }
191
+ if (type === 'inline-compact') {
192
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
193
+ style: [tokens.containerBaseStyle, tokens.compactContainerStyle, style],
194
+ children: [startSlotWrapper, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
195
+ style: tokens.compactOuterContentStyle,
196
+ children: processedChildren || /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
197
+ style: tokens.compactContentWrapStyle,
198
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
199
+ style: tokens.compactTextWrapStyle,
200
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
201
+ style: tokens.bodyTextStyle,
202
+ children: body
203
+ })
204
+ }), buttonElement]
205
+ })
206
+ })]
102
207
  });
103
208
  }
104
- const defaultContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
209
+ const prominentContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
105
210
  style: {
106
- gap: contentGap,
211
+ gap: tokens.compactContentWrapStyle.gap,
107
212
  alignItems: 'flex-start',
108
213
  width: '100%'
109
214
  },
110
215
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
111
- style: {
112
- gap: textGap,
113
- alignItems: 'flex-start',
114
- width: '100%'
115
- },
216
+ style: tokens.textWrapStyle,
116
217
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
117
- style: titleStyle,
218
+ style: tokens.titleTextStyle,
118
219
  children: title
119
220
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
120
- style: bodyStyle,
221
+ style: tokens.bodyTextStyle,
121
222
  children: body
122
223
  })]
123
- }), buttonSlot ? (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(buttonSlot), modes) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
124
- label: buttonLabel,
125
- onPress: onPressButton,
126
- modes: modes
127
- })]
224
+ }), buttonElement]
128
225
  });
129
226
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
130
- style: [containerStyle, style],
131
- children: [startSlotElement, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
132
- style: {
133
- flex: 1,
134
- minWidth: 1,
135
- minHeight: contentMinHeight,
136
- justifyContent: 'center',
137
- overflow: 'hidden'
138
- },
139
- children: children ? (0, _reactUtils.cloneChildrenWithModes)(_react.default.Children.toArray(children), modes) : defaultContent
227
+ style: [tokens.containerBaseStyle, tokens.prominentContainerStyle, style],
228
+ children: [startSlotWrapper, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
229
+ style: tokens.contentStyle,
230
+ children: processedChildren || prominentContent
140
231
  })]
141
232
  });
142
233
  }
234
+ const Nudge = /*#__PURE__*/_react.default.memo(NudgeImpl);
143
235
  var _default = exports.default = Nudge;
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Radio = Radio;
7
+ exports.default = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _reactNative = require("react-native");
10
+ var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
11
+ var _reactUtils = require("../../utils/react-utils");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
+ // ---------------------------------------------------------------------------
15
+ // Props
16
+ // ---------------------------------------------------------------------------
17
+
18
+ // ---------------------------------------------------------------------------
19
+ // Radio
20
+ // ---------------------------------------------------------------------------
21
+
22
+ function Radio({
23
+ selected = false,
24
+ disabled = false,
25
+ onPress,
26
+ modes = _reactUtils.EMPTY_MODES,
27
+ style,
28
+ testID
29
+ }) {
30
+ // ---- Refs & State ----
31
+ const [hovered, setHovered] = (0, _react.useState)(false);
32
+ const [focused, setFocused] = (0, _react.useState)(false);
33
+ const [pressed, setPressed] = (0, _react.useState)(false);
34
+
35
+ // ---- Dimensions ----
36
+ const widthStr = (0, _figmaVariablesResolver.getVariableByName)('radio/width', modes) || '18';
37
+ const heightStr = (0, _figmaVariablesResolver.getVariableByName)('radio/height', modes) || '18';
38
+ const selectorSizeStr = (0, _figmaVariablesResolver.getVariableByName)('radio/selector/size', modes) || '10';
39
+ const width = parseFloat(widthStr?.toString() || '18');
40
+ const height = parseFloat(heightStr?.toString() || '18');
41
+ const selectorSize = parseFloat(selectorSizeStr?.toString() || '10');
42
+
43
+ // ---- State Logic ----
44
+ // Priority: Disabled -> Focused -> Hover/Pressed -> Idle
45
+ // Note: Design treats Active (Pressed) similar to Selected for some styles,
46
+ // but usually in Radios, Pressed is a transient state.
47
+ // We will map:
48
+ // - Disabled -> 'disabled'
49
+ // - Focused -> 'focus'
50
+ // - Hovered -> 'hover'
51
+ // - Idle -> 'idle'
52
+
53
+ // We handle `selected` as a separate dimension derived from state.
54
+
55
+ let visualState = 'idle';
56
+ if (disabled) {
57
+ visualState = 'disabled';
58
+ } else if (focused) {
59
+ visualState = 'focus';
60
+ } else if (hovered || pressed) {
61
+ visualState = 'hover';
62
+ }
63
+
64
+ // Construct token paths based on state + selected
65
+ let prefix = `radio/${visualState}`;
66
+ if (visualState === 'idle' && selected) {
67
+ prefix = `radio/selected`;
68
+ } else if (selected) {
69
+ prefix = `radio/${visualState}Selected`;
70
+ }
71
+
72
+ // ---- Colors & Border ----
73
+
74
+ const resolveColor = (path, fallback) => {
75
+ return (0, _figmaVariablesResolver.getVariableByName)(path, modes) || fallback;
76
+ };
77
+
78
+ // Background Color
79
+ let bgColorVar = `${prefix}/background/color`;
80
+ // Fix for disabledSelected weirdness if needed
81
+ if (visualState === 'disabled' && selected) {
82
+ // Check specific path from dump: `radio/disabledSelected/background`
83
+ if (!(0, _figmaVariablesResolver.getVariableByName)(`${prefix}/background/color`, modes)) {
84
+ bgColorVar = `${prefix}/background`;
85
+ }
86
+ }
87
+
88
+ // Border Color
89
+ let borderColorVar = `${prefix}/border/color`;
90
+
91
+ // Border Width
92
+ let borderWidthVar = `${prefix}/border/size`;
93
+ // Fix for huge path: `radio/disabled/radio/disabled/border/size`
94
+ if (visualState === 'disabled' && !selected) {
95
+ if ((0, _figmaVariablesResolver.getVariableByName)('radio/disabled/radio/disabled/border/size', modes)) {
96
+ borderWidthVar = 'radio/disabled/radio/disabled/border/size';
97
+ }
98
+ }
99
+
100
+ // Selector Color
101
+ let selectorBgVar = `${prefix}/selector/background/color`;
102
+ if (!selected) {
103
+ selectorBgVar = 'transparent';
104
+ }
105
+
106
+ // Shadows (Glow)
107
+ let shadowSizeVar = `${prefix}/boxShadow/size`;
108
+ let shadowColorVar = `${prefix}/shadow/color`;
109
+
110
+ // Resolve Values
111
+ const backgroundColor = resolveColor(bgColorVar, 'transparent');
112
+ const borderColor = resolveColor(borderColorVar, 'transparent');
113
+ const borderWidth = parseFloat((0, _figmaVariablesResolver.getVariableByName)(borderWidthVar, modes)?.toString() || '1');
114
+ const selectorColor = resolveColor(selectorBgVar, 'transparent');
115
+ const shadowSize = parseFloat((0, _figmaVariablesResolver.getVariableByName)(shadowSizeVar, modes)?.toString() || '0');
116
+ const shadowColor = resolveColor(shadowColorVar, 'transparent');
117
+
118
+ // Styles
119
+ const containerStyle = {
120
+ width,
121
+ height,
122
+ borderRadius: width / 2,
123
+ // 9999px -> circle
124
+ borderWidth,
125
+ borderColor,
126
+ backgroundColor,
127
+ justifyContent: 'center',
128
+ alignItems: 'center',
129
+ // Web shadow (ring)
130
+ ...(_reactNative.Platform.OS === 'web' && shadowSize > 0 ? {
131
+ boxShadow: `0px 0px 0px ${shadowSize}px ${shadowColor}`
132
+ } : {})
133
+ };
134
+ const selectorStyle = {
135
+ width: selectorSize,
136
+ height: selectorSize,
137
+ borderRadius: selectorSize / 2,
138
+ backgroundColor: selectorColor
139
+ };
140
+
141
+ // Dummy block for token extraction (static analysis)
142
+ if (false) {
143
+ (0, _figmaVariablesResolver.getVariableByName)('radio/idle/background/color');
144
+ (0, _figmaVariablesResolver.getVariableByName)('radio/idle/border/color');
145
+ (0, _figmaVariablesResolver.getVariableByName)('radio/selector/size');
146
+ (0, _figmaVariablesResolver.getVariableByName)('radio/width');
147
+ (0, _figmaVariablesResolver.getVariableByName)('radio/height');
148
+ (0, _figmaVariablesResolver.getVariableByName)('radio/background/color');
149
+ (0, _figmaVariablesResolver.getVariableByName)('radio/hover/background/color');
150
+ (0, _figmaVariablesResolver.getVariableByName)('radio/hover/border/color');
151
+ (0, _figmaVariablesResolver.getVariableByName)('radio/hover/boxShadow/size');
152
+ (0, _figmaVariablesResolver.getVariableByName)('radio/hover/shadow/color');
153
+ (0, _figmaVariablesResolver.getVariableByName)('radio/selected/background/color');
154
+ (0, _figmaVariablesResolver.getVariableByName)('radio/selected/border/color');
155
+ (0, _figmaVariablesResolver.getVariableByName)('radio/selected/selector/background/color');
156
+ (0, _figmaVariablesResolver.getVariableByName)('radio/hoverSelected/background/color');
157
+ (0, _figmaVariablesResolver.getVariableByName)('radio/hoverSelected/border/color');
158
+ (0, _figmaVariablesResolver.getVariableByName)('radio/hoverSelected/boxShadow/size');
159
+ (0, _figmaVariablesResolver.getVariableByName)('radio/hoverSelected/shadow/color');
160
+ (0, _figmaVariablesResolver.getVariableByName)('radio/hoverSelected/selector/background/color');
161
+ (0, _figmaVariablesResolver.getVariableByName)('radio/focus/background/color');
162
+ (0, _figmaVariablesResolver.getVariableByName)('radio/focus/border/color');
163
+ (0, _figmaVariablesResolver.getVariableByName)('radio/focus/border/size');
164
+ (0, _figmaVariablesResolver.getVariableByName)('radio/focus/boxShadow/size');
165
+ (0, _figmaVariablesResolver.getVariableByName)('radio/focus/shadow/color');
166
+ (0, _figmaVariablesResolver.getVariableByName)('radio/focusSelected/background/color');
167
+ (0, _figmaVariablesResolver.getVariableByName)('radio/focusSelected/selector/background/color');
168
+ (0, _figmaVariablesResolver.getVariableByName)('radio/focusSelected/border/size');
169
+ (0, _figmaVariablesResolver.getVariableByName)('radio/disabled/radio/disabled/border/size');
170
+ (0, _figmaVariablesResolver.getVariableByName)('radio/disabled/background/color');
171
+ (0, _figmaVariablesResolver.getVariableByName)('radio/disabled/border/color');
172
+ (0, _figmaVariablesResolver.getVariableByName)('radio/disabledSelected/selector/background/color');
173
+ (0, _figmaVariablesResolver.getVariableByName)('radio/disabledSelected/background');
174
+ (0, _figmaVariablesResolver.getVariableByName)('radio/disabledSelected/border/color');
175
+ }
176
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
177
+ testID: testID,
178
+ disabled: disabled,
179
+ onPress: onPress,
180
+ onHoverIn: () => setHovered(true),
181
+ onHoverOut: () => setHovered(false),
182
+ onFocus: () => setFocused(true),
183
+ onBlur: () => setFocused(false),
184
+ onPressIn: () => setPressed(true),
185
+ onPressOut: () => setPressed(false),
186
+ style: ({
187
+ pressed: isPressed
188
+ }) => [containerStyle, style],
189
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
190
+ style: selectorStyle
191
+ })
192
+ });
193
+ }
194
+ var _default = exports.default = Radio;