jfs-components 0.0.86 → 0.0.95

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 CHANGED
@@ -4,6 +4,14 @@ All notable changes to this project are documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
+ ## [0.0.95] - 2026-06-04
8
+
9
+ - Added `Icon` — token-driven design-system icon primitive (`iconName`, `source`, `children` slot); exported from the package barrel.
10
+ - `FullscreenModal` — `heroMedia` is now a full-bleed continuous background behind hero + body; foreground scrolls over it; defaults `Page type` to `JioPlus`; transparent body (removed solid `backgroundColor`).
11
+ - Added `src/assets.d.ts` for TypeScript `require()` of image assets.
12
+
13
+ ---
14
+
7
15
  ## [0.0.86] - 2026-06-04
8
16
 
9
17
  - Added `AllocationComparisonChart` — vertical pill bars comparing current vs recommended allocation with optional baseline overlay and dashed marker.
@@ -0,0 +1 @@
1
+ "use strict";
@@ -33,6 +33,19 @@ const FULLSCREEN_MODAL_FORCED_MODES = Object.freeze({
33
33
  context5: 'Fullscreen Modal'
34
34
  });
35
35
 
36
+ // ---------------------------------------------------------------------------
37
+ // Default modes
38
+ //
39
+ // A FullscreenModal is a "JioPlus" surface, so it defaults the `Page type`
40
+ // collection to `'JioPlus'`. Unlike the forced modes above this IS
41
+ // overridable — it is applied before the caller's `modes`, so passing
42
+ // `modes={{ 'Page type': 'SubPage' }}` still wins. Frozen for stable identity
43
+ // (keeps the token resolver's per-modes cache hot).
44
+ // ---------------------------------------------------------------------------
45
+ const FULLSCREEN_MODAL_DEFAULT_MODES = Object.freeze({
46
+ 'Page type': 'JioPlus'
47
+ });
48
+
36
49
  // ---------------------------------------------------------------------------
37
50
  // Hero text — the eyebrow / headline / supporting / price block. Built inline
38
51
  // (rather than reusing <PageHero>) so we can render BOTH a supporting
@@ -132,12 +145,21 @@ function HeroText({
132
145
  * That mode is cascaded into `children`, the footer, and the hero text via
133
146
  * `cloneChildrenWithModes` / the merged `modes` object.
134
147
  *
135
- * ### Hero
136
- * The `heroMedia` is rendered full modal width inside the scroll body and
137
- * takes its height from its own aspect ratio. The hero text (eyebrow /
138
- * headline / supporting / price) is overlaid on top, anchored to the bottom.
139
- * The whole hero scrolls together with the rest of the content there is no
140
- * parallax effect.
148
+ * ### Background media
149
+ * The `heroMedia` is a single full-bleed background pinned to the top of the
150
+ * modal at the full width and its own natural aspect ratio. It lives at the
151
+ * ROOT behind both the scrolling content and the (transparent) footer so
152
+ * it fills the whole surface and is NEVER clipped to the content height. It
153
+ * also contributes ZERO scroll height: the scroll extent is driven purely by
154
+ * the in-flow foreground (hero text + `children`), so the number of body
155
+ * elements dictates how far the surface scrolls. It still scrolls in lockstep
156
+ * WITH the content (the background is translated by the scroll offset), so the
157
+ * content reads as sitting ON one continuous image that moves with it — there
158
+ * is no parallax and no separate solid body box.
159
+ *
160
+ * Pass a background sized to the full width at its natural ratio
161
+ * (e.g. `<Image imageSource={bg} ratio={1080 / 4140} />`). Use an asset at
162
+ * least as tall as the surface so it covers the full modal.
141
163
  *
142
164
  * @component
143
165
  * @example
@@ -147,7 +169,7 @@ function HeroText({
147
169
  * headline="Get more from your money."
148
170
  * supportingText="JioFinance+ is your upgraded financial experience…"
149
171
  * priceText="₹999/year · ₹0 until 2027"
150
- * heroMedia={<Image imageSource={hero} ratio={3 / 4} />}
172
+ * heroMedia={<Image imageSource={hero} ratio={1080 / 4140} />}
151
173
  * primaryActionLabel="Upgrade for free"
152
174
  * disclaimer="By upgrading, we'll check your eligibility with Experian."
153
175
  * onPrimaryAction={() => upgrade()}
@@ -172,7 +194,6 @@ function FullscreenModal({
172
194
  primaryActionLabel = 'Upgrade for free',
173
195
  onPrimaryAction,
174
196
  disclaimer = "By upgrading, we'll check your eligibility with Experian.",
175
- backgroundColor = '#0f0d0a',
176
197
  children,
177
198
  modes: propModes = _reactUtils.EMPTY_MODES,
178
199
  style,
@@ -183,31 +204,56 @@ function FullscreenModal({
183
204
  modes: globalModes
184
205
  } = (0, _JFSThemeProvider.useTokens)();
185
206
 
186
- // context5 is appended last so it always wins, regardless of what the
187
- // caller (or the global theme) passes.
207
+ // Merge order (low high priority):
208
+ // global theme → component defaults (Page type: JioPlus) → caller modes →
209
+ // forced modes (context5). So `Page type` defaults to JioPlus but the
210
+ // caller can override it, while `context5` always wins. This single `modes`
211
+ // object is what cascades to the body, hero media, and the ActionFooter.
188
212
  const modes = (0, _react.useMemo)(() => ({
189
213
  ...globalModes,
214
+ ...FULLSCREEN_MODAL_DEFAULT_MODES,
190
215
  ...propModes,
191
216
  ...FULLSCREEN_MODAL_FORCED_MODES
192
217
  }), [globalModes, propModes]);
193
218
  const rootGap = Number((0, _figmaVariablesResolver.getVariableByName)('fullScreenModal/gap', modes)) || 16;
219
+
220
+ // Drives the background's parallax-free sync with the scroll. The hero media
221
+ // lives at the ROOT (so it is never clipped to the content height and sits
222
+ // behind the transparent footer), but we translate it up by the exact scroll
223
+ // offset so it moves in lockstep with the content — i.e. it scrolls WITH the
224
+ // body without ever contributing to the scroll height.
225
+ const scrollY = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
226
+ const onScroll = (0, _react.useMemo)(() => _reactNative.Animated.event([{
227
+ nativeEvent: {
228
+ contentOffset: {
229
+ y: scrollY
230
+ }
231
+ }
232
+ }], {
233
+ useNativeDriver: true
234
+ }), [scrollY]);
235
+ const heroTranslateY = (0, _react.useMemo)(() => _reactNative.Animated.multiply(scrollY, -1), [scrollY]);
194
236
  const processedHeroMedia = (0, _react.useMemo)(() => heroMedia ? (0, _reactUtils.cloneChildrenWithModes)(heroMedia, modes, FULLSCREEN_MODAL_FORCED_MODES) : null, [heroMedia, modes]);
195
237
  const processedChildren = (0, _react.useMemo)(() => children ? (0, _reactUtils.cloneChildrenWithModes)(children, modes, FULLSCREEN_MODAL_FORCED_MODES) : null, [children, modes]);
196
238
 
197
- // No-media fallback: without hero media the text region needs an explicit
198
- // resting height (driven by `heroHeight`) so the hero still has presence.
199
- const heroTextFallbackStyle = (0, _react.useMemo)(() => ({
239
+ // The hero text region always reserves `heroHeight` and anchors its content
240
+ // to the bottom, so the eyebrow/headline block sits in the lower part of the
241
+ // first screenful — over the background media when present, in flow
242
+ // otherwise.
243
+ const heroTextRegionStyle = (0, _react.useMemo)(() => ({
200
244
  minHeight: heroHeight,
201
245
  justifyContent: 'flex-end',
202
246
  paddingHorizontal: 16,
203
247
  paddingBottom: 16
204
248
  }), [heroHeight]);
249
+
250
+ // Body is intentionally transparent — the background media shows through
251
+ // behind it. There is no solid "body box" stacked on top of the image.
205
252
  const bodyStyle = (0, _react.useMemo)(() => [{
206
- backgroundColor,
207
253
  gap: rootGap,
208
254
  paddingTop: rootGap,
209
255
  paddingBottom: 24
210
- }, contentContainerStyle], [backgroundColor, rootGap, contentContainerStyle]);
256
+ }, contentContainerStyle], [rootGap, contentContainerStyle]);
211
257
  const heroTextNode = /*#__PURE__*/(0, _jsxRuntime.jsx)(HeroText, {
212
258
  eyebrow: eyebrow,
213
259
  headline: headline,
@@ -216,22 +262,6 @@ function FullscreenModal({
216
262
  modes: modes
217
263
  });
218
264
 
219
- // The hero scrolls inline with the body (no parallax). When media is present
220
- // it is laid out full modal width and takes its height from its own aspect
221
- // ratio; the hero text is overlaid on top, anchored to the bottom. Without
222
- // media the text simply renders in flow at the fallback height.
223
- const hero = processedHeroMedia ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
224
- style: heroMediaContainerStyle,
225
- children: [processedHeroMedia, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
226
- style: heroTextOverlayStyle,
227
- pointerEvents: "box-none",
228
- children: heroTextNode
229
- })]
230
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
231
- style: heroTextFallbackStyle,
232
- children: heroTextNode
233
- });
234
-
235
265
  // Footer: a fully custom node, or the default Button + Disclaimer column.
236
266
  let footerContent = null;
237
267
  if (footer) {
@@ -254,22 +284,36 @@ function FullscreenModal({
254
284
  });
255
285
  }
256
286
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
257
- style: [rootStyle, {
258
- backgroundColor
259
- }, style],
287
+ style: [rootStyle, style],
260
288
  testID: testID,
261
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
289
+ children: [processedHeroMedia ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
290
+ style: [heroBackgroundStyle, {
291
+ transform: [{
292
+ translateY: heroTranslateY
293
+ }]
294
+ }],
295
+ pointerEvents: "none",
296
+ children: processedHeroMedia
297
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.ScrollView, {
262
298
  style: scrollViewStyle,
263
299
  contentContainerStyle: scrollContentStyle,
264
- showsVerticalScrollIndicator: false
300
+ showsVerticalScrollIndicator: false,
301
+ onScroll: onScroll,
302
+ scrollEventThrottle: 16
265
303
  // Tap an input in the body and it focuses on the FIRST tap, even when
266
304
  // the keyboard is already open (default 'never' eats that tap).
267
305
  ,
268
306
  keyboardShouldPersistTaps: "handled",
269
- children: [hero, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
270
- style: bodyStyle,
271
- children: processedChildren
272
- })]
307
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
308
+ style: foregroundFlowStyle,
309
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
310
+ style: heroTextRegionStyle,
311
+ children: heroTextNode
312
+ }), processedChildren ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
313
+ style: bodyStyle,
314
+ children: processedChildren
315
+ }) : null]
316
+ })
273
317
  }), footerContent ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionFooter.default, {
274
318
  modes: modes,
275
319
  children: footerContent
@@ -305,16 +349,19 @@ const closeButtonStyle = {
305
349
  top: 12,
306
350
  right: 12
307
351
  };
308
- // Full-width hero wrapper; height comes from the media's own aspect ratio.
309
- const heroMediaContainerStyle = {
310
- width: '100%',
311
- position: 'relative'
352
+ // Root-level full-bleed background media. Pinned to the top at full modal
353
+ // width; the media inside keeps its own natural aspect ratio (only `top` is
354
+ // pinned — no `bottom`/`overflow` clip), so it is NEVER cut to the content
355
+ // height and fills the surface behind the scrolling content and the footer.
356
+ // Living outside the ScrollView, it adds nothing to the scroll height.
357
+ const heroBackgroundStyle = {
358
+ position: 'absolute',
359
+ top: 0,
360
+ left: 0,
361
+ right: 0
312
362
  };
313
- // Hero text overlaid on the media, anchored to the bottom edge.
314
- const heroTextOverlayStyle = {
315
- ..._reactNative.StyleSheet.absoluteFillObject,
316
- justifyContent: 'flex-end',
317
- paddingHorizontal: 16,
318
- paddingBottom: 16
363
+ // The foreground always flows normally its content drives the scroll height.
364
+ const foregroundFlowStyle = {
365
+ width: '100%'
319
366
  };
320
367
  var _default = exports.default = FullscreenModal;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
10
+ var _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
11
+ var _reactUtils = require("../../utils/react-utils");
12
+ var _Icon = _interopRequireDefault(require("../../icons/Icon"));
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ 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); }
16
+ function resolveIconTokens(modes) {
17
+ const iconColor = (0, _figmaVariablesResolver.getVariableByName)('icon/color', modes) || '#ad8444';
18
+ const iconSize = (0, _figmaVariablesResolver.getVariableByName)('icon/size', modes) || 18;
19
+ const paddingLeft = (0, _figmaVariablesResolver.getVariableByName)('icon/padding/left', modes) || 0;
20
+ const paddingTop = (0, _figmaVariablesResolver.getVariableByName)('icon/padding/top', modes) || 0;
21
+ const paddingRight = (0, _figmaVariablesResolver.getVariableByName)('icon/padding/right', modes) || 0;
22
+ const paddingBottom = (0, _figmaVariablesResolver.getVariableByName)('icon/padding/bottom', modes) || 0;
23
+ return {
24
+ containerStyle: {
25
+ flexDirection: 'column',
26
+ alignItems: 'center',
27
+ justifyContent: 'center',
28
+ overflow: 'hidden',
29
+ paddingLeft,
30
+ paddingTop,
31
+ paddingRight,
32
+ paddingBottom
33
+ },
34
+ iconColor,
35
+ iconSize
36
+ };
37
+ }
38
+
39
+ /**
40
+ * Icon component — a design-token-driven wrapper around a single glyph.
41
+ *
42
+ * It mirrors the Figma "Icon" component: a padded, centered container whose
43
+ * color and size are resolved from the `icon/*` design tokens via `modes`.
44
+ * The glyph itself can be supplied three ways, in order of precedence:
45
+ *
46
+ * 1. `children` — a real slot for any node (custom SVG component, nested
47
+ * `Icon`, etc.). `modes` cascade into the slot automatically.
48
+ * 2. `iconName` — a registry icon in the `ic_something` format.
49
+ * 3. `source` — a {@link UnifiedSource} fallback (remote URI, inline SVG XML,
50
+ * `require()` asset, SVG component, or React element), tinted with the
51
+ * mode-resolved icon color.
52
+ *
53
+ * `color` and `size` props let consumers override the token values per
54
+ * instance without touching `modes`.
55
+ *
56
+ * @example
57
+ * ```tsx
58
+ * // Built-in registry icon (default path).
59
+ * <Icon iconName="ic_card" modes={{ 'Color Mode': 'Light' }} />
60
+ *
61
+ * // Per-instance overrides.
62
+ * <Icon iconName="ic_ccv" color="#5c00b5" size={24} />
63
+ *
64
+ * // Fallback to an external source when the name isn't in the registry.
65
+ * <Icon source="https://cdn.example.com/glyph.svg" />
66
+ *
67
+ * // Slot: render any node as the icon.
68
+ * <Icon><BrandLogo /></Icon>
69
+ * ```
70
+ */
71
+ function Icon({
72
+ iconName,
73
+ source,
74
+ children,
75
+ color,
76
+ size,
77
+ modes: propModes = _reactUtils.EMPTY_MODES,
78
+ style: styleProp,
79
+ ...rest
80
+ }) {
81
+ const {
82
+ modes: globalModes
83
+ } = (0, _JFSThemeProvider.useTokens)();
84
+ const modes = (0, _react.useMemo)(() => globalModes === _reactUtils.EMPTY_MODES && propModes === _reactUtils.EMPTY_MODES ? _reactUtils.EMPTY_MODES : {
85
+ ...globalModes,
86
+ ...propModes
87
+ }, [globalModes, propModes]);
88
+ const tokens = (0, _react.useMemo)(() => resolveIconTokens(modes), [modes]);
89
+ const composedStyle = (0, _react.useMemo)(() => styleProp ? [tokens.containerStyle, styleProp] : tokens.containerStyle, [tokens.containerStyle, styleProp]);
90
+ const hasSlot = _react.default.Children.count(children) > 0;
91
+
92
+ // Only fall back to the default glyph when nothing at all is provided so an
93
+ // explicit `source` (without an `iconName`) isn't shadowed by `ic_card`.
94
+ const resolvedName = iconName ?? (source === undefined ? 'ic_card' : undefined);
95
+ const iconColor = color ?? tokens.iconColor;
96
+ const iconSize = size ?? tokens.iconSize;
97
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
98
+ style: composedStyle,
99
+ ...rest,
100
+ children: hasSlot ? (0, _reactUtils.cloneChildrenWithModes)(children, modes) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.default, {
101
+ name: resolvedName,
102
+ ...(source !== undefined ? {
103
+ source
104
+ } : {}),
105
+ size: iconSize,
106
+ color: iconColor,
107
+ accessibilityElementsHidden: true,
108
+ importantForAccessibility: "no"
109
+ })
110
+ });
111
+ }
112
+ var _default = exports.default = /*#__PURE__*/_react.default.memo(Icon);
@@ -363,6 +363,12 @@ Object.defineProperty(exports, "HoldingsCard", {
363
363
  return _HoldingsCard.default;
364
364
  }
365
365
  });
366
+ Object.defineProperty(exports, "Icon", {
367
+ enumerable: true,
368
+ get: function () {
369
+ return _Icon.default;
370
+ }
371
+ });
366
372
  Object.defineProperty(exports, "IconButton", {
367
373
  enumerable: true,
368
374
  get: function () {
@@ -892,6 +898,7 @@ var _MonthlyStatusGrid = _interopRequireWildcard(require("./MonthlyStatusGrid/Mo
892
898
  var _Gauge = _interopRequireDefault(require("./Gauge/Gauge"));
893
899
  var _HoldingsCard = _interopRequireDefault(require("./HoldingsCard/HoldingsCard"));
894
900
  var _HStack = _interopRequireDefault(require("./HStack/HStack"));
901
+ var _Icon = _interopRequireDefault(require("./Icon/Icon"));
895
902
  var _IconButton = _interopRequireDefault(require("./IconButton/IconButton"));
896
903
  var _IconCapsule = _interopRequireDefault(require("./IconCapsule/IconCapsule"));
897
904
  var _Image = _interopRequireDefault(require("./Image/Image"));