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.
Files changed (28) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/lib/commonjs/assets.d.js +1 -0
  3. package/lib/commonjs/components/AllocationComparisonChart/AllocationComparisonChart.js +299 -0
  4. package/lib/commonjs/components/FullscreenModal/FullscreenModal.js +104 -94
  5. package/lib/commonjs/components/Icon/Icon.js +112 -0
  6. package/lib/commonjs/components/index.js +14 -0
  7. package/lib/commonjs/design-tokens/Coin Variables-variables-full.json +1 -1
  8. package/lib/commonjs/icons/registry.js +1 -1
  9. package/lib/module/assets.d.js +1 -0
  10. package/lib/module/components/AllocationComparisonChart/AllocationComparisonChart.js +293 -0
  11. package/lib/module/components/FullscreenModal/FullscreenModal.js +106 -96
  12. package/lib/module/components/Icon/Icon.js +106 -0
  13. package/lib/module/components/index.js +2 -0
  14. package/lib/module/design-tokens/Coin Variables-variables-full.json +1 -1
  15. package/lib/module/icons/registry.js +1 -1
  16. package/lib/typescript/src/components/AllocationComparisonChart/AllocationComparisonChart.d.ts +118 -0
  17. package/lib/typescript/src/components/FullscreenModal/FullscreenModal.d.ts +39 -29
  18. package/lib/typescript/src/components/Icon/Icon.d.ts +75 -0
  19. package/lib/typescript/src/components/index.d.ts +2 -0
  20. package/lib/typescript/src/icons/registry.d.ts +1 -1
  21. package/package.json +1 -1
  22. package/src/assets.d.ts +24 -0
  23. package/src/components/AllocationComparisonChart/AllocationComparisonChart.tsx +450 -0
  24. package/src/components/FullscreenModal/FullscreenModal.tsx +131 -126
  25. package/src/components/Icon/Icon.tsx +167 -0
  26. package/src/components/index.ts +2 -0
  27. package/src/design-tokens/Coin Variables-variables-full.json +1 -1
  28. package/src/icons/registry.ts +1 -1
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+
3
+ import React, { useMemo } from 'react';
4
+ import { View } from 'react-native';
5
+ import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
6
+ import { useTokens } from '../../design-tokens/JFSThemeProvider';
7
+ import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils';
8
+ import BaseIcon from '../../icons/Icon';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ function resolveIconTokens(modes) {
11
+ const iconColor = getVariableByName('icon/color', modes) || '#ad8444';
12
+ const iconSize = getVariableByName('icon/size', modes) || 18;
13
+ const paddingLeft = getVariableByName('icon/padding/left', modes) || 0;
14
+ const paddingTop = getVariableByName('icon/padding/top', modes) || 0;
15
+ const paddingRight = getVariableByName('icon/padding/right', modes) || 0;
16
+ const paddingBottom = getVariableByName('icon/padding/bottom', modes) || 0;
17
+ return {
18
+ containerStyle: {
19
+ flexDirection: 'column',
20
+ alignItems: 'center',
21
+ justifyContent: 'center',
22
+ overflow: 'hidden',
23
+ paddingLeft,
24
+ paddingTop,
25
+ paddingRight,
26
+ paddingBottom
27
+ },
28
+ iconColor,
29
+ iconSize
30
+ };
31
+ }
32
+
33
+ /**
34
+ * Icon component — a design-token-driven wrapper around a single glyph.
35
+ *
36
+ * It mirrors the Figma "Icon" component: a padded, centered container whose
37
+ * color and size are resolved from the `icon/*` design tokens via `modes`.
38
+ * The glyph itself can be supplied three ways, in order of precedence:
39
+ *
40
+ * 1. `children` — a real slot for any node (custom SVG component, nested
41
+ * `Icon`, etc.). `modes` cascade into the slot automatically.
42
+ * 2. `iconName` — a registry icon in the `ic_something` format.
43
+ * 3. `source` — a {@link UnifiedSource} fallback (remote URI, inline SVG XML,
44
+ * `require()` asset, SVG component, or React element), tinted with the
45
+ * mode-resolved icon color.
46
+ *
47
+ * `color` and `size` props let consumers override the token values per
48
+ * instance without touching `modes`.
49
+ *
50
+ * @example
51
+ * ```tsx
52
+ * // Built-in registry icon (default path).
53
+ * <Icon iconName="ic_card" modes={{ 'Color Mode': 'Light' }} />
54
+ *
55
+ * // Per-instance overrides.
56
+ * <Icon iconName="ic_ccv" color="#5c00b5" size={24} />
57
+ *
58
+ * // Fallback to an external source when the name isn't in the registry.
59
+ * <Icon source="https://cdn.example.com/glyph.svg" />
60
+ *
61
+ * // Slot: render any node as the icon.
62
+ * <Icon><BrandLogo /></Icon>
63
+ * ```
64
+ */
65
+ function Icon({
66
+ iconName,
67
+ source,
68
+ children,
69
+ color,
70
+ size,
71
+ modes: propModes = EMPTY_MODES,
72
+ style: styleProp,
73
+ ...rest
74
+ }) {
75
+ const {
76
+ modes: globalModes
77
+ } = useTokens();
78
+ const modes = useMemo(() => globalModes === EMPTY_MODES && propModes === EMPTY_MODES ? EMPTY_MODES : {
79
+ ...globalModes,
80
+ ...propModes
81
+ }, [globalModes, propModes]);
82
+ const tokens = useMemo(() => resolveIconTokens(modes), [modes]);
83
+ const composedStyle = useMemo(() => styleProp ? [tokens.containerStyle, styleProp] : tokens.containerStyle, [tokens.containerStyle, styleProp]);
84
+ const hasSlot = React.Children.count(children) > 0;
85
+
86
+ // Only fall back to the default glyph when nothing at all is provided so an
87
+ // explicit `source` (without an `iconName`) isn't shadowed by `ic_card`.
88
+ const resolvedName = iconName ?? (source === undefined ? 'ic_card' : undefined);
89
+ const iconColor = color ?? tokens.iconColor;
90
+ const iconSize = size ?? tokens.iconSize;
91
+ return /*#__PURE__*/_jsx(View, {
92
+ style: composedStyle,
93
+ ...rest,
94
+ children: hasSlot ? cloneChildrenWithModes(children, modes) : /*#__PURE__*/_jsx(BaseIcon, {
95
+ name: resolvedName,
96
+ ...(source !== undefined ? {
97
+ source
98
+ } : {}),
99
+ size: iconSize,
100
+ color: iconColor,
101
+ accessibilityElementsHidden: true,
102
+ importantForAccessibility: "no"
103
+ })
104
+ });
105
+ }
106
+ export default /*#__PURE__*/React.memo(Icon);
@@ -39,10 +39,12 @@ export { default as CircularProgressBarDoted } from './CircularProgressBarDoted/
39
39
  export { default as CircularRating } from './CircularRating/CircularRating';
40
40
  export { default as CoverageRing } from './CoverageRing/CoverageRing';
41
41
  export { default as CoverageBarComparison } from './CoverageBarComparison/CoverageBarComparison';
42
+ export { default as AllocationComparisonChart } from './AllocationComparisonChart/AllocationComparisonChart';
42
43
  export { default as MonthlyStatusGrid, CalendarGlyph } from './MonthlyStatusGrid/MonthlyStatusGrid';
43
44
  export { default as Gauge } from './Gauge/Gauge';
44
45
  export { default as HoldingsCard } from './HoldingsCard/HoldingsCard';
45
46
  export { default as HStack } from './HStack/HStack';
47
+ export { default as Icon } from './Icon/Icon';
46
48
  export { default as IconButton } from './IconButton/IconButton';
47
49
  export { default as IconCapsule } from './IconCapsule/IconCapsule';
48
50
  export { default as Image } from './Image/Image';