jfs-components 0.0.74 → 0.0.77
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 +92 -0
- package/lib/commonjs/components/ActionFooter/ActionFooter.js +147 -82
- package/lib/commonjs/components/Avatar/Avatar.js +20 -0
- package/lib/commonjs/components/Badge/Badge.js +23 -0
- package/lib/commonjs/components/Button/Button.js +37 -0
- package/lib/commonjs/components/IconButton/IconButton.js +20 -0
- package/lib/commonjs/components/Image/Image.js +26 -1
- package/lib/commonjs/components/LottiePlayer/LottiePlayer.js +116 -0
- package/lib/commonjs/components/LottiePlayer/LottiePlayer.web.js +82 -0
- package/lib/commonjs/components/LottiePlayer/loadNativeLottieView.js +74 -0
- package/lib/commonjs/components/LottiePlayer/loadWebLottieView.js +50 -0
- package/lib/commonjs/components/PageHero/PageHero.js +41 -5
- package/lib/commonjs/components/RechargeCard/RechargeCard.js +32 -17
- package/lib/commonjs/components/Text/Text.js +31 -1
- package/lib/commonjs/components/index.js +7 -0
- package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/commonjs/icons/Icon.js +16 -0
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/commonjs/index.js +12 -0
- package/lib/commonjs/skeleton/Skeleton.js +234 -0
- package/lib/commonjs/skeleton/SkeletonGroup.js +140 -0
- package/lib/commonjs/skeleton/index.js +58 -0
- package/lib/commonjs/skeleton/shimmer-tokens.js +189 -0
- package/lib/commonjs/skeleton/useReducedMotion.js +64 -0
- package/lib/module/components/ActionFooter/ActionFooter.js +146 -82
- package/lib/module/components/Avatar/Avatar.js +19 -0
- package/lib/module/components/Badge/Badge.js +23 -0
- package/lib/module/components/Button/Button.js +37 -0
- package/lib/module/components/IconButton/IconButton.js +20 -0
- package/lib/module/components/Image/Image.js +25 -1
- package/lib/module/components/LottiePlayer/LottiePlayer.js +111 -0
- package/lib/module/components/LottiePlayer/LottiePlayer.web.js +77 -0
- package/lib/module/components/LottiePlayer/loadNativeLottieView.js +69 -0
- package/lib/module/components/LottiePlayer/loadWebLottieView.js +45 -0
- package/lib/module/components/PageHero/PageHero.js +41 -5
- package/lib/module/components/RechargeCard/RechargeCard.js +33 -17
- package/lib/module/components/Text/Text.js +31 -1
- package/lib/module/components/index.js +1 -0
- package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/module/icons/Icon.js +16 -0
- package/lib/module/icons/registry.js +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/skeleton/Skeleton.js +229 -0
- package/lib/module/skeleton/SkeletonGroup.js +133 -0
- package/lib/module/skeleton/index.js +6 -0
- package/lib/module/skeleton/shimmer-tokens.js +181 -0
- package/lib/module/skeleton/useReducedMotion.js +61 -0
- package/lib/typescript/src/components/ActionFooter/ActionFooter.d.ts +26 -21
- package/lib/typescript/src/components/Avatar/Avatar.d.ts +7 -1
- package/lib/typescript/src/components/Badge/Badge.d.ts +7 -1
- package/lib/typescript/src/components/Button/Button.d.ts +8 -1
- package/lib/typescript/src/components/IconButton/IconButton.d.ts +7 -1
- package/lib/typescript/src/components/Image/Image.d.ts +8 -1
- package/lib/typescript/src/components/LottiePlayer/LottiePlayer.d.ts +85 -0
- package/lib/typescript/src/components/LottiePlayer/LottiePlayer.web.d.ts +28 -0
- package/lib/typescript/src/components/LottiePlayer/loadNativeLottieView.d.ts +11 -0
- package/lib/typescript/src/components/LottiePlayer/loadWebLottieView.d.ts +11 -0
- package/lib/typescript/src/components/PageHero/PageHero.d.ts +31 -5
- package/lib/typescript/src/components/Text/Text.d.ts +20 -1
- package/lib/typescript/src/components/index.d.ts +1 -0
- package/lib/typescript/src/icons/Icon.d.ts +7 -1
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/skeleton/Skeleton.d.ts +60 -0
- package/lib/typescript/src/skeleton/SkeletonGroup.d.ts +78 -0
- package/lib/typescript/src/skeleton/index.d.ts +5 -0
- package/lib/typescript/src/skeleton/shimmer-tokens.d.ts +160 -0
- package/lib/typescript/src/skeleton/useReducedMotion.d.ts +15 -0
- package/package.json +11 -1
- package/src/components/ActionFooter/ActionFooter.tsx +152 -86
- package/src/components/Avatar/Avatar.tsx +26 -0
- package/src/components/Badge/Badge.tsx +27 -0
- package/src/components/Button/Button.tsx +40 -0
- package/src/components/IconButton/IconButton.tsx +27 -0
- package/src/components/Image/Image.tsx +25 -0
- package/src/components/LottiePlayer/LottiePlayer.tsx +145 -0
- package/src/components/LottiePlayer/LottiePlayer.web.tsx +94 -0
- package/src/components/LottiePlayer/loadNativeLottieView.tsx +87 -0
- package/src/components/LottiePlayer/loadWebLottieView.tsx +64 -0
- package/src/components/PageHero/PageHero.tsx +61 -4
- package/src/components/RechargeCard/RechargeCard.tsx +32 -24
- package/src/components/Text/Text.tsx +54 -0
- package/src/components/index.ts +1 -0
- package/src/design-tokens/Coin Variables-variables-full.json +1 -1
- package/src/icons/Icon.tsx +17 -0
- package/src/icons/registry.ts +1 -1
- package/src/index.ts +1 -0
- package/src/skeleton/Skeleton.tsx +298 -0
- package/src/skeleton/SkeletonGroup.tsx +193 -0
- package/src/skeleton/index.ts +10 -0
- package/src/skeleton/shimmer-tokens.ts +221 -0
- package/src/skeleton/useReducedMotion.ts +72 -0
|
@@ -0,0 +1,116 @@
|
|
|
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 _loadNativeLottieView = require("./loadNativeLottieView");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
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); }
|
|
15
|
+
/**
|
|
16
|
+
* A parsed Lottie animation. The JSON object you get from
|
|
17
|
+
* `require('./animation.json')` or `fetch().then(r => r.json())`. We keep the
|
|
18
|
+
* type intentionally loose because both `lottie-react-native` and `lottie-react`
|
|
19
|
+
* accept slightly different shapes — `LottiePlayer` narrows back to the
|
|
20
|
+
* platform-specific type internally.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const DEFAULT_SIZE = 117;
|
|
24
|
+
function resolveSize(size, modes) {
|
|
25
|
+
if (typeof size === 'number') return {
|
|
26
|
+
width: size,
|
|
27
|
+
height: size
|
|
28
|
+
};
|
|
29
|
+
if (size && typeof size === 'object') return size;
|
|
30
|
+
const width = Number((0, _figmaVariablesResolver.getVariableByName)('media/width', modes)) || DEFAULT_SIZE;
|
|
31
|
+
const height = Number((0, _figmaVariablesResolver.getVariableByName)('media/height', modes)) || DEFAULT_SIZE;
|
|
32
|
+
return {
|
|
33
|
+
width,
|
|
34
|
+
height
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Renders a Lottie animation using the consumer's installed
|
|
40
|
+
* `lottie-react-native` (native) or `lottie-react` (web) — both are declared
|
|
41
|
+
* as **optional peer dependencies** of `jfs-components`, so installing the
|
|
42
|
+
* library does not pull them in. Add the relevant package to your app only
|
|
43
|
+
* if you actually use `LottiePlayer`:
|
|
44
|
+
*
|
|
45
|
+
* ```sh
|
|
46
|
+
* # React Native (iOS / Android)
|
|
47
|
+
* npm install lottie-react-native
|
|
48
|
+
* cd ios && pod install
|
|
49
|
+
*
|
|
50
|
+
* # Web (or react-native-web)
|
|
51
|
+
* npm install lottie-react
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* The web build (`LottiePlayer.web.tsx`) is picked automatically by Metro /
|
|
55
|
+
* webpack via platform extensions — same pattern as `MediaCard/GlassFill`.
|
|
56
|
+
*
|
|
57
|
+
* Token-driven sizing: when `size` is omitted, `LottiePlayer` reads
|
|
58
|
+
* `media/width` and `media/height` from the Figma variables resolver, so the
|
|
59
|
+
* animation matches the surrounding component's `Media / Output` mode
|
|
60
|
+
* automatically. This is the same sizing contract `PageHero` and
|
|
61
|
+
* `LottieIntroBlock` use for their `media` slots.
|
|
62
|
+
*
|
|
63
|
+
* @component
|
|
64
|
+
* @example
|
|
65
|
+
* ```tsx
|
|
66
|
+
* import animation from './assets/loader.json';
|
|
67
|
+
*
|
|
68
|
+
* <LottiePlayer source={animation} /> // 117 × 117 (default)
|
|
69
|
+
* <LottiePlayer source={animation} size={70} /> // 70 × 70
|
|
70
|
+
* <LottiePlayer source={animation} modes={{ 'Media / Output': 'S' }} /> // 20 × 20
|
|
71
|
+
* <PageHero media={<LottiePlayer source={animation} />} />
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
function LottiePlayer({
|
|
75
|
+
source,
|
|
76
|
+
size,
|
|
77
|
+
autoPlay = true,
|
|
78
|
+
loop = true,
|
|
79
|
+
modes: propModes = _reactUtils.EMPTY_MODES,
|
|
80
|
+
style,
|
|
81
|
+
accessibilityLabel,
|
|
82
|
+
testID
|
|
83
|
+
}) {
|
|
84
|
+
const {
|
|
85
|
+
modes: globalModes
|
|
86
|
+
} = (0, _JFSThemeProvider.useTokens)();
|
|
87
|
+
const modes = (0, _react.useMemo)(() => globalModes === _reactUtils.EMPTY_MODES && propModes === _reactUtils.EMPTY_MODES ? _reactUtils.EMPTY_MODES : {
|
|
88
|
+
...globalModes,
|
|
89
|
+
...propModes
|
|
90
|
+
}, [globalModes, propModes]);
|
|
91
|
+
const {
|
|
92
|
+
width,
|
|
93
|
+
height
|
|
94
|
+
} = (0, _react.useMemo)(() => resolveSize(size, modes), [size, modes]);
|
|
95
|
+
const NativeLottieView = (0, _react.useMemo)(() => (0, _loadNativeLottieView.getNativeLottieView)(), []);
|
|
96
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
97
|
+
style: [{
|
|
98
|
+
width,
|
|
99
|
+
height
|
|
100
|
+
}, style],
|
|
101
|
+
testID: testID,
|
|
102
|
+
accessibilityLabel: accessibilityLabel,
|
|
103
|
+
accessibilityElementsHidden: accessibilityLabel ? undefined : true,
|
|
104
|
+
importantForAccessibility: accessibilityLabel ? 'auto' : 'no',
|
|
105
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(NativeLottieView, {
|
|
106
|
+
source: source,
|
|
107
|
+
autoPlay: autoPlay,
|
|
108
|
+
loop: loop,
|
|
109
|
+
style: {
|
|
110
|
+
width: '100%',
|
|
111
|
+
height: '100%'
|
|
112
|
+
}
|
|
113
|
+
})
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
var _default = exports.default = /*#__PURE__*/_react.default.memo(LottiePlayer);
|
|
@@ -0,0 +1,82 @@
|
|
|
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 _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
9
|
+
var _JFSThemeProvider = require("../../design-tokens/JFSThemeProvider");
|
|
10
|
+
var _reactUtils = require("../../utils/react-utils");
|
|
11
|
+
var _loadWebLottieView = require("./loadWebLottieView");
|
|
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
|
+
const DEFAULT_SIZE = 117;
|
|
15
|
+
function resolveSize(size, modes) {
|
|
16
|
+
if (typeof size === 'number') return {
|
|
17
|
+
width: size,
|
|
18
|
+
height: size
|
|
19
|
+
};
|
|
20
|
+
if (size && typeof size === 'object') return size;
|
|
21
|
+
const width = Number((0, _figmaVariablesResolver.getVariableByName)('media/width', modes)) || DEFAULT_SIZE;
|
|
22
|
+
const height = Number((0, _figmaVariablesResolver.getVariableByName)('media/height', modes)) || DEFAULT_SIZE;
|
|
23
|
+
return {
|
|
24
|
+
width,
|
|
25
|
+
height
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Web build of `LottiePlayer` — picked automatically by webpack /
|
|
31
|
+
* Metro-for-web via the `.web.tsx` platform extension. Uses `lottie-react`
|
|
32
|
+
* (which wraps `lottie-web`) and renders a plain DOM container.
|
|
33
|
+
*
|
|
34
|
+
* Public API mirrors `LottiePlayer.tsx` (native). See that file for the
|
|
35
|
+
* documented prop reference and usage patterns.
|
|
36
|
+
*/
|
|
37
|
+
function LottiePlayer({
|
|
38
|
+
source,
|
|
39
|
+
size,
|
|
40
|
+
autoPlay = true,
|
|
41
|
+
loop = true,
|
|
42
|
+
modes: propModes = _reactUtils.EMPTY_MODES,
|
|
43
|
+
style,
|
|
44
|
+
accessibilityLabel,
|
|
45
|
+
testID
|
|
46
|
+
}) {
|
|
47
|
+
const {
|
|
48
|
+
modes: globalModes
|
|
49
|
+
} = (0, _JFSThemeProvider.useTokens)();
|
|
50
|
+
const modes = (0, _react.useMemo)(() => globalModes === _reactUtils.EMPTY_MODES && propModes === _reactUtils.EMPTY_MODES ? _reactUtils.EMPTY_MODES : {
|
|
51
|
+
...globalModes,
|
|
52
|
+
...propModes
|
|
53
|
+
}, [globalModes, propModes]);
|
|
54
|
+
const {
|
|
55
|
+
width,
|
|
56
|
+
height
|
|
57
|
+
} = (0, _react.useMemo)(() => resolveSize(size, modes), [size, modes]);
|
|
58
|
+
const WebLottieView = (0, _react.useMemo)(() => (0, _loadWebLottieView.getWebLottieView)(), []);
|
|
59
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
60
|
+
style: {
|
|
61
|
+
width,
|
|
62
|
+
height,
|
|
63
|
+
display: 'flex',
|
|
64
|
+
alignItems: 'center',
|
|
65
|
+
justifyContent: 'center',
|
|
66
|
+
...style
|
|
67
|
+
},
|
|
68
|
+
"data-testid": testID,
|
|
69
|
+
"aria-label": accessibilityLabel,
|
|
70
|
+
"aria-hidden": accessibilityLabel ? undefined : true,
|
|
71
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(WebLottieView, {
|
|
72
|
+
animationData: source,
|
|
73
|
+
autoplay: autoPlay,
|
|
74
|
+
loop: loop,
|
|
75
|
+
style: {
|
|
76
|
+
width: '100%',
|
|
77
|
+
height: '100%'
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
var _default = exports.default = /*#__PURE__*/_react.default.memo(LottiePlayer);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getNativeLottieView = getNativeLottieView;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
/** Props we forward to the underlying native Lottie view. */
|
|
12
|
+
|
|
13
|
+
const INSTALL_HINT = 'LottiePlayer requires lottie-react-native in your app.\n' + ' npm install lottie-react-native\n' + ' cd ios && pod install';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Metro resolves `require('lottie-react-native')` at bundle time even inside
|
|
17
|
+
* try/catch, which breaks apps that import `jfs-components` without having
|
|
18
|
+
* the optional peer installed. Splitting the module id into a runtime string
|
|
19
|
+
* keeps Metro from statically linking it — the native module is loaded only
|
|
20
|
+
* when present in the consumer's node_modules.
|
|
21
|
+
*/
|
|
22
|
+
function resolveNativeLottieModuleName() {
|
|
23
|
+
return ['lottie', '-react', '-native'].join('');
|
|
24
|
+
}
|
|
25
|
+
function LottieUnavailableView({
|
|
26
|
+
style
|
|
27
|
+
}) {
|
|
28
|
+
if (__DEV__) {
|
|
29
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
30
|
+
style: [style, {
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
justifyContent: 'center',
|
|
33
|
+
backgroundColor: 'rgba(255, 196, 0, 0.12)',
|
|
34
|
+
borderWidth: 1,
|
|
35
|
+
borderColor: 'rgba(255, 196, 0, 0.45)',
|
|
36
|
+
borderRadius: 8,
|
|
37
|
+
padding: 8
|
|
38
|
+
}],
|
|
39
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
40
|
+
style: {
|
|
41
|
+
color: '#8a6d00',
|
|
42
|
+
fontSize: 11,
|
|
43
|
+
textAlign: 'center',
|
|
44
|
+
lineHeight: 15
|
|
45
|
+
},
|
|
46
|
+
children: INSTALL_HINT
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
51
|
+
style: style
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function LottieUnavailable(props) {
|
|
55
|
+
_react.default.useEffect(() => {
|
|
56
|
+
if (__DEV__) {
|
|
57
|
+
console.warn(`[jfs-components/LottiePlayer] ${INSTALL_HINT}`);
|
|
58
|
+
}
|
|
59
|
+
}, []);
|
|
60
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(LottieUnavailableView, {
|
|
61
|
+
style: props.style
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
let cachedView;
|
|
65
|
+
function getNativeLottieView() {
|
|
66
|
+
if (cachedView !== undefined) return cachedView;
|
|
67
|
+
try {
|
|
68
|
+
const mod = require(resolveNativeLottieModuleName());
|
|
69
|
+
cachedView = mod.default ?? LottieUnavailable;
|
|
70
|
+
} catch {
|
|
71
|
+
cachedView = LottieUnavailable;
|
|
72
|
+
}
|
|
73
|
+
return cachedView;
|
|
74
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getWebLottieView = getWebLottieView;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
/** Props we forward to the underlying web Lottie view. */
|
|
11
|
+
|
|
12
|
+
const INSTALL_HINT = 'LottiePlayer requires lottie-react in your app.\n' + ' npm install lottie-react';
|
|
13
|
+
function resolveWebLottieModuleName() {
|
|
14
|
+
return ['lottie', '-react'].join('');
|
|
15
|
+
}
|
|
16
|
+
function LottieUnavailable(props) {
|
|
17
|
+
_react.default.useEffect(() => {
|
|
18
|
+
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
19
|
+
console.warn(`[jfs-components/LottiePlayer] ${INSTALL_HINT}`);
|
|
20
|
+
}
|
|
21
|
+
}, []);
|
|
22
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
23
|
+
style: {
|
|
24
|
+
...props.style,
|
|
25
|
+
display: 'flex',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
justifyContent: 'center',
|
|
28
|
+
backgroundColor: 'rgba(255, 196, 0, 0.12)',
|
|
29
|
+
border: '1px solid rgba(255, 196, 0, 0.45)',
|
|
30
|
+
borderRadius: 8,
|
|
31
|
+
padding: 8,
|
|
32
|
+
color: '#8a6d00',
|
|
33
|
+
fontSize: 11,
|
|
34
|
+
textAlign: 'center',
|
|
35
|
+
lineHeight: '15px'
|
|
36
|
+
},
|
|
37
|
+
children: typeof __DEV__ !== 'undefined' && __DEV__ ? INSTALL_HINT : null
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
let cachedView;
|
|
41
|
+
function getWebLottieView() {
|
|
42
|
+
if (cachedView !== undefined) return cachedView;
|
|
43
|
+
try {
|
|
44
|
+
const mod = require(resolveWebLottieModuleName());
|
|
45
|
+
cachedView = mod.default ?? LottieUnavailable;
|
|
46
|
+
} catch {
|
|
47
|
+
cachedView = LottieUnavailable;
|
|
48
|
+
}
|
|
49
|
+
return cachedView;
|
|
50
|
+
}
|
|
@@ -15,12 +15,14 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
15
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
16
|
/**
|
|
17
17
|
* PageHero displays a centered hero block typically used at the top of a page
|
|
18
|
-
* or feature screen. It contains an
|
|
19
|
-
*
|
|
18
|
+
* or feature screen. It contains an optional media slot (illustration / image
|
|
19
|
+
* / Lottie / SVG / video — consumer's choice), an eyebrow line, a large
|
|
20
|
+
* headline, an optional supporting line (e.g. price / timeline), and an
|
|
21
|
+
* optional action button.
|
|
20
22
|
*
|
|
21
23
|
* All visual values are resolved from Figma design tokens via
|
|
22
|
-
* `getVariableByName`.
|
|
23
|
-
*
|
|
24
|
+
* `getVariableByName`. Slots cascade the active `modes` to their children
|
|
25
|
+
* through `cloneChildrenWithModes`.
|
|
24
26
|
*
|
|
25
27
|
* @component
|
|
26
28
|
* @example
|
|
@@ -31,6 +33,13 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
31
33
|
* supportingText="₹999/year · ₹0 until 2027"
|
|
32
34
|
* buttonLabel="Renew for free"
|
|
33
35
|
* onButtonPress={() => navigate('Upgrade')}
|
|
36
|
+
* media={
|
|
37
|
+
* <Image
|
|
38
|
+
* imageSource={require('./assets/upgrade.png')}
|
|
39
|
+
* width={117}
|
|
40
|
+
* height={117}
|
|
41
|
+
* />
|
|
42
|
+
* }
|
|
34
43
|
* />
|
|
35
44
|
* ```
|
|
36
45
|
*/
|
|
@@ -43,6 +52,7 @@ function PageHero({
|
|
|
43
52
|
onButtonPress,
|
|
44
53
|
showButton = true,
|
|
45
54
|
buttonSlot,
|
|
55
|
+
media,
|
|
46
56
|
modes: propModes = _reactUtils.EMPTY_MODES,
|
|
47
57
|
style,
|
|
48
58
|
testID
|
|
@@ -57,6 +67,12 @@ function PageHero({
|
|
|
57
67
|
const gap = Number((0, _figmaVariablesResolver.getVariableByName)('PageHero/gap', modes)) || 16;
|
|
58
68
|
const paddingHorizontal = Number((0, _figmaVariablesResolver.getVariableByName)('PageHero/padding/horizontal', modes)) || 0;
|
|
59
69
|
const textWrapGap = Number((0, _figmaVariablesResolver.getVariableByName)('PageHero/textWrap/gap', modes)) || 8;
|
|
70
|
+
|
|
71
|
+
// Media slot box — matches the 117×117 frame in Figma (node 4540:7845).
|
|
72
|
+
// Tokens fall back to 117 when not defined in the variables collection,
|
|
73
|
+
// so the layout stays stable on consumers that haven't tokenized this yet.
|
|
74
|
+
const mediaWidth = Number((0, _figmaVariablesResolver.getVariableByName)('media/width', modes)) || 117;
|
|
75
|
+
const mediaHeight = Number((0, _figmaVariablesResolver.getVariableByName)('media/height', modes)) || 117;
|
|
60
76
|
const eyebrowColor = (0, _figmaVariablesResolver.getVariableByName)('PageHero/eyebrow/color', modes) || '#ffffff';
|
|
61
77
|
const eyebrowFontFamily = (0, _figmaVariablesResolver.getVariableByName)('PageHero/eyebrow/fontFamily', modes) || 'System';
|
|
62
78
|
const eyebrowFontSize = Number((0, _figmaVariablesResolver.getVariableByName)('PageHero/eyebrow/fontSize', modes)) || 18;
|
|
@@ -132,10 +148,30 @@ function PageHero({
|
|
|
132
148
|
// shape never does.
|
|
133
149
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
134
150
|
}, [buttonSlot, showButton, buttonLabel, onButtonPress, modes]);
|
|
151
|
+
|
|
152
|
+
// Sized container for the media slot. Always rendered when `media` is
|
|
153
|
+
// provided, so the slot has a predictable box (matches Figma frame
|
|
154
|
+
// 4540:7845 — 117×117 by default) even if the inner element omits its
|
|
155
|
+
// own width/height. `overflow: 'hidden'` mirrors the Figma frame's
|
|
156
|
+
// `clipsContent` so a slightly oversized illustration doesn't break
|
|
157
|
+
// the centered layout.
|
|
158
|
+
const mediaContent = (0, _react.useMemo)(() => {
|
|
159
|
+
if (media === undefined || media === null) return null;
|
|
160
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
161
|
+
style: {
|
|
162
|
+
width: mediaWidth,
|
|
163
|
+
height: mediaHeight,
|
|
164
|
+
alignItems: 'center',
|
|
165
|
+
justifyContent: 'center',
|
|
166
|
+
overflow: 'hidden'
|
|
167
|
+
},
|
|
168
|
+
children: (0, _reactUtils.cloneChildrenWithModes)(media, modes)
|
|
169
|
+
});
|
|
170
|
+
}, [media, mediaWidth, mediaHeight, modes]);
|
|
135
171
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
136
172
|
style: [containerStyle, style],
|
|
137
173
|
testID: testID,
|
|
138
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
174
|
+
children: [mediaContent, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
139
175
|
style: textWrapStyle,
|
|
140
176
|
children: [eyebrow ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
141
177
|
style: eyebrowStyle,
|
|
@@ -13,6 +13,21 @@ var _reactUtils = require("../../utils/react-utils");
|
|
|
13
13
|
var _MoneyValue = _interopRequireDefault(require("../MoneyValue/MoneyValue"));
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
// Defaults applied to the inner ButtonGroup so the card matches Figma out of
|
|
17
|
+
// the box. They are spread *before* the caller's `modes` so any consumer can
|
|
18
|
+
// override an individual key (e.g. swap the size to "M").
|
|
19
|
+
const DEFAULT_BUTTON_GROUP_MODES = {
|
|
20
|
+
AppearanceBrand: 'Secondary',
|
|
21
|
+
'Button / Size': 'S',
|
|
22
|
+
Emphasis: 'High'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Defaults applied to the inner MoneyValue so the price renders at the
|
|
26
|
+
// 36 px / 900-weight scale defined for cards in Figma. Same merge rule as
|
|
27
|
+
// the button group — consumer `modes` override these.
|
|
28
|
+
const DEFAULT_MONEY_VALUE_MODES = {
|
|
29
|
+
Context3: 'Balance & Cards'
|
|
30
|
+
};
|
|
16
31
|
/**
|
|
17
32
|
* RechargeCard component implementation from Figma node 2235:937.
|
|
18
33
|
* Displays a recharge plan with price, validity, data, and subscription details.
|
|
@@ -28,17 +43,19 @@ function RechargeCard({
|
|
|
28
43
|
modes = _reactUtils.EMPTY_MODES,
|
|
29
44
|
style
|
|
30
45
|
}) {
|
|
31
|
-
// Container Tokens
|
|
32
|
-
const backgroundColor = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/background', modes) || '#
|
|
46
|
+
// Container Tokens (defaults mirror Figma node 2235:937).
|
|
47
|
+
const backgroundColor = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/background', modes) || '#ffffff';
|
|
33
48
|
const paddingHorizontal = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/padding/horizontal', modes) || 16, 10);
|
|
34
49
|
const paddingVertical = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/padding/vertical', modes) || 20, 10);
|
|
35
50
|
const gap = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/gap', modes) || 20, 10);
|
|
36
51
|
const radius = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/radius', modes) || 20, 10);
|
|
37
|
-
const minWidth = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/minWidth', modes) ||
|
|
52
|
+
const minWidth = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/minWidth', modes) || 312, 10);
|
|
53
|
+
const strokeWidth = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/strokeWidth', modes) || 1, 10);
|
|
54
|
+
const strokeColor = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/stroke/color', modes) || '#ebebed';
|
|
38
55
|
|
|
39
56
|
// Header Tokens
|
|
40
57
|
const headerGap = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/header/gap', modes) || 4, 10);
|
|
41
|
-
const titleColor = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/title/color', modes) || '#
|
|
58
|
+
const titleColor = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/title/color', modes) || '#000000';
|
|
42
59
|
const titleFontSize = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/title/fontSize', modes) || 12, 10);
|
|
43
60
|
const titleFontFamily = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/title/fontFamily', modes) || 'JioType Var';
|
|
44
61
|
const titleLineHeight = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/title/lineHeight', modes) || 14, 10);
|
|
@@ -49,30 +66,25 @@ function RechargeCard({
|
|
|
49
66
|
const specItemGap = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/specItem/gap', modes) || 4, 10);
|
|
50
67
|
|
|
51
68
|
// Spec Label Tokens
|
|
52
|
-
const specLabelColor = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/specItem/label/color', modes) || '#
|
|
69
|
+
const specLabelColor = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/specItem/label/color', modes) || '#000000';
|
|
53
70
|
const specLabelFontSize = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/specItem/label/fontSize', modes) || 12, 10);
|
|
54
71
|
const specLabelFontFamily = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/specItem/label/fontFamily', modes) || 'JioType Var';
|
|
55
72
|
const specLabelLineHeight = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/specItem/label/lineHeight', modes) || 14, 10);
|
|
56
73
|
const specLabelFontWeight = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/specItem/label/fontWeight', modes) || '500';
|
|
57
74
|
|
|
58
75
|
// Spec Value Tokens
|
|
59
|
-
const specValueColor = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/specItem/value/color', modes) || '#
|
|
76
|
+
const specValueColor = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/specItem/value/color', modes) || '#000000';
|
|
60
77
|
const specValueFontSize = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/specItem/value/fontSize', modes) || 14, 10);
|
|
61
78
|
const specValueFontFamily = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/specItem/value/fontFamily', modes) || 'JioType Var';
|
|
62
79
|
const specValueLineHeight = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/specItem/value/lineHeight', modes) || 17, 10);
|
|
63
80
|
const specValueFontWeight = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/specItem/value/fontWeight', modes) || '500';
|
|
64
81
|
|
|
65
82
|
// Disclaimer Tokens
|
|
66
|
-
const disclaimerColor = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/disclaimer/color', modes) || '#
|
|
83
|
+
const disclaimerColor = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/disclaimer/color', modes) || '#000000';
|
|
67
84
|
const disclaimerFontSize = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/disclaimer/fontSize', modes) || 10, 10);
|
|
68
85
|
const disclaimerFontFamily = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/disclaimer/fontFamily', modes) || 'JioType Var';
|
|
69
86
|
const disclaimerLineHeight = parseInt((0, _figmaVariablesResolver.getVariableByName)('rechargeCard/disclaimer/lineHeight', modes) || 13, 10);
|
|
70
87
|
const disclaimerFontWeight = (0, _figmaVariablesResolver.getVariableByName)('rechargeCard/disclaimer/fontWeight', modes) || '400';
|
|
71
|
-
|
|
72
|
-
// Button Group Tokens
|
|
73
|
-
// Handled by ButtonGroup component directly
|
|
74
|
-
|
|
75
|
-
// Helpers
|
|
76
88
|
const resolveFontWeight = weight => typeof weight === 'number' ? weight.toString() : weight;
|
|
77
89
|
|
|
78
90
|
// Pass modes to subscription children (e.g. AvatarGroup)
|
|
@@ -85,6 +97,8 @@ function RechargeCard({
|
|
|
85
97
|
paddingVertical,
|
|
86
98
|
gap,
|
|
87
99
|
borderRadius: radius,
|
|
100
|
+
borderWidth: strokeWidth,
|
|
101
|
+
borderColor: strokeColor,
|
|
88
102
|
minWidth,
|
|
89
103
|
alignItems: 'flex-start'
|
|
90
104
|
}, style],
|
|
@@ -105,7 +119,10 @@ function RechargeCard({
|
|
|
105
119
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_MoneyValue.default, {
|
|
106
120
|
value: price,
|
|
107
121
|
currency: "\u20B9",
|
|
108
|
-
modes:
|
|
122
|
+
modes: {
|
|
123
|
+
...DEFAULT_MONEY_VALUE_MODES,
|
|
124
|
+
...modes
|
|
125
|
+
}
|
|
109
126
|
})]
|
|
110
127
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
111
128
|
style: {
|
|
@@ -194,10 +211,8 @@ function RechargeCard({
|
|
|
194
211
|
children: disclaimer
|
|
195
212
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonGroup.default, {
|
|
196
213
|
modes: {
|
|
197
|
-
...
|
|
198
|
-
|
|
199
|
-
"Button / Size": "S",
|
|
200
|
-
"Emphasis": "High"
|
|
214
|
+
...DEFAULT_BUTTON_GROUP_MODES,
|
|
215
|
+
...modes
|
|
201
216
|
},
|
|
202
217
|
children: actions
|
|
203
218
|
})]
|
|
@@ -8,6 +8,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
10
10
|
var _reactUtils = require("../../utils/react-utils");
|
|
11
|
+
var _Skeleton = _interopRequireDefault(require("../../skeleton/Skeleton"));
|
|
12
|
+
var _SkeletonGroup = require("../../skeleton/SkeletonGroup");
|
|
11
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
15
|
const TEXT_ALIGN_MAP = {
|
|
@@ -20,7 +22,10 @@ function Text({
|
|
|
20
22
|
textAlign = 'Left',
|
|
21
23
|
modes = _reactUtils.EMPTY_MODES,
|
|
22
24
|
style,
|
|
23
|
-
numberOfLines
|
|
25
|
+
numberOfLines,
|
|
26
|
+
loading,
|
|
27
|
+
skeletonWidth,
|
|
28
|
+
skeletonLines
|
|
24
29
|
}) {
|
|
25
30
|
const foreground = (0, _figmaVariablesResolver.getVariableByName)('text/foreground', modes) ?? '#000000';
|
|
26
31
|
const fontFamily = (0, _figmaVariablesResolver.getVariableByName)('text/fontFamily', modes) ?? 'JioType';
|
|
@@ -28,6 +33,31 @@ function Text({
|
|
|
28
33
|
const fontWeight = (0, _figmaVariablesResolver.getVariableByName)('text/fontWeight', modes) ?? '500';
|
|
29
34
|
const lineHeight = (0, _figmaVariablesResolver.getVariableByName)('text/lineHeight', modes) ?? 20;
|
|
30
35
|
const letterSpacing = (0, _figmaVariablesResolver.getVariableByName)('text/letterSpacing', modes) ?? -0.5;
|
|
36
|
+
|
|
37
|
+
// Skeleton short-circuit. The hook is always called (stable order); the
|
|
38
|
+
// surrounding group's `active` flag is the default, but an explicit
|
|
39
|
+
// `loading` prop overrides both directions.
|
|
40
|
+
const {
|
|
41
|
+
active: groupActive
|
|
42
|
+
} = (0, _SkeletonGroup.useSkeleton)();
|
|
43
|
+
const isLoading = loading ?? groupActive;
|
|
44
|
+
if (isLoading) {
|
|
45
|
+
const resolvedFontSize = fontSize;
|
|
46
|
+
const resolvedLineHeight = lineHeight;
|
|
47
|
+
const lines = Math.max(1, skeletonLines ?? numberOfLines ?? 1);
|
|
48
|
+
// Heuristic width based on the actual content length so the placeholder
|
|
49
|
+
// visually matches what's about to load. Capped to a reasonable lower
|
|
50
|
+
// bound so very short labels still produce a visible block.
|
|
51
|
+
const contentLength = typeof children === 'string' ? children.length : typeof text === 'string' ? text.length : 12;
|
|
52
|
+
const charWidth = resolvedFontSize * 0.55;
|
|
53
|
+
const computedWidth = Math.max(charWidth * 4, contentLength * charWidth);
|
|
54
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Skeleton.default, {
|
|
55
|
+
kind: "text",
|
|
56
|
+
width: skeletonWidth ?? computedWidth,
|
|
57
|
+
height: resolvedLineHeight * lines,
|
|
58
|
+
modes: modes
|
|
59
|
+
});
|
|
60
|
+
}
|
|
31
61
|
const textStyle = {
|
|
32
62
|
color: foreground,
|
|
33
63
|
fontFamily: fontFamily,
|
|
@@ -387,6 +387,12 @@ Object.defineProperty(exports, "LottieIntroBlock", {
|
|
|
387
387
|
return _LottieIntroBlock.default;
|
|
388
388
|
}
|
|
389
389
|
});
|
|
390
|
+
Object.defineProperty(exports, "LottiePlayer", {
|
|
391
|
+
enumerable: true,
|
|
392
|
+
get: function () {
|
|
393
|
+
return _LottiePlayer.default;
|
|
394
|
+
}
|
|
395
|
+
});
|
|
390
396
|
Object.defineProperty(exports, "MediaCard", {
|
|
391
397
|
enumerable: true,
|
|
392
398
|
get: function () {
|
|
@@ -812,6 +818,7 @@ var _LinearMeter = _interopRequireDefault(require("./LinearMeter/LinearMeter"));
|
|
|
812
818
|
var _LinearProgress = _interopRequireDefault(require("./LinearProgress/LinearProgress"));
|
|
813
819
|
var _ListGroup = _interopRequireDefault(require("./ListGroup/ListGroup"));
|
|
814
820
|
var _LottieIntroBlock = _interopRequireDefault(require("./LottieIntroBlock/LottieIntroBlock"));
|
|
821
|
+
var _LottiePlayer = _interopRequireDefault(require("./LottiePlayer/LottiePlayer"));
|
|
815
822
|
var _ListItem = _interopRequireDefault(require("./ListItem/ListItem"));
|
|
816
823
|
var _MediaCard = _interopRequireDefault(require("./MediaCard/MediaCard"));
|
|
817
824
|
var _MerchantProfile = _interopRequireDefault(require("./MerchantProfile/MerchantProfile"));
|