@coinbase/cds-mobile 9.18.0 → 9.19.0
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 +6 -0
- package/dts/icons/Icon.d.ts.map +1 -1
- package/dts/icons/createIcon.d.ts +29 -30
- package/dts/icons/createIcon.d.ts.map +1 -1
- package/dts/icons/index.d.ts +7 -2
- package/dts/icons/index.d.ts.map +1 -1
- package/esm/icons/createIcon.js +57 -35
- package/esm/icons/index.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,12 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
<!-- template-start -->
|
|
10
10
|
|
|
11
|
+
## 9.19.0 (8/20/2026 PST)
|
|
12
|
+
|
|
13
|
+
#### 🚀 Updates
|
|
14
|
+
|
|
15
|
+
- Feat: support custom icon sets in name-prop components. [[#848](https://github.com/coinbase/cds/pull/848)]
|
|
16
|
+
|
|
11
17
|
## 9.18.0 (8/19/2026 PST)
|
|
12
18
|
|
|
13
19
|
#### 🚀 Updates
|
package/dts/icons/Icon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../src/icons/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAGpE,OAAO,EAGL,iBAAiB,EACjB,KAAK,aAAa,IAAI,oBAAoB,EAC1C,KAAK,SAAS,IAAI,gBAAgB,EACnC,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,aAAa,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;AAC3D,MAAM,MAAM,SAAS,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;AAEnD,eAAO,MAAM,IAAI;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../src/icons/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAGpE,OAAO,EAGL,iBAAiB,EACjB,KAAK,aAAa,IAAI,oBAAoB,EAC1C,KAAK,SAAS,IAAI,gBAAgB,EACnC,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,aAAa,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;AAC3D,MAAM,MAAM,SAAS,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;AAEnD,eAAO,MAAM,IAAI;;;;;;;;;;;YAMohH,CAAC;YAAyE,CAAC;;;;kWAH9mH,CAAC;AAEH,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -14,31 +14,21 @@ import type { SharedProps } from '@coinbase/cds-common/types/SharedProps';
|
|
|
14
14
|
import type { PaddingProps } from '@coinbase/cds-common/types/SpacingProps';
|
|
15
15
|
/** Default font family for the CDS icon glyph font. */
|
|
16
16
|
export declare const DEFAULT_ICON_FONT_FAMILY = 'CoinbaseIcons';
|
|
17
|
-
/**
|
|
18
|
-
* Shape of the glyph map an icon set must provide. Keys are
|
|
19
|
-
* `${name}-${sourcePixelSize}-${'active' | 'inactive'}` and values are the
|
|
20
|
-
* single Unicode character rendered in the icon font.
|
|
21
|
-
*/
|
|
17
|
+
/** Values are the single character to render in the icon font. */
|
|
22
18
|
export type GlyphMap<Name extends string> = Record<
|
|
23
19
|
`${Name}-${IconSourcePixelSize}-${'active' | 'inactive'}`,
|
|
24
20
|
string
|
|
25
21
|
>;
|
|
26
|
-
/** Arguments passed to a glyph resolver to look up an icon's glyph. */
|
|
27
22
|
export type IconGlyphResolverArgs<Name extends string> = {
|
|
28
|
-
/** Glyph map bound to this icon set. */
|
|
29
23
|
glyphMap: GlyphMap<Name>;
|
|
30
|
-
/** Icon name requested via the `name` prop. */
|
|
31
24
|
name: Name;
|
|
32
|
-
/** Size token requested via the `size` prop. */
|
|
33
25
|
size: IconSize;
|
|
34
|
-
/**
|
|
26
|
+
/** Pixel size resolved from the theme, including device font scaling. */
|
|
35
27
|
pixelSize: number;
|
|
36
|
-
/** Whether the active variant was requested. */
|
|
37
28
|
active: boolean;
|
|
38
29
|
};
|
|
39
|
-
/**
|
|
40
|
-
export type
|
|
41
|
-
/** Generated glyph map for this icon set. */
|
|
30
|
+
/** An icon font and the glyphs it provides. */
|
|
31
|
+
export type IconGlyphSource<Name extends string = string> = {
|
|
42
32
|
glyphMap: GlyphMap<Name>;
|
|
43
33
|
/**
|
|
44
34
|
* Font family registered by the icon set's font (loaded via `expo-font`).
|
|
@@ -46,13 +36,30 @@ export type CreateIconConfig<Name extends string> = {
|
|
|
46
36
|
*/
|
|
47
37
|
fontFamily?: string;
|
|
48
38
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* `${name}-${sourceSize}-${'active' | 'inactive'}`, where `sourceSize` is
|
|
52
|
-
* `12`, `16`, or `24`.
|
|
39
|
+
* Override to use a custom key format or size model. Defaults to the CDS
|
|
40
|
+
* scheme: `${name}-${sourceSize}-${state}`, with `sourceSize` 12, 16, or 24.
|
|
53
41
|
*/
|
|
54
42
|
getGlyph?: (args: IconGlyphResolverArgs<Name>) => string | undefined;
|
|
55
43
|
};
|
|
44
|
+
export type IconGlyphSourceProviderProps = {
|
|
45
|
+
/**
|
|
46
|
+
* Consulted before the built-in glyphs. A nested provider replaces it. Its
|
|
47
|
+
* font must be loaded (e.g. via `expo-font`).
|
|
48
|
+
*/
|
|
49
|
+
source: IconGlyphSource<any>;
|
|
50
|
+
children: React.ReactNode;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Adds a custom glyph source to every CDS icon rendered below.
|
|
54
|
+
*
|
|
55
|
+
* Scope this to a subtree: a source reusing a built-in name re-skins that icon
|
|
56
|
+
* everywhere below, including icons CDS renders internally (`close`, `caretUp`,
|
|
57
|
+
* `checkmark`). Its names must be names the icon component already accepts.
|
|
58
|
+
*/
|
|
59
|
+
export declare function IconGlyphSourceProvider({
|
|
60
|
+
source,
|
|
61
|
+
children,
|
|
62
|
+
}: IconGlyphSourceProviderProps): import('react/jsx-runtime').JSX.Element;
|
|
56
63
|
export type IconBaseProps<Name extends string = string> = SharedProps &
|
|
57
64
|
PaddingProps &
|
|
58
65
|
Pick<SharedAccessibilityProps, 'accessibilityLabel' | 'accessibilityHint'> &
|
|
@@ -97,18 +104,10 @@ export type IconProps<Name extends string = string> = IconBaseProps<Name> & {
|
|
|
97
104
|
};
|
|
98
105
|
};
|
|
99
106
|
declare const getIconSourceSize: (iconSize: number) => IconSourcePixelSize;
|
|
100
|
-
/**
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
* icon component that reuses all of the CDS rendering, accessibility, and
|
|
105
|
-
* theming behavior.
|
|
106
|
-
*/
|
|
107
|
-
export declare function createIcon<Name extends string>({
|
|
108
|
-
glyphMap,
|
|
109
|
-
fontFamily,
|
|
110
|
-
getGlyph,
|
|
111
|
-
}: CreateIconConfig<Name>): React.MemoExoticComponent<
|
|
107
|
+
/** Creates a typed `Icon` component bound to an icon set. */
|
|
108
|
+
export declare function createIcon<Name extends string>(
|
|
109
|
+
source: IconGlyphSource<Name>,
|
|
110
|
+
): React.MemoExoticComponent<
|
|
112
111
|
({
|
|
113
112
|
ref,
|
|
114
113
|
..._props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIcon.d.ts","sourceRoot":"","sources":["../../src/icons/createIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"createIcon.d.ts","sourceRoot":"","sources":["../../src/icons/createIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EACL,QAAQ,EACR,KAAK,SAAS,EACd,IAAI,EACJ,KAAK,SAAS,IAAI,eAAe,EACjC,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AACtB,OAAO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S,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,kDACpC,SAAS,CAAC,IAAI,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;CAAE,gTAiHnF;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
package/dts/icons/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
GlyphMap,
|
|
3
|
+
IconGlyphResolverArgs,
|
|
4
|
+
IconGlyphSource,
|
|
5
|
+
IconGlyphSourceProviderProps,
|
|
6
|
+
} from './createIcon';
|
|
7
|
+
export { createIcon, DEFAULT_ICON_FONT_FAMILY, IconGlyphSourceProvider } from './createIcon';
|
|
1
8
|
export * from './Icon';
|
|
2
|
-
export { createIcon, DEFAULT_ICON_FONT_FAMILY } from './createIcon';
|
|
3
|
-
export type { CreateIconConfig, GlyphMap, IconGlyphResolverArgs } from './createIcon';
|
|
4
9
|
export * from './LogoMark';
|
|
5
10
|
export * from './LogoWordmark';
|
|
6
11
|
export * from './SubBrandLogoMark';
|
package/dts/icons/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/icons/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/icons/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,QAAQ,EACR,qBAAqB,EACrB,eAAe,EACf,4BAA4B,GAC7B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC7F,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,YAAY,CAAC"}
|
package/esm/icons/createIcon.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const _excluded = ["ref"];
|
|
2
2
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
3
|
-
|
|
3
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
4
|
+
import React, { createContext, memo, useContext, useMemo } from 'react';
|
|
4
5
|
import { Animated, Text, useWindowDimensions } from 'react-native';
|
|
5
6
|
import { isDevelopment } from '@coinbase/cds-utils';
|
|
6
7
|
import { useComponentConfig } from '../hooks/useComponentConfig';
|
|
@@ -11,16 +12,28 @@ import { Box } from '../layout/Box';
|
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
export const DEFAULT_ICON_FONT_FAMILY = 'CoinbaseIcons';
|
|
13
14
|
|
|
14
|
-
/**
|
|
15
|
-
* Shape of the glyph map an icon set must provide. Keys are
|
|
16
|
-
* `${name}-${sourcePixelSize}-${'active' | 'inactive'}` and values are the
|
|
17
|
-
* single Unicode character rendered in the icon font.
|
|
18
|
-
*/
|
|
15
|
+
/** Values are the single character to render in the icon font. */
|
|
19
16
|
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
/** Configuration used to bind an icon set to a typed `Icon` component. */
|
|
17
|
+
/** An icon font and the glyphs it provides. */
|
|
23
18
|
|
|
19
|
+
const IconGlyphSourceContext = /*#__PURE__*/createContext(undefined);
|
|
20
|
+
/**
|
|
21
|
+
* Adds a custom glyph source to every CDS icon rendered below.
|
|
22
|
+
*
|
|
23
|
+
* Scope this to a subtree: a source reusing a built-in name re-skins that icon
|
|
24
|
+
* everywhere below, including icons CDS renders internally (`close`, `caretUp`,
|
|
25
|
+
* `checkmark`). Its names must be names the icon component already accepts.
|
|
26
|
+
*/
|
|
27
|
+
export function IconGlyphSourceProvider(_ref) {
|
|
28
|
+
let {
|
|
29
|
+
source,
|
|
30
|
+
children
|
|
31
|
+
} = _ref;
|
|
32
|
+
return /*#__PURE__*/_jsx(IconGlyphSourceContext.Provider, {
|
|
33
|
+
value: source,
|
|
34
|
+
children: children
|
|
35
|
+
});
|
|
36
|
+
}
|
|
24
37
|
const getIconSourceSize = iconSize => {
|
|
25
38
|
if (iconSize <= 12) return 12;
|
|
26
39
|
if (iconSize <= 16) return 16;
|
|
@@ -28,31 +41,35 @@ const getIconSourceSize = iconSize => {
|
|
|
28
41
|
};
|
|
29
42
|
|
|
30
43
|
/** Default glyph resolver using the CDS `${name}-${sourceSize}-${state}` key scheme. */
|
|
31
|
-
const defaultGetGlyph =
|
|
44
|
+
const defaultGetGlyph = _ref2 => {
|
|
32
45
|
let {
|
|
33
46
|
glyphMap,
|
|
34
47
|
name,
|
|
35
48
|
pixelSize,
|
|
36
49
|
active
|
|
37
|
-
} =
|
|
50
|
+
} = _ref2;
|
|
38
51
|
const sourceSize = getIconSourceSize(pixelSize);
|
|
39
52
|
const key = name + "-" + sourceSize + "-" + (active ? 'active' : 'inactive');
|
|
40
53
|
return glyphMap[key];
|
|
41
54
|
};
|
|
55
|
+
/** Resolves a glyph from one source, with that source's font. */
|
|
56
|
+
const resolveFromSource = (source, args) => {
|
|
57
|
+
var _source$getGlyph, _source$fontFamily;
|
|
58
|
+
const char = ((_source$getGlyph = source.getGlyph) != null ? _source$getGlyph : defaultGetGlyph)(_extends({}, args, {
|
|
59
|
+
glyphMap: source.glyphMap
|
|
60
|
+
}));
|
|
61
|
+
return char === undefined ? undefined : {
|
|
62
|
+
char,
|
|
63
|
+
fontFamily: (_source$fontFamily = source.fontFamily) != null ? _source$fontFamily : DEFAULT_ICON_FONT_FAMILY
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
const resolveGlyph = (contextSource, boundSource, args) => {
|
|
67
|
+
const fromContext = contextSource ? resolveFromSource(contextSource, args) : undefined;
|
|
68
|
+
return fromContext != null ? fromContext : resolveFromSource(boundSource, args);
|
|
69
|
+
};
|
|
42
70
|
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
* font family, and name union). The default CDS `Icon` is created from this
|
|
46
|
-
* factory; consumers with their own icon package can create their own typed
|
|
47
|
-
* icon component that reuses all of the CDS rendering, accessibility, and
|
|
48
|
-
* theming behavior.
|
|
49
|
-
*/
|
|
50
|
-
export function createIcon(_ref2) {
|
|
51
|
-
let {
|
|
52
|
-
glyphMap,
|
|
53
|
-
fontFamily = DEFAULT_ICON_FONT_FAMILY,
|
|
54
|
-
getGlyph = defaultGetGlyph
|
|
55
|
-
} = _ref2;
|
|
71
|
+
/** Creates a typed `Icon` component bound to an icon set. */
|
|
72
|
+
export function createIcon(source) {
|
|
56
73
|
const Icon = /*#__PURE__*/memo(_ref3 => {
|
|
57
74
|
let {
|
|
58
75
|
ref
|
|
@@ -89,6 +106,15 @@ export function createIcon(_ref2) {
|
|
|
89
106
|
const iconSize = allowFontScaling ? theme.iconSize[size] * fontScale : theme.iconSize[size];
|
|
90
107
|
const iconColor = theme.color[color];
|
|
91
108
|
const finalColor = dangerouslySetColor != null ? dangerouslySetColor : iconColor;
|
|
109
|
+
|
|
110
|
+
// Tried before the bound set, so a source can override a built-in icon.
|
|
111
|
+
const contextSource = useContext(IconGlyphSourceContext);
|
|
112
|
+
const resolved = resolveGlyph(contextSource, source, {
|
|
113
|
+
name,
|
|
114
|
+
size,
|
|
115
|
+
pixelSize: iconSize,
|
|
116
|
+
active: Boolean(active)
|
|
117
|
+
});
|
|
92
118
|
const rootStyle = useMemo(() => {
|
|
93
119
|
var _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref0, _ref1;
|
|
94
120
|
return [{
|
|
@@ -98,22 +124,18 @@ export function createIcon(_ref2) {
|
|
|
98
124
|
paddingStart: theme.space[(_ref0 = (_ref1 = paddingStart != null ? paddingStart : paddingX) != null ? _ref1 : padding) != null ? _ref0 : 0]
|
|
99
125
|
}, style, styles == null ? void 0 : styles.root];
|
|
100
126
|
}, [style, theme.space, padding, paddingX, paddingY, paddingTop, paddingEnd, paddingBottom, paddingStart, styles == null ? void 0 : styles.root]);
|
|
127
|
+
|
|
128
|
+
// The matching source decides the font, so a source covering only some
|
|
129
|
+
// sizes or states of a name mixes fonts across that name.
|
|
101
130
|
const iconStyle = useMemo(() => [{
|
|
102
|
-
fontFamily,
|
|
131
|
+
fontFamily: resolved == null ? void 0 : resolved.fontFamily,
|
|
103
132
|
fontSize: iconSize,
|
|
104
133
|
height: iconSize,
|
|
105
134
|
width: iconSize,
|
|
106
135
|
lineHeight: iconSize,
|
|
107
136
|
color: finalColor
|
|
108
|
-
}, styles == null ? void 0 : styles.icon], [finalColor, iconSize, styles == null ? void 0 : styles.icon]);
|
|
109
|
-
|
|
110
|
-
glyphMap,
|
|
111
|
-
name,
|
|
112
|
-
size,
|
|
113
|
-
pixelSize: iconSize,
|
|
114
|
-
active: Boolean(active)
|
|
115
|
-
});
|
|
116
|
-
if (glyph === undefined) {
|
|
137
|
+
}, styles == null ? void 0 : styles.icon], [finalColor, iconSize, resolved == null ? void 0 : resolved.fontFamily, styles == null ? void 0 : styles.icon]);
|
|
138
|
+
if (resolved === undefined) {
|
|
117
139
|
if (isDevelopment()) {
|
|
118
140
|
console.error("Unable to find glyph for icon \"" + name + "\" at size \"" + size + "\"");
|
|
119
141
|
}
|
|
@@ -135,7 +157,7 @@ export function createIcon(_ref2) {
|
|
|
135
157
|
// TODO https://linear.app/coinbase/issue/CDS-1518/audit-potentially-harmful-reactnative-animated-pattern
|
|
136
158
|
,
|
|
137
159
|
style: iconStyle,
|
|
138
|
-
children:
|
|
160
|
+
children: resolved.char
|
|
139
161
|
})
|
|
140
162
|
});
|
|
141
163
|
});
|
package/esm/icons/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
export { createIcon, DEFAULT_ICON_FONT_FAMILY, IconGlyphSourceProvider } from './createIcon';
|
|
1
2
|
export * from './Icon';
|
|
2
|
-
export { createIcon, DEFAULT_ICON_FONT_FAMILY } from './createIcon';
|
|
3
3
|
export * from './LogoMark';
|
|
4
4
|
export * from './LogoWordmark';
|
|
5
5
|
export * from './SubBrandLogoMark';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-mobile",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.19.0",
|
|
4
4
|
"description": "Coinbase Design System - Mobile",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -218,8 +218,8 @@
|
|
|
218
218
|
"react-native-worklets": "0.5.2"
|
|
219
219
|
},
|
|
220
220
|
"dependencies": {
|
|
221
|
-
"@coinbase/cds-common": "^9.
|
|
222
|
-
"@coinbase/cds-icons": "^5.
|
|
221
|
+
"@coinbase/cds-common": "^9.19.0",
|
|
222
|
+
"@coinbase/cds-icons": "^5.22.0",
|
|
223
223
|
"@coinbase/cds-illustrations": "^4.48.0",
|
|
224
224
|
"@coinbase/cds-lottie-files": "^3.3.4",
|
|
225
225
|
"@coinbase/cds-utils": "^2.3.5",
|