jfs-components 0.0.70 → 0.0.71

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 (43) hide show
  1. package/lib/commonjs/components/CardAdvisory/CardAdvisory.js +203 -0
  2. package/lib/commonjs/components/CardCTA/CardCTA.js +198 -16
  3. package/lib/commonjs/components/CircularProgressBar/CircularProgressBar.js +147 -0
  4. package/lib/commonjs/components/CircularProgressBarDoted/CircularProgressBarDoted.js +258 -0
  5. package/lib/commonjs/components/CircularRating/CircularRating.js +161 -0
  6. package/lib/commonjs/components/Gauge/Gauge.js +223 -0
  7. package/lib/commonjs/components/ListGroup/ListGroup.js +3 -1
  8. package/lib/commonjs/components/Nudge/Nudge.js +179 -87
  9. package/lib/commonjs/components/index.js +35 -0
  10. package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
  11. package/lib/commonjs/icons/registry.js +1 -1
  12. package/lib/module/components/CardAdvisory/CardAdvisory.js +197 -0
  13. package/lib/module/components/CardCTA/CardCTA.js +199 -17
  14. package/lib/module/components/CircularProgressBar/CircularProgressBar.js +141 -0
  15. package/lib/module/components/CircularProgressBarDoted/CircularProgressBarDoted.js +253 -0
  16. package/lib/module/components/CircularRating/CircularRating.js +155 -0
  17. package/lib/module/components/Gauge/Gauge.js +217 -0
  18. package/lib/module/components/ListGroup/ListGroup.js +3 -1
  19. package/lib/module/components/Nudge/Nudge.js +178 -87
  20. package/lib/module/components/index.js +5 -0
  21. package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
  22. package/lib/module/icons/registry.js +1 -1
  23. package/lib/typescript/src/components/CardAdvisory/CardAdvisory.d.ts +49 -0
  24. package/lib/typescript/src/components/CardCTA/CardCTA.d.ts +16 -1
  25. package/lib/typescript/src/components/CircularProgressBar/CircularProgressBar.d.ts +27 -0
  26. package/lib/typescript/src/components/CircularProgressBarDoted/CircularProgressBarDoted.d.ts +48 -0
  27. package/lib/typescript/src/components/CircularRating/CircularRating.d.ts +49 -0
  28. package/lib/typescript/src/components/Gauge/Gauge.d.ts +53 -0
  29. package/lib/typescript/src/components/Nudge/Nudge.d.ts +14 -11
  30. package/lib/typescript/src/components/index.d.ts +6 -1
  31. package/lib/typescript/src/icons/registry.d.ts +1 -1
  32. package/package.json +1 -1
  33. package/src/components/CardAdvisory/CardAdvisory.tsx +283 -0
  34. package/src/components/CardCTA/CardCTA.tsx +236 -13
  35. package/src/components/CircularProgressBar/CircularProgressBar.tsx +190 -0
  36. package/src/components/CircularProgressBarDoted/CircularProgressBarDoted.tsx +357 -0
  37. package/src/components/CircularRating/CircularRating.tsx +241 -0
  38. package/src/components/Gauge/Gauge.tsx +303 -0
  39. package/src/components/ListGroup/ListGroup.tsx +3 -1
  40. package/src/components/Nudge/Nudge.tsx +222 -82
  41. package/src/components/index.ts +6 -1
  42. package/src/design-tokens/Coin Variables-variables-full.json +1 -1
  43. 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;
@@ -87,6 +87,12 @@ Object.defineProperty(exports, "Card", {
87
87
  return _Card.default;
88
88
  }
89
89
  });
90
+ Object.defineProperty(exports, "CardAdvisory", {
91
+ enumerable: true,
92
+ get: function () {
93
+ return _CardAdvisory.default;
94
+ }
95
+ });
90
96
  Object.defineProperty(exports, "CardCTA", {
91
97
  enumerable: true,
92
98
  get: function () {
@@ -129,6 +135,24 @@ Object.defineProperty(exports, "ChipSelect", {
129
135
  return _ChipSelect.default;
130
136
  }
131
137
  });
138
+ Object.defineProperty(exports, "CircularProgressBar", {
139
+ enumerable: true,
140
+ get: function () {
141
+ return _CircularProgressBar.default;
142
+ }
143
+ });
144
+ Object.defineProperty(exports, "CircularProgressBarDoted", {
145
+ enumerable: true,
146
+ get: function () {
147
+ return _CircularProgressBarDoted.default;
148
+ }
149
+ });
150
+ Object.defineProperty(exports, "CircularRating", {
151
+ enumerable: true,
152
+ get: function () {
153
+ return _CircularRating.default;
154
+ }
155
+ });
132
156
  Object.defineProperty(exports, "DebitCard", {
133
157
  enumerable: true,
134
158
  get: function () {
@@ -177,6 +201,12 @@ Object.defineProperty(exports, "FormField", {
177
201
  return _FormField.default;
178
202
  }
179
203
  });
204
+ Object.defineProperty(exports, "Gauge", {
205
+ enumerable: true,
206
+ get: function () {
207
+ return _Gauge.default;
208
+ }
209
+ });
180
210
  Object.defineProperty(exports, "HStack", {
181
211
  enumerable: true,
182
212
  get: function () {
@@ -522,6 +552,7 @@ var _BottomNav = _interopRequireDefault(require("./BottomNav/BottomNav"));
522
552
  var _BottomNavItem = _interopRequireDefault(require("./BottomNavItem/BottomNavItem"));
523
553
  var _Button = _interopRequireDefault(require("./Button/Button"));
524
554
  var _Card = _interopRequireDefault(require("./Card/Card"));
555
+ var _CardAdvisory = _interopRequireDefault(require("./CardAdvisory/CardAdvisory"));
525
556
  var _Carousel = _interopRequireDefault(require("./Carousel/Carousel"));
526
557
  var _Checkbox = _interopRequireDefault(require("./Checkbox/Checkbox"));
527
558
  var _CardFeedback = _interopRequireDefault(require("./CardFeedback/CardFeedback"));
@@ -533,6 +564,10 @@ var _DebitCard = _interopRequireDefault(require("./DebitCard/DebitCard"));
533
564
  var _FilterBar = _interopRequireDefault(require("./FilterBar/FilterBar"));
534
565
  var _Form = _interopRequireWildcard(require("./Form/Form"));
535
566
  var _FormField = _interopRequireDefault(require("./FormField/FormField"));
567
+ var _CircularProgressBar = _interopRequireDefault(require("./CircularProgressBar/CircularProgressBar"));
568
+ var _CircularProgressBarDoted = _interopRequireDefault(require("./CircularProgressBarDoted/CircularProgressBarDoted"));
569
+ var _CircularRating = _interopRequireDefault(require("./CircularRating/CircularRating"));
570
+ var _Gauge = _interopRequireDefault(require("./Gauge/Gauge"));
536
571
  var _HoldingsCard = _interopRequireDefault(require("./HoldingsCard/HoldingsCard"));
537
572
  var _HStack = _interopRequireDefault(require("./HStack/HStack"));
538
573
  var _IconButton = _interopRequireDefault(require("./IconButton/IconButton"));