jfs-components 0.0.69 → 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.
- package/CHANGELOG.md +20 -0
- package/lib/commonjs/components/CardAdvisory/CardAdvisory.js +203 -0
- package/lib/commonjs/components/CardCTA/CardCTA.js +198 -16
- package/lib/commonjs/components/CircularProgressBar/CircularProgressBar.js +147 -0
- package/lib/commonjs/components/CircularProgressBarDoted/CircularProgressBarDoted.js +258 -0
- package/lib/commonjs/components/CircularRating/CircularRating.js +161 -0
- package/lib/commonjs/components/Gauge/Gauge.js +223 -0
- package/lib/commonjs/components/ListGroup/ListGroup.js +3 -1
- package/lib/commonjs/components/MediaCard/GlassFill.js +62 -0
- package/lib/commonjs/components/MediaCard/GlassFill.web.js +48 -0
- package/lib/commonjs/components/MediaCard/MediaCard.js +28 -31
- package/lib/commonjs/components/Nudge/Nudge.js +179 -87
- package/lib/commonjs/components/index.js +35 -0
- package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/module/components/CardAdvisory/CardAdvisory.js +197 -0
- package/lib/module/components/CardCTA/CardCTA.js +199 -17
- package/lib/module/components/CircularProgressBar/CircularProgressBar.js +141 -0
- package/lib/module/components/CircularProgressBarDoted/CircularProgressBarDoted.js +253 -0
- package/lib/module/components/CircularRating/CircularRating.js +155 -0
- package/lib/module/components/Gauge/Gauge.js +217 -0
- package/lib/module/components/ListGroup/ListGroup.js +3 -1
- package/lib/module/components/MediaCard/GlassFill.js +57 -0
- package/lib/module/components/MediaCard/GlassFill.web.js +43 -0
- package/lib/module/components/MediaCard/MediaCard.js +29 -32
- package/lib/module/components/Nudge/Nudge.js +178 -87
- package/lib/module/components/index.js +5 -0
- package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/module/icons/registry.js +1 -1
- package/lib/typescript/src/components/CardAdvisory/CardAdvisory.d.ts +49 -0
- package/lib/typescript/src/components/CardCTA/CardCTA.d.ts +16 -1
- package/lib/typescript/src/components/CircularProgressBar/CircularProgressBar.d.ts +27 -0
- package/lib/typescript/src/components/CircularProgressBarDoted/CircularProgressBarDoted.d.ts +48 -0
- package/lib/typescript/src/components/CircularRating/CircularRating.d.ts +49 -0
- package/lib/typescript/src/components/Gauge/Gauge.d.ts +53 -0
- package/lib/typescript/src/components/MediaCard/GlassFill.d.ts +47 -0
- package/lib/typescript/src/components/MediaCard/GlassFill.web.d.ts +20 -0
- package/lib/typescript/src/components/MediaCard/MediaCard.d.ts +17 -13
- package/lib/typescript/src/components/Nudge/Nudge.d.ts +14 -11
- package/lib/typescript/src/components/index.d.ts +6 -1
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/package.json +3 -2
- package/src/components/CardAdvisory/CardAdvisory.tsx +283 -0
- package/src/components/CardCTA/CardCTA.tsx +236 -13
- package/src/components/CircularProgressBar/CircularProgressBar.tsx +190 -0
- package/src/components/CircularProgressBarDoted/CircularProgressBarDoted.tsx +357 -0
- package/src/components/CircularRating/CircularRating.tsx +241 -0
- package/src/components/Gauge/Gauge.tsx +303 -0
- package/src/components/ListGroup/ListGroup.tsx +3 -1
- package/src/components/MediaCard/GlassFill.tsx +89 -0
- package/src/components/MediaCard/GlassFill.web.tsx +53 -0
- package/src/components/MediaCard/MediaCard.tsx +29 -48
- package/src/components/Nudge/Nudge.tsx +222 -82
- package/src/components/index.ts +6 -1
- package/src/design-tokens/Coin Variables-variables-full.json +1 -1
- package/src/icons/registry.ts +1 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _blur = require("@react-native-community/blur");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
const DEFAULT_FALLBACK_DARK = '#1414174a';
|
|
13
|
+
const DEFAULT_FALLBACK_LIGHT = '#ffffff66';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Glass / frosted surface for native (iOS + Android).
|
|
17
|
+
*
|
|
18
|
+
* Why this lives in its own platform-split file:
|
|
19
|
+
* - `@react-native-community/blur` is a native-only module. Importing it on
|
|
20
|
+
* web throws because the JS shim references native components that aren't
|
|
21
|
+
* registered there. By using Metro's platform-extension resolution
|
|
22
|
+
* (`GlassFill.tsx` for native, `GlassFill.web.tsx` for web), we keep the
|
|
23
|
+
* web bundle free of any native-only imports.
|
|
24
|
+
* - Centralizes the `intensity` (0–100) -> `blurAmount` (0–32) mapping so
|
|
25
|
+
* callers can keep the Figma token semantics they already know.
|
|
26
|
+
*
|
|
27
|
+
* On iOS this is a real `UIVisualEffectView` (true OS-level live blur).
|
|
28
|
+
* On Android this uses the community blur view (RealtimeBlurView). On devices
|
|
29
|
+
* where realtime blur is unavailable, `reducedTransparencyFallbackColor` (and
|
|
30
|
+
* the explicit `overlayColor`) ensure the surface still renders as a
|
|
31
|
+
* translucent tinted scrim instead of disappearing.
|
|
32
|
+
*/
|
|
33
|
+
function GlassFill({
|
|
34
|
+
tint = 'dark',
|
|
35
|
+
intensity = 50,
|
|
36
|
+
overlayColor,
|
|
37
|
+
style
|
|
38
|
+
}) {
|
|
39
|
+
const blurType = tint === 'light' ? 'light' : 'dark';
|
|
40
|
+
const blurAmount = Math.max(0, Math.min(32, Math.round(intensity * 0.32)));
|
|
41
|
+
const fallbackColor = overlayColor ?? (tint === 'light' ? DEFAULT_FALLBACK_LIGHT : DEFAULT_FALLBACK_DARK);
|
|
42
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
43
|
+
style: [_reactNative.StyleSheet.absoluteFill, style],
|
|
44
|
+
pointerEvents: "none",
|
|
45
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blur.BlurView, {
|
|
46
|
+
style: _reactNative.StyleSheet.absoluteFill,
|
|
47
|
+
blurType: blurType,
|
|
48
|
+
blurAmount: blurAmount,
|
|
49
|
+
reducedTransparencyFallbackColor: fallbackColor
|
|
50
|
+
}), overlayColor != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
51
|
+
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
52
|
+
backgroundColor: overlayColor
|
|
53
|
+
}]
|
|
54
|
+
}) : null, _reactNative.Platform.OS === 'android' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
55
|
+
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
56
|
+
backgroundColor: 'rgba(255,255,255,0.03)',
|
|
57
|
+
opacity: 0.6
|
|
58
|
+
}]
|
|
59
|
+
}) : null]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
var _default = exports.default = GlassFill;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
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
|
+
const DEFAULT_FALLBACK_DARK = '#1414174a';
|
|
12
|
+
const DEFAULT_FALLBACK_LIGHT = '#ffffff66';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Web counterpart of `GlassFill`.
|
|
16
|
+
*
|
|
17
|
+
* `@react-native-community/blur` does not ship a web implementation, so for
|
|
18
|
+
* the web bundle we render a translucent `View` with `backdrop-filter: blur()`
|
|
19
|
+
* — which is exactly how 0.0.67 and earlier shipped the glass effect on web.
|
|
20
|
+
* Native bundles pick up `GlassFill.tsx` instead via Metro's platform
|
|
21
|
+
* resolver; the web bundle picks up this file.
|
|
22
|
+
*/
|
|
23
|
+
function GlassFill({
|
|
24
|
+
tint = 'dark',
|
|
25
|
+
intensity = 50,
|
|
26
|
+
overlayColor,
|
|
27
|
+
style
|
|
28
|
+
}) {
|
|
29
|
+
// Approximate mapping: intensity 0-100 -> ~0-30px CSS blur. Keeps parity
|
|
30
|
+
// with the native blur strength so the component looks roughly the same
|
|
31
|
+
// across platforms.
|
|
32
|
+
const blurPx = Math.max(0, Math.min(30, Math.round(intensity * 0.3)));
|
|
33
|
+
const tintColor = overlayColor ?? (tint === 'light' ? DEFAULT_FALLBACK_LIGHT : DEFAULT_FALLBACK_DARK);
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
35
|
+
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
36
|
+
backgroundColor: tintColor
|
|
37
|
+
},
|
|
38
|
+
// backdrop-filter is a web-only CSS property; ignored by RN
|
|
39
|
+
// on native (we never bundle this file there anyway).
|
|
40
|
+
// @ts-ignore web-only style
|
|
41
|
+
{
|
|
42
|
+
backdropFilter: `blur(${blurPx}px)`,
|
|
43
|
+
WebkitBackdropFilter: `blur(${blurPx}px)`
|
|
44
|
+
}, style],
|
|
45
|
+
pointerEvents: "none"
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
var _default = exports.default = GlassFill;
|
|
@@ -12,9 +12,9 @@ exports.Title = Title;
|
|
|
12
12
|
exports.default = void 0;
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _reactNative = require("react-native");
|
|
15
|
-
var _expoBlur = require("expo-blur");
|
|
16
15
|
var _figmaVariablesResolver = require("../../design-tokens/figma-variables-resolver");
|
|
17
16
|
var _Image = _interopRequireDefault(require("../Image/Image"));
|
|
17
|
+
var _GlassFill = _interopRequireDefault(require("./GlassFill"));
|
|
18
18
|
var _reactUtils = require("../../utils/react-utils");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -136,20 +136,24 @@ function Title({
|
|
|
136
136
|
* Glass Footer — pinned to the bottom of the card, **always** on top of the
|
|
137
137
|
* Header (`zIndex: 2`).
|
|
138
138
|
*
|
|
139
|
-
* Glass implementation
|
|
140
|
-
* - **iOS
|
|
141
|
-
*
|
|
142
|
-
* `
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* - **Web:** `BlurView` on web is implemented as `backdrop-filter: blur()`,
|
|
150
|
-
* which already worked in the previous version. Same component, same API.
|
|
139
|
+
* Glass implementation:
|
|
140
|
+
* - **iOS / Android:** `<GlassFill>` (this folder) wraps
|
|
141
|
+
* `@react-native-community/blur`'s `BlurView`. iOS gets a real
|
|
142
|
+
* `UIVisualEffectView` (live OS blur); Android gets the community
|
|
143
|
+
* `RealtimeBlurView` with a token-driven tinted scrim fallback for
|
|
144
|
+
* devices where realtime blur is unavailable.
|
|
145
|
+
* - **Web:** the platform-extension file `GlassFill.web.tsx` renders a
|
|
146
|
+
* translucent View with `backdrop-filter: blur()` — Metro picks the
|
|
147
|
+
* correct file automatically, so the web bundle never imports the
|
|
148
|
+
* native-only blur module.
|
|
151
149
|
*
|
|
152
|
-
*
|
|
150
|
+
* Why we don't use `expo-blur`: it requires Expo Modules autolinking on the
|
|
151
|
+
* consumer side (`use_expo_modules!` / `ExpoModulesPackage`), which silently
|
|
152
|
+
* breaks bare React Native apps that just install this library and run
|
|
153
|
+
* `pod install`. `@react-native-community/blur` is a regular RN native
|
|
154
|
+
* module — autolinking handles it with no additional setup.
|
|
155
|
+
*
|
|
156
|
+
* Tokens still drive the tint color, blur intensity and inner spacing.
|
|
153
157
|
*/
|
|
154
158
|
function Footer({
|
|
155
159
|
children,
|
|
@@ -163,10 +167,14 @@ function Footer({
|
|
|
163
167
|
const paddingVertical = parseFloat((0, _figmaVariablesResolver.getVariableByName)('cardMedia/footer/padding/vertical', modes) || '12');
|
|
164
168
|
|
|
165
169
|
// Figma tokens:
|
|
166
|
-
// blur/minimal/background -> tint laid over the
|
|
167
|
-
//
|
|
168
|
-
//
|
|
169
|
-
//
|
|
170
|
+
// blur/minimal/background -> tint laid over the live blur, also used
|
|
171
|
+
// as the iOS reduced-transparency fallback.
|
|
172
|
+
// blur/minimal -> blur radius (px). The community BlurView
|
|
173
|
+
// uses `blurAmount` (~0-32). `GlassFill`
|
|
174
|
+
// accepts a 0-100 "intensity" (kept compat
|
|
175
|
+
// with the previous expo-blur scale) and
|
|
176
|
+
// maps it internally — here we convert the
|
|
177
|
+
// token's radius to that intensity scale.
|
|
170
178
|
const glassBgColor = (0, _figmaVariablesResolver.getVariableByName)('blur/minimal/background', modes) || '#1414174a';
|
|
171
179
|
const blurRadius = parseFloat((0, _figmaVariablesResolver.getVariableByName)('blur/minimal', modes) || '29');
|
|
172
180
|
const intensity = Math.max(0, Math.min(100, Math.round(blurRadius * 1.7)));
|
|
@@ -187,22 +195,11 @@ function Footer({
|
|
|
187
195
|
zIndex: 2
|
|
188
196
|
}, style],
|
|
189
197
|
pointerEvents: "box-none",
|
|
190
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
191
|
-
style: _reactNative.StyleSheet.absoluteFill,
|
|
198
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_GlassFill.default, {
|
|
192
199
|
tint: tint,
|
|
193
200
|
intensity: intensity,
|
|
194
|
-
|
|
201
|
+
overlayColor: glassBgColor
|
|
195
202
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
196
|
-
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
197
|
-
backgroundColor: glassBgColor
|
|
198
|
-
}]
|
|
199
|
-
}), _reactNative.Platform.OS === 'android' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
200
|
-
style: [_reactNative.StyleSheet.absoluteFill, {
|
|
201
|
-
backgroundColor: 'rgba(255,255,255,0.03)',
|
|
202
|
-
opacity: 0.6
|
|
203
|
-
}],
|
|
204
|
-
pointerEvents: "none"
|
|
205
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
206
203
|
style: {
|
|
207
204
|
flexDirection: 'row',
|
|
208
205
|
alignItems: 'center',
|
|
@@ -4,33 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _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
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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) || '
|
|
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
|
|
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) || '
|
|
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
|
|
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
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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: [
|
|
176
|
+
style: [tokens.containerBaseStyle, tokens.detailedContainerStyle, style],
|
|
88
177
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
89
|
-
style:
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
}),
|
|
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
|
|
209
|
+
const prominentContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
105
210
|
style: {
|
|
106
|
-
gap:
|
|
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:
|
|
218
|
+
style: tokens.titleTextStyle,
|
|
118
219
|
children: title
|
|
119
220
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
120
|
-
style:
|
|
221
|
+
style: tokens.bodyTextStyle,
|
|
121
222
|
children: body
|
|
122
223
|
})]
|
|
123
|
-
}),
|
|
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: [
|
|
131
|
-
children: [
|
|
132
|
-
style:
|
|
133
|
-
|
|
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"));
|