jfs-components 0.0.85 → 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 +15 -0
- package/lib/commonjs/assets.d.js +1 -0
- package/lib/commonjs/components/AllocationComparisonChart/AllocationComparisonChart.js +299 -0
- package/lib/commonjs/components/FullscreenModal/FullscreenModal.js +104 -94
- package/lib/commonjs/components/Icon/Icon.js +112 -0
- package/lib/commonjs/components/index.js +14 -0
- package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
- package/lib/commonjs/icons/registry.js +1 -1
- package/lib/module/assets.d.js +1 -0
- package/lib/module/components/AllocationComparisonChart/AllocationComparisonChart.js +293 -0
- package/lib/module/components/FullscreenModal/FullscreenModal.js +106 -96
- package/lib/module/components/Icon/Icon.js +106 -0
- package/lib/module/components/index.js +2 -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/AllocationComparisonChart/AllocationComparisonChart.d.ts +118 -0
- package/lib/typescript/src/components/FullscreenModal/FullscreenModal.d.ts +39 -29
- package/lib/typescript/src/components/Icon/Icon.d.ts +75 -0
- package/lib/typescript/src/components/index.d.ts +2 -0
- package/lib/typescript/src/icons/registry.d.ts +1 -1
- package/package.json +1 -1
- package/src/assets.d.ts +24 -0
- package/src/components/AllocationComparisonChart/AllocationComparisonChart.tsx +450 -0
- package/src/components/FullscreenModal/FullscreenModal.tsx +131 -126
- package/src/components/Icon/Icon.tsx +167 -0
- package/src/components/index.ts +2 -0
- package/src/design-tokens/Coin Variables-variables-full.json +1 -1
- package/src/icons/registry.ts +1 -1
|
@@ -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);
|
|
@@ -33,6 +33,12 @@ Object.defineProperty(exports, "ActionTile", {
|
|
|
33
33
|
return _ActionTile.default;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "AllocationComparisonChart", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _AllocationComparisonChart.default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
36
42
|
Object.defineProperty(exports, "AmountInput", {
|
|
37
43
|
enumerable: true,
|
|
38
44
|
get: function () {
|
|
@@ -357,6 +363,12 @@ Object.defineProperty(exports, "HoldingsCard", {
|
|
|
357
363
|
return _HoldingsCard.default;
|
|
358
364
|
}
|
|
359
365
|
});
|
|
366
|
+
Object.defineProperty(exports, "Icon", {
|
|
367
|
+
enumerable: true,
|
|
368
|
+
get: function () {
|
|
369
|
+
return _Icon.default;
|
|
370
|
+
}
|
|
371
|
+
});
|
|
360
372
|
Object.defineProperty(exports, "IconButton", {
|
|
361
373
|
enumerable: true,
|
|
362
374
|
get: function () {
|
|
@@ -881,10 +893,12 @@ var _CircularProgressBarDoted = _interopRequireDefault(require("./CircularProgre
|
|
|
881
893
|
var _CircularRating = _interopRequireDefault(require("./CircularRating/CircularRating"));
|
|
882
894
|
var _CoverageRing = _interopRequireDefault(require("./CoverageRing/CoverageRing"));
|
|
883
895
|
var _CoverageBarComparison = _interopRequireDefault(require("./CoverageBarComparison/CoverageBarComparison"));
|
|
896
|
+
var _AllocationComparisonChart = _interopRequireDefault(require("./AllocationComparisonChart/AllocationComparisonChart"));
|
|
884
897
|
var _MonthlyStatusGrid = _interopRequireWildcard(require("./MonthlyStatusGrid/MonthlyStatusGrid"));
|
|
885
898
|
var _Gauge = _interopRequireDefault(require("./Gauge/Gauge"));
|
|
886
899
|
var _HoldingsCard = _interopRequireDefault(require("./HoldingsCard/HoldingsCard"));
|
|
887
900
|
var _HStack = _interopRequireDefault(require("./HStack/HStack"));
|
|
901
|
+
var _Icon = _interopRequireDefault(require("./Icon/Icon"));
|
|
888
902
|
var _IconButton = _interopRequireDefault(require("./IconButton/IconButton"));
|
|
889
903
|
var _IconCapsule = _interopRequireDefault(require("./IconCapsule/IconCapsule"));
|
|
890
904
|
var _Image = _interopRequireDefault(require("./Image/Image"));
|