@cdx-ui/components 0.0.1-beta.40 → 0.0.1-beta.42
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/README.md +6 -6
- package/lib/commonjs/components/Icon/index.js +2 -2
- package/lib/commonjs/components/IconButton/index.js.map +1 -1
- package/lib/commonjs/figma/Avatar.figma.js +1 -1
- package/lib/commonjs/figma/CLAUDE.md +1 -1
- package/lib/commonjs/figma/IconButton.figma.js +1 -1
- package/lib/commonjs/metro/withCdxMetroConfig.js +7 -18
- package/lib/commonjs/metro/withCdxMetroConfig.js.map +1 -1
- package/lib/commonjs/metro/withForgeMetroConfig.js +24 -0
- package/lib/commonjs/metro/withForgeMetroConfig.js.map +1 -0
- package/lib/commonjs/styles/primitives.js +1 -1
- package/lib/module/components/Icon/index.js +2 -2
- package/lib/module/components/IconButton/index.js.map +1 -1
- package/lib/module/figma/Avatar.figma.js +1 -1
- package/lib/module/figma/CLAUDE.md +1 -1
- package/lib/module/figma/IconButton.figma.js +1 -1
- package/lib/module/metro/withCdxMetroConfig.js +3 -17
- package/lib/module/metro/withCdxMetroConfig.js.map +1 -1
- package/lib/module/metro/withForgeMetroConfig.js +20 -0
- package/lib/module/metro/withForgeMetroConfig.js.map +1 -0
- package/lib/module/styles/primitives.js +1 -1
- package/lib/typescript/components/Icon/index.d.ts +5 -5
- package/lib/typescript/components/Icon/index.d.ts.map +1 -1
- package/lib/typescript/components/IconButton/index.d.ts +3 -3
- package/lib/typescript/components/IconButton/index.d.ts.map +1 -1
- package/lib/typescript/metro/withCdxMetroConfig.d.ts +4 -18
- package/lib/typescript/metro/withCdxMetroConfig.d.ts.map +1 -1
- package/lib/typescript/metro/withForgeMetroConfig.d.ts +19 -0
- package/lib/typescript/metro/withForgeMetroConfig.d.ts.map +1 -0
- package/package.json +8 -8
- package/src/components/Icon/index.tsx +5 -5
- package/src/components/IconButton/index.tsx +4 -4
- package/src/metro/withCdxMetroConfig.ts +4 -29
- package/src/metro/withForgeMetroConfig.ts +29 -0
- package/src/styles/primitives.ts +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @cdx-ui/components
|
|
2
2
|
|
|
3
|
-
Styled, theme-aware UI components for the
|
|
3
|
+
Styled, theme-aware UI components for the Forge Design System.
|
|
4
4
|
|
|
5
5
|
Built on top of [`@cdx-ui/primitives`](../primitives/) and [`@cdx-ui/styles`](../styles/), styled via [Uniwind](https://uniwind.dev) + [CVA](https://cva.style).
|
|
6
6
|
|
|
@@ -42,18 +42,18 @@ AlertDialog, Avatar, BottomSheet, Button, Card, Checkbox, Chip, Dialog, Field, F
|
|
|
42
42
|
|
|
43
43
|
### Metro configuration helper
|
|
44
44
|
|
|
45
|
-
The package ships a `
|
|
45
|
+
The package ships a `withForgeMetroConfig` helper that wraps your Metro config with Forge UI's styling-layer setup. This abstracts the underlying Uniwind configuration so consuming Metro configs stay stable if the styling layer changes.
|
|
46
46
|
|
|
47
47
|
```js
|
|
48
|
-
const {
|
|
48
|
+
const { withForgeMetroConfig } = require('@cdx-ui/components/metro');
|
|
49
49
|
|
|
50
|
-
module.exports =
|
|
50
|
+
module.exports = withForgeMetroConfig(config, {
|
|
51
51
|
cssEntryFile: './global.css',
|
|
52
52
|
generatedTypesFile: './uniwind-types.d.ts', // optional
|
|
53
53
|
});
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
`
|
|
56
|
+
`withForgeMetroConfig` must be the **outermost** wrapper if you compose multiple Metro config helpers.
|
|
57
57
|
|
|
58
58
|
### React Native re-exports
|
|
59
59
|
|
|
@@ -69,7 +69,7 @@ For convenience, the package re-exports several core RN components and hooks wit
|
|
|
69
69
|
|
|
70
70
|
## Figma Code Connect
|
|
71
71
|
|
|
72
|
-
Template files in [`src/figma/`](./src/figma/) map Figma component variants to production
|
|
72
|
+
Template files in [`src/figma/`](./src/figma/) map Figma component variants to production Forge UI snippets shown in Figma Dev Mode. These files are excluded from the npm tarball (`!src/figma` in `files`) and published to Figma via CI on pushes to `main`.
|
|
73
73
|
|
|
74
74
|
See the **[Code Connect authoring guide](../../docs/internal/practices/code-connect.md)** for conventions, property mapping patterns, and local workflow.
|
|
75
75
|
|
|
@@ -41,10 +41,10 @@ const StyledIcon = (0, _uniwind.withUniwind)(IconImpl, {
|
|
|
41
41
|
* <Icon as={ArrowRight} className="text-red-500 size-4" />
|
|
42
42
|
* ```
|
|
43
43
|
*
|
|
44
|
-
* @param {
|
|
44
|
+
* @param {ForgeIcon} as - The Forge icon component to render.
|
|
45
45
|
* @param {string} className - Utility classes to style the icon using Uniwind.
|
|
46
46
|
* @param {number} size - Icon size (overrides the size class).
|
|
47
|
-
* @param {...
|
|
47
|
+
* @param {...ForgeIconProps} ...props - Additional icon props passed to the "as" icon.
|
|
48
48
|
*/
|
|
49
49
|
function Icon({
|
|
50
50
|
as: IconComponent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_primitives","_utils","_Icon","_styles","_jsxRuntime","IconButtonPrimitive","createButton","Root","Pressable","Text","Group","View","Spinner","ActivityIndicator","Icon","IconButtonGlyph","as","IconComponent","className","hover","focus","active","disabled","focusVisible","useButtonContext","jsx","dataAttributes","IconButtonRoot","forwardRef","variant","color","size","style","iconClassName","accessibilityRole","props","ref","rootClassName","cn","iconButtonRootVariants","glyphClassName","iconButtonGlyphVariants","iconButtonIconColorVariants","children","displayName","IconButton","exports"],"sourceRoot":"../../../../src","sources":["components/IconButton/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAOA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAKkB,IAAAM,WAAA,GAAAN,OAAA;AAElB,MAAMO,mBAAmB,GAAG,IAAAC,wBAAY,EAAC;EACvCC,IAAI,EAAEC,sBAAS;EACfC,IAAI,EAAJA,iBAAI;EACJC,KAAK,EAAEC,iBAAI;EACXC,OAAO,EAAEC,8BAAiB;EAC1BC,IAAI,EAAEH;AACR,CAAC,CAAC;AAEF,SAASI,eAAeA,CAAC;EAAEC,EAAE,EAAEC,aAAa;EAAEC;
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_primitives","_utils","_Icon","_styles","_jsxRuntime","IconButtonPrimitive","createButton","Root","Pressable","Text","Group","View","Spinner","ActivityIndicator","Icon","IconButtonGlyph","as","IconComponent","className","hover","focus","active","disabled","focusVisible","useButtonContext","jsx","dataAttributes","IconButtonRoot","forwardRef","variant","color","size","style","iconClassName","accessibilityRole","props","ref","rootClassName","cn","iconButtonRootVariants","glyphClassName","iconButtonGlyphVariants","iconButtonIconColorVariants","children","displayName","IconButton","exports"],"sourceRoot":"../../../../src","sources":["components/IconButton/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAOA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAKkB,IAAAM,WAAA,GAAAN,OAAA;AAElB,MAAMO,mBAAmB,GAAG,IAAAC,wBAAY,EAAC;EACvCC,IAAI,EAAEC,sBAAS;EACfC,IAAI,EAAJA,iBAAI;EACJC,KAAK,EAAEC,iBAAI;EACXC,OAAO,EAAEC,8BAAiB;EAC1BC,IAAI,EAAEH;AACR,CAAC,CAAC;AAEF,SAASI,eAAeA,CAAC;EAAEC,EAAE,EAAEC,aAAa;EAAEC;AAAgD,CAAC,EAAE;EAC/F,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,MAAM;IAAEC,QAAQ;IAAEC;EAAa,CAAC,GAAG,IAAAC,4BAAgB,EAAC,CAAC;EAC3E,oBACE,IAAApB,WAAA,CAAAqB,GAAA,EAACvB,KAAA,CAAAY,IAAI;IACHE,EAAE,EAAEC,aAAc;IAClBC,SAAS,EAAEA,SAAU;IAAA,GACjB,IAAAQ,0BAAc,EAAC;MACjBP,KAAK;MACLC,KAAK;MACLC,MAAM;MACNC,QAAQ;MACRC;IACF,CAAC;EAAC,CACH,CAAC;AAEN;AAUA,MAAMI,cAAc,gBAAG,IAAAC,iBAAU,EAC/B,CACE;EACEC,OAAO,GAAG,OAAO;EACjBC,KAAK,GAAG,SAAS;EACjBC,IAAI,GAAG,SAAS;EAChBb,SAAS;EACTc,KAAK;EACLhB,EAAE,EAAEC,aAAa;EACjBgB,aAAa;EACbC,iBAAiB,GAAG,QAAQ;EAC5B,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,aAAa,GAAG,IAAAC,SAAE,EAAC,IAAAC,8BAAsB,EAAC;IAAEV,OAAO;IAAEC,KAAK;IAAEC;EAAK,CAAC,CAAC,EAAEb,SAAS,CAAC;EAErF,MAAMsB,cAAc,GAAG,IAAAF,SAAE,EACvB,IAAAG,+BAAuB,EAAC;IAAEV;EAAK,CAAC,CAAC,EACjC,IAAAW,mCAA2B,EAAC;IAAEb,OAAO;IAAEC;EAAM,CAAC,CAAC,EAC/CG,aACF,CAAC;EAED,oBACE,IAAA7B,WAAA,CAAAqB,GAAA,EAACpB,mBAAmB;IAClB+B,GAAG,EAAEA,GAAI;IACTF,iBAAiB,EAAEA,iBAAkB;IACrChB,SAAS,EAAEmB,aAAc;IACzBL,KAAK,EAAEA,KAAM;IAAA,GACTG,KAAK;IAAAQ,QAAA,eAET,IAAAvC,WAAA,CAAAqB,GAAA,EAACV,eAAe;MAACC,EAAE,EAAEC,aAAc;MAACC,SAAS,EAAEsB;IAAe,CAAE;EAAC,CAC9C,CAAC;AAE1B,CACF,CAAC;AAEDb,cAAc,CAACiB,WAAW,GAAG,YAAY;AAElC,MAAMC,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAGlB,cAAc","ignoreList":[]}
|
|
@@ -31,7 +31,7 @@ const type = instance.getEnum('type', {
|
|
|
31
31
|
icon: 'icon'
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
// icon: INSTANCE_SWAP → Avatar.Icon `as` prop (
|
|
34
|
+
// icon: INSTANCE_SWAP → Avatar.Icon `as` prop (ForgeIcon identifier).
|
|
35
35
|
// Prefer metadata.props.componentName exposed by icon Code Connect templates.
|
|
36
36
|
// Falls back to executeTemplate().example (placeholder pill) when the icon lacks Code Connect.
|
|
37
37
|
const iconResult = instance.getInstanceSwap('icon')?.executeTemplate();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Auto-loaded when working in `packages/components/src/figma/**` (`*.figma.ts`, `*.figma.batch.ts`, `*.figma.batch.json`).
|
|
4
4
|
|
|
5
|
-
Template files connect
|
|
5
|
+
Template files connect Forge UI components to Figma Dev Mode snippets. Read the full guide before making changes:
|
|
6
6
|
|
|
7
7
|
- `docs/internal/practices/code-connect.md` — complete workflow, mapping patterns, publishing, troubleshooting
|
|
8
8
|
|
|
@@ -33,7 +33,7 @@ const isDisabled = instance.getEnum('isDisabled', {
|
|
|
33
33
|
});
|
|
34
34
|
const isDisabledProp = _figma.default.helpers.react.renderProp('isDisabled', isDisabled);
|
|
35
35
|
|
|
36
|
-
// icon: INSTANCE_SWAP → IconButton `as` (
|
|
36
|
+
// icon: INSTANCE_SWAP → IconButton `as` (ForgeIcon). Prefer metadata.props.componentName from icon Code Connect.
|
|
37
37
|
const iconResult = instance.getInstanceSwap('icon')?.executeTemplate();
|
|
38
38
|
const iconName = iconResult?.metadata?.props?.componentName;
|
|
39
39
|
const iconSnippet = iconName ?? iconResult?.example;
|
|
@@ -3,22 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* of this function change — consuming Metro configs stay the same.
|
|
14
|
-
*
|
|
15
|
-
* Must be the **outermost** Metro config wrapper (after any other wrappers
|
|
16
|
-
* like `withStorybook`).
|
|
17
|
-
*/
|
|
18
|
-
function withCdxMetroConfig(config, options) {
|
|
19
|
-
return (0, _metro.withUniwindConfig)(config, {
|
|
20
|
-
cssEntryFile: options.cssEntryFile,
|
|
21
|
-
dtsFile: options.generatedTypesFile
|
|
22
|
-
});
|
|
23
|
-
}
|
|
6
|
+
Object.defineProperty(exports, "withCdxMetroConfig", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _withForgeMetroConfig.withForgeMetroConfig;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _withForgeMetroConfig = require("./withForgeMetroConfig");
|
|
24
13
|
//# sourceMappingURL=withCdxMetroConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_withForgeMetroConfig","require"],"sourceRoot":"../../../src","sources":["metro/withCdxMetroConfig.ts"],"mappings":";;;;;;;;;;;AACA,IAAAA,qBAAA,GAAAC,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.withForgeMetroConfig = withForgeMetroConfig;
|
|
7
|
+
var _metro = require("uniwind/metro");
|
|
8
|
+
/**
|
|
9
|
+
* Wraps a Metro config with Forge UI's styling-layer configuration.
|
|
10
|
+
*
|
|
11
|
+
* Today this delegates to Uniwind. If the styling layer is swapped (see
|
|
12
|
+
* `docs/research/uniwind-to-nativewind-contingency.md`), only the internals
|
|
13
|
+
* of this function change — consuming Metro configs stay the same.
|
|
14
|
+
*
|
|
15
|
+
* Must be the **outermost** Metro config wrapper (after any other wrappers
|
|
16
|
+
* like `withStorybook`).
|
|
17
|
+
*/
|
|
18
|
+
function withForgeMetroConfig(config, options) {
|
|
19
|
+
return (0, _metro.withUniwindConfig)(config, {
|
|
20
|
+
cssEntryFile: options.cssEntryFile,
|
|
21
|
+
dtsFile: options.generatedTypesFile
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=withForgeMetroConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_metro","require","withForgeMetroConfig","config","options","withUniwindConfig","cssEntryFile","dtsFile","generatedTypesFile"],"sourceRoot":"../../../src","sources":["metro/withForgeMetroConfig.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,oBAAoBA,CAClCC,MAAS,EACTC,OAAgC,EAC7B;EACH,OAAO,IAAAC,wBAAiB,EAACF,MAAM,EAAE;IAC/BG,YAAY,EAAEF,OAAO,CAACE,YAAY;IAClCC,OAAO,EAAEH,OAAO,CAACI;EACnB,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.TRANSITION_COLORS = exports.SIZE_SCALE = exports.SHADOW_SM = exports.SHADOW_MD = exports.SEMANTIC_COLORS = exports.RADIUS_SM = exports.RADIUS_MD = exports.RADIUS_FULL = exports.FOCUS_RING = exports.DISABLED_OPACITY = exports.DISABLED_CURSOR = exports.COLOR_TEXT_SECONDARY = exports.COLOR_TEXT_PRIMARY = exports.COLOR_TEXT_PLACEHOLDER = exports.COLOR_TEXT_MUTED = exports.COLOR_TEXT_INVERSE = exports.COLOR_TEXT_INVALID = exports.COLOR_BRAND_HOVER = exports.COLOR_BRAND_DEFAULT = exports.COLOR_BRAND_ACTIVE = exports.COLOR_BORDER_STRONG = exports.COLOR_BORDER_INVALID = exports.COLOR_BORDER_FOCUS = exports.COLOR_BORDER_DEFAULT = exports.COLOR_BG_SUBTLE = exports.COLOR_BG_PRIMARY = exports.COLOR_BG_MUTED = exports.COLOR_BG_INVERSE = exports.COLOR_ACCENT_DEFAULT = exports.COLOR_ACCENT_BORDER = void 0;
|
|
7
7
|
// packages/components/src/styles/primitives.ts
|
|
8
|
-
// Semantic constants for
|
|
8
|
+
// Semantic constants for Forge UI component styling.
|
|
9
9
|
|
|
10
10
|
// ─── Colors ──────────────────────────────────────────────
|
|
11
11
|
// Surface & background
|
|
@@ -37,10 +37,10 @@ const StyledIcon = withUniwind(IconImpl, {
|
|
|
37
37
|
* <Icon as={ArrowRight} className="text-red-500 size-4" />
|
|
38
38
|
* ```
|
|
39
39
|
*
|
|
40
|
-
* @param {
|
|
40
|
+
* @param {ForgeIcon} as - The Forge icon component to render.
|
|
41
41
|
* @param {string} className - Utility classes to style the icon using Uniwind.
|
|
42
42
|
* @param {number} size - Icon size (overrides the size class).
|
|
43
|
-
* @param {...
|
|
43
|
+
* @param {...ForgeIconProps} ...props - Additional icon props passed to the "as" icon.
|
|
44
44
|
*/
|
|
45
45
|
export function Icon({
|
|
46
46
|
as: IconComponent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","ActivityIndicator","Pressable","Text","View","createButton","dataAttributes","useButtonContext","cn","Icon","iconButtonGlyphVariants","iconButtonIconColorVariants","iconButtonRootVariants","jsx","_jsx","IconButtonPrimitive","Root","Group","Spinner","IconButtonGlyph","as","IconComponent","className","hover","focus","active","disabled","focusVisible","IconButtonRoot","variant","color","size","style","iconClassName","accessibilityRole","props","ref","rootClassName","glyphClassName","children","displayName","IconButton"],"sourceRoot":"../../../../src","sources":["components/IconButton/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,iBAAiB,EAAEC,SAAS,EAAEC,IAAI,EAAEC,IAAI,QAA6B,cAAc;AAC5F,SACEC,YAAY,EACZC,cAAc,EAEdC,gBAAgB,QACX,oBAAoB;AAE3B,SAASC,EAAE,QAAQ,eAAe;AAClC,SAASC,IAAI,QAAwB,SAAS;AAC9C,SAEEC,uBAAuB,EACvBC,2BAA2B,EAC3BC,sBAAsB,QACjB,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElB,MAAMC,mBAAmB,GAAGV,YAAY,CAAC;EACvCW,IAAI,EAAEd,SAAS;EACfC,IAAI;EACJc,KAAK,EAAEb,IAAI;EACXc,OAAO,EAAEjB,iBAAiB;EAC1BQ,IAAI,EAAEL;AACR,CAAC,CAAC;AAEF,SAASe,eAAeA,CAAC;EAAEC,EAAE,EAAEC,aAAa;EAAEC;
|
|
1
|
+
{"version":3,"names":["forwardRef","ActivityIndicator","Pressable","Text","View","createButton","dataAttributes","useButtonContext","cn","Icon","iconButtonGlyphVariants","iconButtonIconColorVariants","iconButtonRootVariants","jsx","_jsx","IconButtonPrimitive","Root","Group","Spinner","IconButtonGlyph","as","IconComponent","className","hover","focus","active","disabled","focusVisible","IconButtonRoot","variant","color","size","style","iconClassName","accessibilityRole","props","ref","rootClassName","glyphClassName","children","displayName","IconButton"],"sourceRoot":"../../../../src","sources":["components/IconButton/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,iBAAiB,EAAEC,SAAS,EAAEC,IAAI,EAAEC,IAAI,QAA6B,cAAc;AAC5F,SACEC,YAAY,EACZC,cAAc,EAEdC,gBAAgB,QACX,oBAAoB;AAE3B,SAASC,EAAE,QAAQ,eAAe;AAClC,SAASC,IAAI,QAAwB,SAAS;AAC9C,SAEEC,uBAAuB,EACvBC,2BAA2B,EAC3BC,sBAAsB,QACjB,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElB,MAAMC,mBAAmB,GAAGV,YAAY,CAAC;EACvCW,IAAI,EAAEd,SAAS;EACfC,IAAI;EACJc,KAAK,EAAEb,IAAI;EACXc,OAAO,EAAEjB,iBAAiB;EAC1BQ,IAAI,EAAEL;AACR,CAAC,CAAC;AAEF,SAASe,eAAeA,CAAC;EAAEC,EAAE,EAAEC,aAAa;EAAEC;AAAgD,CAAC,EAAE;EAC/F,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,MAAM;IAAEC,QAAQ;IAAEC;EAAa,CAAC,GAAGpB,gBAAgB,CAAC,CAAC;EAC3E,oBACEO,IAAA,CAACL,IAAI;IACHW,EAAE,EAAEC,aAAc;IAClBC,SAAS,EAAEA,SAAU;IAAA,GACjBhB,cAAc,CAAC;MACjBiB,KAAK;MACLC,KAAK;MACLC,MAAM;MACNC,QAAQ;MACRC;IACF,CAAC;EAAC,CACH,CAAC;AAEN;AAUA,MAAMC,cAAc,gBAAG5B,UAAU,CAC/B,CACE;EACE6B,OAAO,GAAG,OAAO;EACjBC,KAAK,GAAG,SAAS;EACjBC,IAAI,GAAG,SAAS;EAChBT,SAAS;EACTU,KAAK;EACLZ,EAAE,EAAEC,aAAa;EACjBY,aAAa;EACbC,iBAAiB,GAAG,QAAQ;EAC5B,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,aAAa,GAAG7B,EAAE,CAACI,sBAAsB,CAAC;IAAEiB,OAAO;IAAEC,KAAK;IAAEC;EAAK,CAAC,CAAC,EAAET,SAAS,CAAC;EAErF,MAAMgB,cAAc,GAAG9B,EAAE,CACvBE,uBAAuB,CAAC;IAAEqB;EAAK,CAAC,CAAC,EACjCpB,2BAA2B,CAAC;IAAEkB,OAAO;IAAEC;EAAM,CAAC,CAAC,EAC/CG,aACF,CAAC;EAED,oBACEnB,IAAA,CAACC,mBAAmB;IAClBqB,GAAG,EAAEA,GAAI;IACTF,iBAAiB,EAAEA,iBAAkB;IACrCZ,SAAS,EAAEe,aAAc;IACzBL,KAAK,EAAEA,KAAM;IAAA,GACTG,KAAK;IAAAI,QAAA,eAETzB,IAAA,CAACK,eAAe;MAACC,EAAE,EAAEC,aAAc;MAACC,SAAS,EAAEgB;IAAe,CAAE;EAAC,CAC9C,CAAC;AAE1B,CACF,CAAC;AAEDV,cAAc,CAACY,WAAW,GAAG,YAAY;AAEzC,OAAO,MAAMC,UAAU,GAAGb,cAAc","ignoreList":[]}
|
|
@@ -25,7 +25,7 @@ const type = instance.getEnum('type', {
|
|
|
25
25
|
icon: 'icon'
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
// icon: INSTANCE_SWAP → Avatar.Icon `as` prop (
|
|
28
|
+
// icon: INSTANCE_SWAP → Avatar.Icon `as` prop (ForgeIcon identifier).
|
|
29
29
|
// Prefer metadata.props.componentName exposed by icon Code Connect templates.
|
|
30
30
|
// Falls back to executeTemplate().example (placeholder pill) when the icon lacks Code Connect.
|
|
31
31
|
const iconResult = instance.getInstanceSwap('icon')?.executeTemplate();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Auto-loaded when working in `packages/components/src/figma/**` (`*.figma.ts`, `*.figma.batch.ts`, `*.figma.batch.json`).
|
|
4
4
|
|
|
5
|
-
Template files connect
|
|
5
|
+
Template files connect Forge UI components to Figma Dev Mode snippets. Read the full guide before making changes:
|
|
6
6
|
|
|
7
7
|
- `docs/internal/practices/code-connect.md` — complete workflow, mapping patterns, publishing, troubleshooting
|
|
8
8
|
|
|
@@ -27,7 +27,7 @@ const isDisabled = instance.getEnum('isDisabled', {
|
|
|
27
27
|
});
|
|
28
28
|
const isDisabledProp = figma.helpers.react.renderProp('isDisabled', isDisabled);
|
|
29
29
|
|
|
30
|
-
// icon: INSTANCE_SWAP → IconButton `as` (
|
|
30
|
+
// icon: INSTANCE_SWAP → IconButton `as` (ForgeIcon). Prefer metadata.props.componentName from icon Code Connect.
|
|
31
31
|
const iconResult = instance.getInstanceSwap('icon')?.executeTemplate();
|
|
32
32
|
const iconName = iconResult?.metadata?.props?.componentName;
|
|
33
33
|
const iconSnippet = iconName ?? iconResult?.example;
|
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
* Today this delegates to Uniwind. If the styling layer is swapped (see
|
|
8
|
-
* `docs/research/uniwind-to-nativewind-contingency.md`), only the internals
|
|
9
|
-
* of this function change — consuming Metro configs stay the same.
|
|
10
|
-
*
|
|
11
|
-
* Must be the **outermost** Metro config wrapper (after any other wrappers
|
|
12
|
-
* like `withStorybook`).
|
|
13
|
-
*/
|
|
14
|
-
export function withCdxMetroConfig(config, options) {
|
|
15
|
-
return withUniwindConfig(config, {
|
|
16
|
-
cssEntryFile: options.cssEntryFile,
|
|
17
|
-
dtsFile: options.generatedTypesFile
|
|
18
|
-
});
|
|
19
|
-
}
|
|
3
|
+
/** @deprecated Use `withForgeMetroConfig` instead. Will be removed in a future major release. */
|
|
4
|
+
export { withForgeMetroConfig as withCdxMetroConfig } from './withForgeMetroConfig';
|
|
5
|
+
/** @deprecated Use `ForgeMetroConfigOptions` instead. Will be removed in a future major release. */
|
|
20
6
|
//# sourceMappingURL=withCdxMetroConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["withForgeMetroConfig","withCdxMetroConfig"],"sourceRoot":"../../../src","sources":["metro/withCdxMetroConfig.ts"],"mappings":";;AAAA;AACA,SAASA,oBAAoB,IAAIC,kBAAkB,QAAQ,wBAAwB;AACnF","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { withUniwindConfig } from 'uniwind/metro';
|
|
4
|
+
/**
|
|
5
|
+
* Wraps a Metro config with Forge UI's styling-layer configuration.
|
|
6
|
+
*
|
|
7
|
+
* Today this delegates to Uniwind. If the styling layer is swapped (see
|
|
8
|
+
* `docs/research/uniwind-to-nativewind-contingency.md`), only the internals
|
|
9
|
+
* of this function change — consuming Metro configs stay the same.
|
|
10
|
+
*
|
|
11
|
+
* Must be the **outermost** Metro config wrapper (after any other wrappers
|
|
12
|
+
* like `withStorybook`).
|
|
13
|
+
*/
|
|
14
|
+
export function withForgeMetroConfig(config, options) {
|
|
15
|
+
return withUniwindConfig(config, {
|
|
16
|
+
cssEntryFile: options.cssEntryFile,
|
|
17
|
+
dtsFile: options.generatedTypesFile
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=withForgeMetroConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["withUniwindConfig","withForgeMetroConfig","config","options","cssEntryFile","dtsFile","generatedTypesFile"],"sourceRoot":"../../../src","sources":["metro/withForgeMetroConfig.ts"],"mappings":";;AACA,SAASA,iBAAiB,QAAQ,eAAe;AASjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAClCC,MAAS,EACTC,OAAgC,EAC7B;EACH,OAAOH,iBAAiB,CAACE,MAAM,EAAE;IAC/BE,YAAY,EAAED,OAAO,CAACC,YAAY;IAClCC,OAAO,EAAEF,OAAO,CAACG;EACnB,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
// packages/components/src/styles/primitives.ts
|
|
4
|
-
// Semantic constants for
|
|
4
|
+
// Semantic constants for Forge UI component styling.
|
|
5
5
|
|
|
6
6
|
// ─── Colors ──────────────────────────────────────────────
|
|
7
7
|
// Surface & background
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type IconProps =
|
|
1
|
+
import type { ForgeIcon, ForgeIconProps } from '@cdx-ui/icons';
|
|
2
|
+
export type IconProps = ForgeIconProps & {
|
|
3
3
|
className?: string;
|
|
4
|
-
as:
|
|
4
|
+
as: ForgeIcon;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
7
|
* A wrapper component for CDX icons with Uniwind `className` support via `withUniwind`.
|
|
@@ -18,10 +18,10 @@ export type IconProps = CdxIconProps & {
|
|
|
18
18
|
* <Icon as={ArrowRight} className="text-red-500 size-4" />
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
21
|
-
* @param {
|
|
21
|
+
* @param {ForgeIcon} as - The Forge icon component to render.
|
|
22
22
|
* @param {string} className - Utility classes to style the icon using Uniwind.
|
|
23
23
|
* @param {number} size - Icon size (overrides the size class).
|
|
24
|
-
* @param {...
|
|
24
|
+
* @param {...ForgeIconProps} ...props - Additional icon props passed to the "as" icon.
|
|
25
25
|
*/
|
|
26
26
|
export declare function Icon({ as: IconComponent, className, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
|
|
27
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Icon/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Icon/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/D,MAAM,MAAM,SAAS,GAAG,cAAc,GAAG;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,SAAS,CAAC;CACf,CAAC;AAiBF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,IAAI,CAAC,EAAE,EAAE,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,2CAQzE"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { View, type PressableProps } from 'react-native';
|
|
2
2
|
import { type IButtonProps } from '@cdx-ui/primitives';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ForgeIcon } from '@cdx-ui/icons';
|
|
4
4
|
import { type IconProps } from '../Icon';
|
|
5
5
|
import { type IconButtonVariantProps } from './styles';
|
|
6
6
|
export interface IconButtonProps extends PressableProps, IButtonProps, IconButtonVariantProps {
|
|
7
7
|
className?: string;
|
|
8
|
-
/**
|
|
9
|
-
as:
|
|
8
|
+
/** Forge icon component to render (icon-only control). */
|
|
9
|
+
as: ForgeIcon;
|
|
10
10
|
/** Passed through to the underlying `Icon`. */
|
|
11
11
|
iconClassName?: IconProps['className'];
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/IconButton/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsC,IAAI,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EAGL,KAAK,YAAY,EAElB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/IconButton/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsC,IAAI,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EAGL,KAAK,YAAY,EAElB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EACL,KAAK,sBAAsB,EAI5B,MAAM,UAAU,CAAC;AA2BlB,MAAM,WAAW,eAAgB,SAAQ,cAAc,EAAE,YAAY,EAAE,sBAAsB;IAC3F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,EAAE,EAAE,SAAS,CAAC;IACd,+CAA+C;IAC/C,aAAa,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;CACxC;AAyCD,eAAO,MAAM,UAAU,kGAAiB,CAAC;AAEzC,YAAY,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/** Path where generated Tailwind class type definitions are written. */
|
|
6
|
-
generatedTypesFile?: string;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Wraps a Metro config with CDX UI's styling-layer configuration.
|
|
10
|
-
*
|
|
11
|
-
* Today this delegates to Uniwind. If the styling layer is swapped (see
|
|
12
|
-
* `docs/research/uniwind-to-nativewind-contingency.md`), only the internals
|
|
13
|
-
* of this function change — consuming Metro configs stay the same.
|
|
14
|
-
*
|
|
15
|
-
* Must be the **outermost** Metro config wrapper (after any other wrappers
|
|
16
|
-
* like `withStorybook`).
|
|
17
|
-
*/
|
|
18
|
-
export declare function withCdxMetroConfig<T extends MetroConfig>(config: T, options: CdxMetroConfigOptions): T;
|
|
1
|
+
/** @deprecated Use `withForgeMetroConfig` instead. Will be removed in a future major release. */
|
|
2
|
+
export { withForgeMetroConfig as withCdxMetroConfig } from './withForgeMetroConfig';
|
|
3
|
+
/** @deprecated Use `ForgeMetroConfigOptions` instead. Will be removed in a future major release. */
|
|
4
|
+
export type { ForgeMetroConfigOptions as CdxMetroConfigOptions } from './withForgeMetroConfig';
|
|
19
5
|
//# sourceMappingURL=withCdxMetroConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withCdxMetroConfig.d.ts","sourceRoot":"","sources":["../../../src/metro/withCdxMetroConfig.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"withCdxMetroConfig.d.ts","sourceRoot":"","sources":["../../../src/metro/withCdxMetroConfig.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,OAAO,EAAE,oBAAoB,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACpF,oGAAoG;AACpG,YAAY,EAAE,uBAAuB,IAAI,qBAAqB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { MetroConfig } from 'metro-config';
|
|
2
|
+
export interface ForgeMetroConfigOptions {
|
|
3
|
+
/** Path to the CSS entry file (e.g., `'./global.css'`). */
|
|
4
|
+
cssEntryFile: string;
|
|
5
|
+
/** Path where generated Tailwind class type definitions are written. */
|
|
6
|
+
generatedTypesFile?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Wraps a Metro config with Forge UI's styling-layer configuration.
|
|
10
|
+
*
|
|
11
|
+
* Today this delegates to Uniwind. If the styling layer is swapped (see
|
|
12
|
+
* `docs/research/uniwind-to-nativewind-contingency.md`), only the internals
|
|
13
|
+
* of this function change — consuming Metro configs stay the same.
|
|
14
|
+
*
|
|
15
|
+
* Must be the **outermost** Metro config wrapper (after any other wrappers
|
|
16
|
+
* like `withStorybook`).
|
|
17
|
+
*/
|
|
18
|
+
export declare function withForgeMetroConfig<T extends MetroConfig>(config: T, options: ForgeMetroConfigOptions): T;
|
|
19
|
+
//# sourceMappingURL=withForgeMetroConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withForgeMetroConfig.d.ts","sourceRoot":"","sources":["../../../src/metro/withForgeMetroConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,uBAAuB;IACtC,2DAA2D;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,WAAW,EACxD,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,uBAAuB,GAC/B,CAAC,CAKH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdx-ui/components",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.42",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"module": "lib/module/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
},
|
|
17
17
|
"./styles.css": "./src/styles.css",
|
|
18
18
|
"./metro": {
|
|
19
|
-
"types": "./lib/typescript/metro/
|
|
20
|
-
"require": "./lib/commonjs/metro/
|
|
21
|
-
"import": "./lib/module/metro/
|
|
22
|
-
"default": "./lib/commonjs/metro/
|
|
19
|
+
"types": "./lib/typescript/metro/withForgeMetroConfig.d.ts",
|
|
20
|
+
"require": "./lib/commonjs/metro/withForgeMetroConfig.js",
|
|
21
|
+
"import": "./lib/module/metro/withForgeMetroConfig.js",
|
|
22
|
+
"default": "./lib/commonjs/metro/withForgeMetroConfig.js"
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"@gorhom/bottom-sheet": "^5.2.6",
|
|
68
68
|
"class-variance-authority": "^0.7.1",
|
|
69
69
|
"uniwind": "1.6.1",
|
|
70
|
-
"@cdx-ui/
|
|
71
|
-
"@cdx-ui/utils": "0.0.1-beta.
|
|
72
|
-
"@cdx-ui/
|
|
70
|
+
"@cdx-ui/icons": "0.0.1-beta.42",
|
|
71
|
+
"@cdx-ui/utils": "0.0.1-beta.42",
|
|
72
|
+
"@cdx-ui/primitives": "0.0.1-beta.42"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@types/react": "*",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { withUniwind } from 'uniwind';
|
|
2
2
|
import { cn } from '@cdx-ui/utils';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ForgeIcon, ForgeIconProps } from '@cdx-ui/icons';
|
|
4
4
|
|
|
5
|
-
export type IconProps =
|
|
5
|
+
export type IconProps = ForgeIconProps & {
|
|
6
6
|
className?: string; // TODO: Why does this need to specified manually?
|
|
7
|
-
as:
|
|
7
|
+
as: ForgeIcon;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
function IconImpl({ as: IconComponent, ...props }: IconProps) {
|
|
@@ -37,10 +37,10 @@ const StyledIcon = withUniwind(IconImpl, {
|
|
|
37
37
|
* <Icon as={ArrowRight} className="text-red-500 size-4" />
|
|
38
38
|
* ```
|
|
39
39
|
*
|
|
40
|
-
* @param {
|
|
40
|
+
* @param {ForgeIcon} as - The Forge icon component to render.
|
|
41
41
|
* @param {string} className - Utility classes to style the icon using Uniwind.
|
|
42
42
|
* @param {number} size - Icon size (overrides the size class).
|
|
43
|
-
* @param {...
|
|
43
|
+
* @param {...ForgeIconProps} ...props - Additional icon props passed to the "as" icon.
|
|
44
44
|
*/
|
|
45
45
|
export function Icon({ as: IconComponent, className, ...props }: IconProps) {
|
|
46
46
|
return (
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type IButtonProps,
|
|
7
7
|
useButtonContext,
|
|
8
8
|
} from '@cdx-ui/primitives';
|
|
9
|
-
import type {
|
|
9
|
+
import type { ForgeIcon } from '@cdx-ui/icons';
|
|
10
10
|
import { cn } from '@cdx-ui/utils';
|
|
11
11
|
import { Icon, type IconProps } from '../Icon';
|
|
12
12
|
import {
|
|
@@ -24,7 +24,7 @@ const IconButtonPrimitive = createButton({
|
|
|
24
24
|
Icon: View,
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
function IconButtonGlyph({ as: IconComponent, className }: { as:
|
|
27
|
+
function IconButtonGlyph({ as: IconComponent, className }: { as: ForgeIcon; className: string }) {
|
|
28
28
|
const { hover, focus, active, disabled, focusVisible } = useButtonContext();
|
|
29
29
|
return (
|
|
30
30
|
<Icon
|
|
@@ -43,8 +43,8 @@ function IconButtonGlyph({ as: IconComponent, className }: { as: CdxIcon; classN
|
|
|
43
43
|
|
|
44
44
|
export interface IconButtonProps extends PressableProps, IButtonProps, IconButtonVariantProps {
|
|
45
45
|
className?: string;
|
|
46
|
-
/**
|
|
47
|
-
as:
|
|
46
|
+
/** Forge icon component to render (icon-only control). */
|
|
47
|
+
as: ForgeIcon;
|
|
48
48
|
/** Passed through to the underlying `Icon`. */
|
|
49
49
|
iconClassName?: IconProps['className'];
|
|
50
50
|
}
|
|
@@ -1,29 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
/** Path to the CSS entry file (e.g., `'./global.css'`). */
|
|
6
|
-
cssEntryFile: string;
|
|
7
|
-
/** Path where generated Tailwind class type definitions are written. */
|
|
8
|
-
generatedTypesFile?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Wraps a Metro config with CDX UI's styling-layer configuration.
|
|
13
|
-
*
|
|
14
|
-
* Today this delegates to Uniwind. If the styling layer is swapped (see
|
|
15
|
-
* `docs/research/uniwind-to-nativewind-contingency.md`), only the internals
|
|
16
|
-
* of this function change — consuming Metro configs stay the same.
|
|
17
|
-
*
|
|
18
|
-
* Must be the **outermost** Metro config wrapper (after any other wrappers
|
|
19
|
-
* like `withStorybook`).
|
|
20
|
-
*/
|
|
21
|
-
export function withCdxMetroConfig<T extends MetroConfig>(
|
|
22
|
-
config: T,
|
|
23
|
-
options: CdxMetroConfigOptions,
|
|
24
|
-
): T {
|
|
25
|
-
return withUniwindConfig(config, {
|
|
26
|
-
cssEntryFile: options.cssEntryFile,
|
|
27
|
-
dtsFile: options.generatedTypesFile,
|
|
28
|
-
}) as T;
|
|
29
|
-
}
|
|
1
|
+
/** @deprecated Use `withForgeMetroConfig` instead. Will be removed in a future major release. */
|
|
2
|
+
export { withForgeMetroConfig as withCdxMetroConfig } from './withForgeMetroConfig';
|
|
3
|
+
/** @deprecated Use `ForgeMetroConfigOptions` instead. Will be removed in a future major release. */
|
|
4
|
+
export type { ForgeMetroConfigOptions as CdxMetroConfigOptions } from './withForgeMetroConfig';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { MetroConfig } from 'metro-config';
|
|
2
|
+
import { withUniwindConfig } from 'uniwind/metro';
|
|
3
|
+
|
|
4
|
+
export interface ForgeMetroConfigOptions {
|
|
5
|
+
/** Path to the CSS entry file (e.g., `'./global.css'`). */
|
|
6
|
+
cssEntryFile: string;
|
|
7
|
+
/** Path where generated Tailwind class type definitions are written. */
|
|
8
|
+
generatedTypesFile?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Metro config with Forge UI's styling-layer configuration.
|
|
13
|
+
*
|
|
14
|
+
* Today this delegates to Uniwind. If the styling layer is swapped (see
|
|
15
|
+
* `docs/research/uniwind-to-nativewind-contingency.md`), only the internals
|
|
16
|
+
* of this function change — consuming Metro configs stay the same.
|
|
17
|
+
*
|
|
18
|
+
* Must be the **outermost** Metro config wrapper (after any other wrappers
|
|
19
|
+
* like `withStorybook`).
|
|
20
|
+
*/
|
|
21
|
+
export function withForgeMetroConfig<T extends MetroConfig>(
|
|
22
|
+
config: T,
|
|
23
|
+
options: ForgeMetroConfigOptions,
|
|
24
|
+
): T {
|
|
25
|
+
return withUniwindConfig(config, {
|
|
26
|
+
cssEntryFile: options.cssEntryFile,
|
|
27
|
+
dtsFile: options.generatedTypesFile,
|
|
28
|
+
}) as T;
|
|
29
|
+
}
|
package/src/styles/primitives.ts
CHANGED