jfs-components 0.0.44 → 0.0.47

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 (125) hide show
  1. package/lib/commonjs/components/AmountInput/AmountInput.js +82 -0
  2. package/lib/commonjs/components/AmountInput/index.js +13 -0
  3. package/lib/commonjs/components/Button/Button.js +31 -28
  4. package/lib/commonjs/components/CardProviderInfo/CardProviderInfo.js +76 -0
  5. package/lib/commonjs/components/ChipSelect/ChipSelect.js +1 -2
  6. package/lib/commonjs/components/Drawer/demo.xml +18 -0
  7. package/lib/commonjs/components/EmptyState/EmptyState.js +2 -1
  8. package/lib/commonjs/components/FormField/FormField.js +1 -0
  9. package/lib/commonjs/components/NoteInput/NoteInput.js +1 -2
  10. package/lib/commonjs/components/Nudge/Nudge.js +143 -0
  11. package/lib/commonjs/components/OTP/OTP.js +242 -0
  12. package/lib/commonjs/components/PaymentFeedback/PaymentFeedback.js +148 -0
  13. package/lib/commonjs/components/PortfolioHero/PortfolioHero.js +78 -0
  14. package/lib/commonjs/components/ProductLabel/ProductLabel.js +50 -0
  15. package/lib/commonjs/components/ProgressBadge/ProgressBadge.js +130 -0
  16. package/lib/commonjs/components/ProgressBadge/index.js +25 -0
  17. package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +131 -0
  18. package/lib/commonjs/components/StatItem/StatItem.js +61 -0
  19. package/lib/commonjs/components/SupportText/SupportTextIcon.js +2 -3
  20. package/lib/commonjs/components/SwappableAmount/SwappableAmount.js +71 -0
  21. package/lib/commonjs/components/Text/Text.js +44 -0
  22. package/lib/commonjs/components/{PageTitle/PageTitle.js → Title/Title.js} +21 -20
  23. package/lib/commonjs/components/Toggle/Toggle.js +102 -0
  24. package/lib/commonjs/components/UpiHandle/UpiHandle.js +5 -2
  25. package/lib/commonjs/components/index.js +115 -3
  26. package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -0
  27. package/lib/commonjs/design-tokens/figma-variables-resolver.js +1 -1
  28. package/lib/commonjs/icons/registry.js +1 -1
  29. package/lib/commonjs/index.js +12 -0
  30. package/lib/commonjs/utils/index.js +18 -0
  31. package/lib/module/components/AmountInput/AmountInput.js +77 -0
  32. package/lib/module/components/AmountInput/index.js +3 -0
  33. package/lib/module/components/Button/Button.js +31 -28
  34. package/lib/module/components/CardProviderInfo/CardProviderInfo.js +71 -0
  35. package/lib/module/components/ChipSelect/ChipSelect.js +1 -2
  36. package/lib/module/components/Drawer/demo.xml +18 -0
  37. package/lib/module/components/EmptyState/EmptyState.js +2 -1
  38. package/lib/module/components/FormField/FormField.js +1 -0
  39. package/lib/module/components/NoteInput/NoteInput.js +1 -2
  40. package/lib/module/components/Nudge/Nudge.js +138 -0
  41. package/lib/module/components/OTP/OTP.js +236 -0
  42. package/lib/module/components/PaymentFeedback/PaymentFeedback.js +142 -0
  43. package/lib/module/components/PortfolioHero/PortfolioHero.js +73 -0
  44. package/lib/module/components/ProductLabel/ProductLabel.js +45 -0
  45. package/lib/module/components/ProgressBadge/ProgressBadge.js +125 -0
  46. package/lib/module/components/ProgressBadge/index.js +4 -0
  47. package/lib/module/components/SegmentedControl/SegmentedControl.js +126 -0
  48. package/lib/module/components/StatItem/StatItem.js +56 -0
  49. package/lib/module/components/SupportText/SupportTextIcon.js +2 -3
  50. package/lib/module/components/SwappableAmount/SwappableAmount.js +66 -0
  51. package/lib/module/components/Text/Text.js +39 -0
  52. package/lib/module/components/{PageTitle/PageTitle.js → Title/Title.js} +21 -20
  53. package/lib/module/components/Toggle/Toggle.js +97 -0
  54. package/lib/module/components/UpiHandle/UpiHandle.js +5 -2
  55. package/lib/module/components/index.js +18 -2
  56. package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -0
  57. package/lib/module/design-tokens/figma-variables-resolver.js +1 -1
  58. package/lib/module/icons/registry.js +1 -1
  59. package/lib/module/index.js +2 -1
  60. package/lib/module/utils/index.js +3 -0
  61. package/lib/typescript/src/components/AmountInput/AmountInput.d.ts +23 -0
  62. package/lib/typescript/src/components/AmountInput/index.d.ts +3 -0
  63. package/lib/typescript/src/components/CardProviderInfo/CardProviderInfo.d.ts +24 -0
  64. package/lib/typescript/src/components/ChipSelect/ChipSelect.d.ts +1 -6
  65. package/lib/typescript/src/components/EmptyState/EmptyState.d.ts +6 -1
  66. package/lib/typescript/src/components/LinearMeter/LinearMeter.d.ts +1 -1
  67. package/lib/typescript/src/components/Nudge/Nudge.d.ts +31 -0
  68. package/lib/typescript/src/components/OTP/OTP.d.ts +36 -0
  69. package/lib/typescript/src/components/PaymentFeedback/PaymentFeedback.d.ts +23 -0
  70. package/lib/typescript/src/components/PortfolioHero/PortfolioHero.d.ts +21 -0
  71. package/lib/typescript/src/components/ProductLabel/ProductLabel.d.ts +14 -0
  72. package/lib/typescript/src/components/ProgressBadge/ProgressBadge.d.ts +36 -0
  73. package/lib/typescript/src/components/ProgressBadge/index.d.ts +3 -0
  74. package/lib/typescript/src/components/RechargeCard/RechargeCard.d.ts +1 -2
  75. package/lib/typescript/src/components/SegmentedControl/SegmentedControl.d.ts +49 -0
  76. package/lib/typescript/src/components/StatItem/StatItem.d.ts +21 -0
  77. package/lib/typescript/src/components/SupportText/SupportText.d.ts +1 -1
  78. package/lib/typescript/src/components/SupportText/SupportTextIcon.d.ts +1 -1
  79. package/lib/typescript/src/components/SwappableAmount/SwappableAmount.d.ts +22 -0
  80. package/lib/typescript/src/components/Text/Text.d.ts +16 -0
  81. package/lib/typescript/src/components/Title/Title.d.ts +16 -0
  82. package/lib/typescript/src/components/Toggle/Toggle.d.ts +29 -0
  83. package/lib/typescript/src/components/UpiHandle/UpiHandle.d.ts +3 -1
  84. package/lib/typescript/src/components/index.d.ts +22 -5
  85. package/lib/typescript/src/icons/registry.d.ts +1 -1
  86. package/lib/typescript/src/index.d.ts +1 -0
  87. package/lib/typescript/src/utils/index.d.ts +2 -0
  88. package/package.json +2 -2
  89. package/src/components/AmountInput/AmountInput.tsx +81 -0
  90. package/src/components/AmountInput/index.ts +2 -0
  91. package/src/components/Button/Button.tsx +27 -20
  92. package/src/components/CardProviderInfo/CardProviderInfo.tsx +81 -0
  93. package/src/components/ChipSelect/ChipSelect.tsx +1 -8
  94. package/src/components/Drawer/demo.xml +18 -0
  95. package/src/components/EmptyState/EmptyState.tsx +7 -1
  96. package/src/components/FormField/FormField.tsx +1 -0
  97. package/src/components/LinearMeter/LinearMeter.tsx +1 -1
  98. package/src/components/NoteInput/NoteInput.tsx +1 -1
  99. package/src/components/Nudge/Nudge.tsx +150 -0
  100. package/src/components/OTP/OTP.tsx +275 -0
  101. package/src/components/PaymentFeedback/PaymentFeedback.tsx +168 -0
  102. package/src/components/PortfolioHero/PortfolioHero.tsx +91 -0
  103. package/src/components/ProductLabel/ProductLabel.tsx +58 -0
  104. package/src/components/ProgressBadge/ProgressBadge.tsx +172 -0
  105. package/src/components/ProgressBadge/index.ts +2 -0
  106. package/src/components/RechargeCard/RechargeCard.tsx +1 -1
  107. package/src/components/SegmentedControl/SegmentedControl.tsx +168 -0
  108. package/src/components/StatItem/StatItem.tsx +71 -0
  109. package/src/components/SupportText/SupportText.tsx +1 -1
  110. package/src/components/SupportText/SupportTextIcon.tsx +4 -3
  111. package/src/components/SwappableAmount/SwappableAmount.tsx +92 -0
  112. package/src/components/Text/Text.tsx +57 -0
  113. package/src/components/{PageTitle/PageTitle.tsx → Title/Title.tsx} +25 -19
  114. package/src/components/Toggle/Toggle.tsx +122 -0
  115. package/src/components/UpiHandle/UpiHandle.tsx +6 -2
  116. package/src/components/index.ts +22 -5
  117. package/src/design-tokens/Coin Variables-variables-full.json +1 -0
  118. package/src/design-tokens/figma-variables-resolver.ts +1 -1
  119. package/src/icons/registry.ts +1 -1
  120. package/src/index.ts +1 -0
  121. package/src/utils/index.ts +1 -0
  122. package/lib/commonjs/design-tokens/JFS Variables-variables-full.json +0 -1
  123. package/lib/module/design-tokens/JFS Variables-variables-full.json +0 -1
  124. package/lib/typescript/src/components/PageTitle/PageTitle.d.ts +0 -29
  125. package/src/design-tokens/JFS Variables-variables-full.json +0 -1
@@ -45,4 +45,16 @@ Object.keys(_Containers).forEach(function (key) {
45
45
  }
46
46
  });
47
47
  });
48
+ var _utils = require("./utils");
49
+ Object.keys(_utils).forEach(function (key) {
50
+ if (key === "default" || key === "__esModule") return;
51
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
52
+ if (key in exports && exports[key] === _utils[key]) return;
53
+ Object.defineProperty(exports, key, {
54
+ enumerable: true,
55
+ get: function () {
56
+ return _utils[key];
57
+ }
58
+ });
59
+ });
48
60
  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); }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "cloneChildrenWithModes", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _reactUtils.cloneChildrenWithModes;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "flattenChildren", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _reactUtils.flattenChildren;
16
+ }
17
+ });
18
+ var _reactUtils = require("./react-utils");
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ import React from 'react';
4
+ import { View } from 'react-native';
5
+ import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
6
+ import { useTokens } from '../../design-tokens/JFSThemeProvider';
7
+ import MoneyValue from '../MoneyValue/MoneyValue';
8
+ import NoteInput from '../NoteInput/NoteInput';
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ /**
11
+ * AmountInput component that combines MoneyValue and NoteInput from Figma design.
12
+ *
13
+ * @component
14
+ */
15
+ export default function AmountInput({
16
+ moneyValueSlot,
17
+ noteInputSlot,
18
+ modes: propModes = {},
19
+ style
20
+ }) {
21
+ const {
22
+ modes: globalModes
23
+ } = useTokens();
24
+ const modes = {
25
+ ...globalModes,
26
+ ...propModes
27
+ };
28
+
29
+ // Resolve tokens
30
+ const gap = Number(getVariableByName('amountInput/gap', modes)) || 16;
31
+ const paddingHorizontal = Number(getVariableByName('amountInput/padding/horizontal', modes)) || 0;
32
+ const paddingVertical = Number(getVariableByName('amountInput/padding/vertical', modes)) || 0;
33
+ const containerStyle = {
34
+ flexDirection: 'column',
35
+ alignItems: 'center',
36
+ gap,
37
+ paddingHorizontal,
38
+ paddingVertical,
39
+ ...style
40
+ };
41
+
42
+ // Handle MoneyValue Slot
43
+ const renderMoneyValueSlot = () => {
44
+ if (/*#__PURE__*/React.isValidElement(moneyValueSlot)) {
45
+ return /*#__PURE__*/React.cloneElement(moneyValueSlot, {
46
+ modes
47
+ });
48
+ }
49
+ // Default fallback if no slot prop is provided
50
+ if (!moneyValueSlot) {
51
+ return /*#__PURE__*/_jsx(MoneyValue, {
52
+ modes: modes
53
+ });
54
+ }
55
+ return moneyValueSlot;
56
+ };
57
+
58
+ // Handle NoteInput Slot
59
+ const renderNoteInputSlot = () => {
60
+ if (/*#__PURE__*/React.isValidElement(noteInputSlot)) {
61
+ return /*#__PURE__*/React.cloneElement(noteInputSlot, {
62
+ modes
63
+ });
64
+ }
65
+ // Default fallback if no slot prop is provided
66
+ if (!noteInputSlot) {
67
+ return /*#__PURE__*/_jsx(NoteInput, {
68
+ modes: modes
69
+ });
70
+ }
71
+ return noteInputSlot;
72
+ };
73
+ return /*#__PURE__*/_jsxs(View, {
74
+ style: containerStyle,
75
+ children: [renderMoneyValueSlot(), renderNoteInputSlot()]
76
+ });
77
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ export { default } from './AmountInput';
@@ -59,8 +59,28 @@ function Button({
59
59
  const textColor = getVariableByName('button/foreground', modes) || '#0f0d0a';
60
60
  const iconColor = getVariableByName('button/icon/color', modes) ?? textColor;
61
61
  const iconSize = getVariableByName('button/icon/size', modes) ?? 18;
62
+ const [isHovered, setIsHovered] = useState(false);
63
+ const [isPressed, setIsPressed] = useState(false);
64
+ const hoverModes = {
65
+ ...modes,
66
+ "Button / State": "Hover"
67
+ };
68
+ const hoverBg = getVariableByName('button/background', hoverModes) || backgroundColor;
69
+ const hoverBorderColor = getVariableByName('button/border/color', hoverModes) || borderColor;
70
+ const hoverTextColor = getVariableByName('button/foreground', hoverModes) || textColor;
71
+ const hoverIconColor = getVariableByName('button/icon/color', hoverModes) ?? hoverTextColor;
72
+ const pressedModes = {
73
+ ...modes,
74
+ "Button / State": "Pressed"
75
+ };
76
+ const pressedBg = getVariableByName('button/background', pressedModes) || backgroundColor;
77
+ const pressedBorderColor = getVariableByName('button/border/color', pressedModes) || borderColor;
78
+ const pressedTextColor = getVariableByName('button/foreground', pressedModes) || textColor;
79
+ const pressedIconColor = getVariableByName('button/icon/color', pressedModes) ?? pressedTextColor;
80
+ const activeTextColor = isPressed && !disabled ? pressedTextColor : isHovered && !disabled ? hoverTextColor : textColor;
81
+ const activeIconColor = isPressed && !disabled ? pressedIconColor : isHovered && !disabled ? hoverIconColor : iconColor;
62
82
  const baseLabelTextStyle = {
63
- color: textColor,
83
+ color: activeTextColor,
64
84
  fontFamily,
65
85
  fontWeight,
66
86
  fontSize,
@@ -114,22 +134,13 @@ function Button({
114
134
  accessibilityLabel: defaultAccessibilityLabel,
115
135
  webAccessibilityProps
116
136
  });
117
-
118
- // Interaction states (placeholders for visuals; tweak later)
119
- const [isFocused, setIsFocused] = useState(false);
120
- const [isHovered, setIsHovered] = useState(false);
121
- const pressedStyle = {
122
- transform: [{
123
- scale: 0.995
124
- }],
125
- backgroundColor: '#b88940'
126
- };
127
- const focusStyle = {
128
- borderWidth: 1,
129
- borderColor: '#222'
130
- };
131
137
  const hoverStyle = {
132
- opacity: 0.95
138
+ backgroundColor: hoverBg,
139
+ borderColor: hoverBorderColor
140
+ };
141
+ const pressedStyle = {
142
+ backgroundColor: pressedBg,
143
+ borderColor: pressedBorderColor
133
144
  };
134
145
  if (__DEV__) {
135
146
  if (children && labelStyle) {
@@ -154,21 +165,13 @@ function Button({
154
165
  onPress
155
166
  } : {}),
156
167
  onPressIn: e => {
157
- ;
168
+ setIsPressed(true);
158
169
  rest?.onPressIn?.(e);
159
170
  },
160
171
  onPressOut: e => {
161
- ;
172
+ setIsPressed(false);
162
173
  rest?.onPressOut?.(e);
163
174
  },
164
- onFocus: e => {
165
- setIsFocused(true);
166
- rest?.onFocus?.(e);
167
- },
168
- onBlur: e => {
169
- setIsFocused(false);
170
- rest?.onBlur?.(e);
171
- },
172
175
  onHoverIn: e => {
173
176
  setIsHovered(true);
174
177
  rest?.onHoverIn?.(e);
@@ -179,7 +182,7 @@ function Button({
179
182
  },
180
183
  style: ({
181
184
  pressed
182
- }) => [containerBaseStyle, pressed && !disabled ? pressedStyle : null, isHovered && !disabled ? hoverStyle : null, isFocused && !disabled ? focusStyle : null, style],
185
+ }) => [containerBaseStyle, isHovered && !disabled ? hoverStyle : null, (pressed || isPressed) && !disabled ? pressedStyle : null, style],
183
186
  ...webProps,
184
187
  children: [leading ? /*#__PURE__*/_jsx(View, {
185
188
  style: leadingAccessoryStyle,
@@ -189,7 +192,7 @@ function Button({
189
192
  children: /*#__PURE__*/_jsx(Icon, {
190
193
  name: icon,
191
194
  size: iconSize,
192
- color: iconColor,
195
+ color: activeIconColor,
193
196
  accessibilityElementsHidden: true,
194
197
  importantForAccessibility: "no"
195
198
  })
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ import React from 'react';
4
+ import { View } from 'react-native';
5
+ import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
6
+ import ProductLabel from '../ProductLabel/ProductLabel';
7
+ import { cloneChildrenWithModes } from '../../utils/react-utils';
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ /**
10
+ * CardProviderInfo displays a product header (ProductLabel) followed by a
11
+ * 2-column grid of children (typically StatItem instances).
12
+ *
13
+ * @component
14
+ * @param {CardProviderInfoProps} props
15
+ */
16
+ function CardProviderInfo({
17
+ label = 'Gold',
18
+ imageSource,
19
+ children,
20
+ modes = {},
21
+ style
22
+ }) {
23
+ const background = getVariableByName('card/providerInfo/background', modes) ?? '#fef4e5';
24
+ const border = getVariableByName('card/providerInfo/border', modes) ?? '#fef4e5';
25
+ const borderWidthVal = getVariableByName('card/providerInfo/borderWidth', modes) ?? 1;
26
+ const padding = getVariableByName('card/providerInfo/padding', modes) ?? 20;
27
+ const gap = getVariableByName('card/providerInfo/gap', modes) ?? 20;
28
+ const radius = getVariableByName('card/providerInfo/radius', modes) ?? 16;
29
+ const gridGap = getVariableByName('card/providerInfo/grid/gap', modes) ?? 8;
30
+ const containerStyle = {
31
+ backgroundColor: background,
32
+ borderColor: border,
33
+ borderWidth: borderWidthVal,
34
+ borderStyle: 'solid',
35
+ padding: padding,
36
+ gap: gap,
37
+ borderRadius: radius
38
+ };
39
+ const gridGapNum = gridGap;
40
+ const clonedChildren = children ? cloneChildrenWithModes(children, modes) : [];
41
+ const childArray = React.Children.toArray(clonedChildren);
42
+ const rows = [];
43
+ for (let i = 0; i < childArray.length; i += 2) {
44
+ rows.push(childArray.slice(i, i + 2));
45
+ }
46
+ return /*#__PURE__*/_jsxs(View, {
47
+ style: [containerStyle, style],
48
+ children: [/*#__PURE__*/_jsx(ProductLabel, {
49
+ label: label,
50
+ imageSource: imageSource,
51
+ modes: modes
52
+ }), childArray.length > 0 && /*#__PURE__*/_jsx(View, {
53
+ style: {
54
+ rowGap: gridGapNum
55
+ },
56
+ children: rows.map((row, i) => /*#__PURE__*/_jsx(View, {
57
+ style: {
58
+ flexDirection: 'row',
59
+ columnGap: gridGapNum
60
+ },
61
+ children: row.map((child, j) => /*#__PURE__*/_jsx(View, {
62
+ style: {
63
+ flex: 1
64
+ },
65
+ children: child
66
+ }, j))
67
+ }, i))
68
+ })]
69
+ });
70
+ }
71
+ export default CardProviderInfo;
@@ -13,7 +13,6 @@ function ChipSelect({
13
13
  label = 'Date',
14
14
  active = false,
15
15
  icon = 'ic_calendar_week',
16
- close = true,
17
16
  modes = {},
18
17
  style,
19
18
  labelSlot,
@@ -87,7 +86,7 @@ function ChipSelect({
87
86
  name: icon,
88
87
  size: iconSize,
89
88
  color: textColor
90
- }), renderLabel(), active && close && /*#__PURE__*/_jsx(Icon, {
89
+ }), renderLabel(), active && /*#__PURE__*/_jsx(Icon, {
91
90
  name: "ic_close",
92
91
  size: iconSize,
93
92
  color: textColor
@@ -0,0 +1,18 @@
1
+ <design>
2
+ <ListItem layout="Horizontal" leadingType="Avatar" navArrow="false" showSupportText="true" start="true" supportText="Support Text" title="Aasa Singh" trailing="true">
3
+ <Avatar monogram="MS" style="Image"></Avatar>
4
+ <frame horizontalSizing="FILL" name="text wrap" verticalSizing="HUG">
5
+ <slot name="supportText">
6
+ <text name="support text">₹10,000</text>
7
+ </slot>
8
+ <text name="Title">Aasa Singh</text>
9
+ </frame>
10
+ <frame horizontalSizing="HUG" modes='{"Context":"ListItem"}' name="end wrap" verticalSizing="HUG">
11
+ <slot name="slot">
12
+ <Button label="Button">
13
+ <text name="Label">Button</text>
14
+ </Button>
15
+ </slot>
16
+ </frame>
17
+ </ListItem>
18
+ </design>
@@ -15,6 +15,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
15
  function EmptyState({
16
16
  title = "No payments to show",
17
17
  description = "Start by paying bills, recharge or your friends",
18
+ showDescription = true,
18
19
  iconSlot,
19
20
  buttonSlot,
20
21
  modes: propModes = {},
@@ -110,7 +111,7 @@ function EmptyState({
110
111
  children: [iconContent, /*#__PURE__*/_jsx(Text, {
111
112
  style: titleStyle,
112
113
  children: title
113
- }), description ? /*#__PURE__*/_jsx(Text, {
114
+ }), showDescription && description ? /*#__PURE__*/_jsx(Text, {
114
115
  style: bodyStyle,
115
116
  children: description
116
117
  }) : null]
@@ -81,6 +81,7 @@ function useFormField(props) {
81
81
  borderWidth: inputBorderSize,
82
82
  borderRadius: inputRadius,
83
83
  paddingHorizontal: inputPaddingH,
84
+ paddingVertical: 0,
84
85
  gap: inputGap
85
86
  }), [inputBackground, inputBorderColor, inputBorderSize, inputRadius, inputPaddingH, inputGap]);
86
87
  const inputTextStyle = useMemo(() => ({
@@ -47,9 +47,8 @@ export default function NoteInput({
47
47
  backgroundColor: background,
48
48
  borderWidth: borderSize,
49
49
  borderColor: borderColor,
50
- gap: gap,
50
+ gap: gap
51
51
  // Add specific width when editing if requested by Figma design logic, though flex fits content generically
52
- alignSelf: 'flex-start'
53
52
  };
54
53
  const baseTextStyle = {
55
54
  color: foreground,
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+
3
+ import React from 'react';
4
+ import { View, Text } from 'react-native';
5
+ import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
6
+ import { useTokens } from '../../design-tokens/JFSThemeProvider';
7
+ import { cloneChildrenWithModes } from '../../utils/react-utils';
8
+ import Button from '../Button/Button';
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ function Nudge({
11
+ variant = 'Default',
12
+ title = 'Split payment',
13
+ body = 'Split this transaction into installments',
14
+ buttonLabel = 'Button',
15
+ onPressButton,
16
+ buttonSlot,
17
+ startSlot,
18
+ children,
19
+ modes: propModes = {},
20
+ style
21
+ }) {
22
+ const {
23
+ modes: globalModes
24
+ } = useTokens();
25
+ const modes = {
26
+ ...globalModes,
27
+ ...propModes
28
+ };
29
+ const background = getVariableByName('nudge/background', modes) || '#f5f5f5';
30
+ const radius = getVariableByName('nudge/radius', modes) || 12;
31
+ const paddingH = getVariableByName('nudge/padding/horizontal', modes) || 12;
32
+ const paddingV = getVariableByName('nudge/padding/vertical', modes) || 12;
33
+ const gap = getVariableByName('nudge/gap', modes) || 6;
34
+ const titleColor = getVariableByName('nudge/title/color', modes) || '#0d0d0f';
35
+ const titleFontSize = getVariableByName('nudge/title/fontSize', modes) || 14;
36
+ const titleFontFamily = getVariableByName('nudge/title/fontFamily', modes) || 'JioType Var';
37
+ const titleLineHeight = getVariableByName('nudge/title/lineHeight', modes) || 15;
38
+ const titleFontWeightRaw = getVariableByName('nudge/title/fontWeight', modes) || 700;
39
+ const titleFontWeight = typeof titleFontWeightRaw === 'number' ? titleFontWeightRaw.toString() : titleFontWeightRaw;
40
+ const bodyColor = getVariableByName('nudge/body/color', modes) || '#1a1c1f';
41
+ const bodyFontSize = getVariableByName('nudge/body/fontSize', modes) || 12;
42
+ const bodyFontFamily = getVariableByName('nudge/body/fontFamily', modes) || 'JioType Var';
43
+ const bodyLineHeight = getVariableByName('nudge/body/lineHeight', modes) || 16;
44
+ const bodyFontWeightRaw = getVariableByName('nudge/body/fontWeight', modes) || 500;
45
+ const bodyFontWeight = typeof bodyFontWeightRaw === 'number' ? bodyFontWeightRaw.toString() : bodyFontWeightRaw;
46
+ const textGap = getVariableByName('nudge/text/gap', modes) || 4;
47
+ const contentGap = getVariableByName('nudge/content/gap', modes) || 8;
48
+ const contentMinHeight = getVariableByName('nudge/content/minHeight', modes) || 20;
49
+ const containerStyle = {
50
+ backgroundColor: background,
51
+ borderRadius: radius,
52
+ paddingHorizontal: paddingH,
53
+ paddingVertical: paddingV,
54
+ gap,
55
+ overflow: 'hidden',
56
+ ...(variant === 'Variant2' ? {
57
+ flexDirection: 'column',
58
+ alignItems: 'flex-start'
59
+ } : {
60
+ flexDirection: 'row',
61
+ alignItems: 'flex-start'
62
+ })
63
+ };
64
+ const titleStyle = {
65
+ color: titleColor,
66
+ fontSize: titleFontSize,
67
+ fontFamily: titleFontFamily,
68
+ lineHeight: titleLineHeight,
69
+ fontWeight: titleFontWeight
70
+ };
71
+ const bodyStyle = {
72
+ color: bodyColor,
73
+ fontSize: bodyFontSize,
74
+ fontFamily: bodyFontFamily,
75
+ lineHeight: bodyLineHeight,
76
+ fontWeight: bodyFontWeight
77
+ };
78
+ const processedStartSlot = startSlot ? cloneChildrenWithModes(React.Children.toArray(startSlot), modes) : null;
79
+ const startSlotElement = processedStartSlot && processedStartSlot.length > 0 ? processedStartSlot.length === 1 ? processedStartSlot[0] : processedStartSlot : null;
80
+ if (variant === 'Variant2') {
81
+ return /*#__PURE__*/_jsxs(View, {
82
+ style: [containerStyle, style],
83
+ children: [/*#__PURE__*/_jsxs(View, {
84
+ style: {
85
+ flexDirection: 'row',
86
+ alignItems: 'center',
87
+ gap: 6,
88
+ width: '100%'
89
+ },
90
+ children: [startSlotElement, /*#__PURE__*/_jsx(Text, {
91
+ style: [titleStyle, {
92
+ flex: 1
93
+ }],
94
+ children: title
95
+ })]
96
+ }), children ? cloneChildrenWithModes(React.Children.toArray(children), modes) : null]
97
+ });
98
+ }
99
+ const defaultContent = /*#__PURE__*/_jsxs(View, {
100
+ style: {
101
+ gap: contentGap,
102
+ alignItems: 'flex-start',
103
+ width: '100%'
104
+ },
105
+ children: [/*#__PURE__*/_jsxs(View, {
106
+ style: {
107
+ gap: textGap,
108
+ alignItems: 'flex-start',
109
+ width: '100%'
110
+ },
111
+ children: [/*#__PURE__*/_jsx(Text, {
112
+ style: titleStyle,
113
+ children: title
114
+ }), /*#__PURE__*/_jsx(Text, {
115
+ style: bodyStyle,
116
+ children: body
117
+ })]
118
+ }), buttonSlot ? cloneChildrenWithModes(React.Children.toArray(buttonSlot), modes) : /*#__PURE__*/_jsx(Button, {
119
+ label: buttonLabel,
120
+ onPress: onPressButton,
121
+ modes: modes
122
+ })]
123
+ });
124
+ return /*#__PURE__*/_jsxs(View, {
125
+ style: [containerStyle, style],
126
+ children: [startSlotElement, /*#__PURE__*/_jsx(View, {
127
+ style: {
128
+ flex: 1,
129
+ minWidth: 1,
130
+ minHeight: contentMinHeight,
131
+ justifyContent: 'center',
132
+ overflow: 'hidden'
133
+ },
134
+ children: children ? cloneChildrenWithModes(React.Children.toArray(children), modes) : defaultContent
135
+ })]
136
+ });
137
+ }
138
+ export default Nudge;