@metamask/design-system-twrnc-preset 0.1.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 +22 -0
- package/LICENSE +20 -0
- package/README.md +31 -0
- package/dist/Theme.types.cjs +12 -0
- package/dist/Theme.types.cjs.map +1 -0
- package/dist/Theme.types.d.cts +8 -0
- package/dist/Theme.types.d.cts.map +1 -0
- package/dist/Theme.types.d.mts +8 -0
- package/dist/Theme.types.d.mts.map +1 -0
- package/dist/Theme.types.mjs +9 -0
- package/dist/Theme.types.mjs.map +1 -0
- package/dist/ThemeContext.cjs +13 -0
- package/dist/ThemeContext.cjs.map +1 -0
- package/dist/ThemeContext.d.cts +15 -0
- package/dist/ThemeContext.d.cts.map +1 -0
- package/dist/ThemeContext.d.mts +15 -0
- package/dist/ThemeContext.d.mts.map +1 -0
- package/dist/ThemeContext.mjs +10 -0
- package/dist/ThemeContext.mjs.map +1 -0
- package/dist/ThemeProvider.cjs +53 -0
- package/dist/ThemeProvider.cjs.map +1 -0
- package/dist/ThemeProvider.d.cts +15 -0
- package/dist/ThemeProvider.d.cts.map +1 -0
- package/dist/ThemeProvider.d.mts +15 -0
- package/dist/ThemeProvider.d.mts.map +1 -0
- package/dist/ThemeProvider.mjs +33 -0
- package/dist/ThemeProvider.mjs.map +1 -0
- package/dist/colors.cjs +67 -0
- package/dist/colors.cjs.map +1 -0
- package/dist/colors.d.cts +3 -0
- package/dist/colors.d.cts.map +1 -0
- package/dist/colors.d.mts +3 -0
- package/dist/colors.d.mts.map +1 -0
- package/dist/colors.mjs +64 -0
- package/dist/colors.mjs.map +1 -0
- package/dist/hooks.cjs +47 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.cts +35 -0
- package/dist/hooks.d.cts.map +1 -0
- package/dist/hooks.d.mts +35 -0
- package/dist/hooks.d.mts.map +1 -0
- package/dist/hooks.mjs +42 -0
- package/dist/hooks.mjs.map +1 -0
- package/dist/index.cjs +13 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -0
- package/dist/tailwind.config.cjs +97 -0
- package/dist/tailwind.config.cjs.map +1 -0
- package/dist/tailwind.config.d.cts +12 -0
- package/dist/tailwind.config.d.cts.map +1 -0
- package/dist/tailwind.config.d.mts +12 -0
- package/dist/tailwind.config.d.mts.map +1 -0
- package/dist/tailwind.config.mjs +93 -0
- package/dist/tailwind.config.mjs.map +1 -0
- package/dist/typography.cjs +115 -0
- package/dist/typography.cjs.map +1 -0
- package/dist/typography.d.cts +3 -0
- package/dist/typography.d.cts.map +1 -0
- package/dist/typography.d.mts +3 -0
- package/dist/typography.d.mts.map +1 -0
- package/dist/typography.mjs +112 -0
- package/dist/typography.mjs.map +1 -0
- package/dist/typography.types.cjs +3 -0
- package/dist/typography.types.cjs.map +1 -0
- package/dist/typography.types.d.cts +70 -0
- package/dist/typography.types.d.cts.map +1 -0
- package/dist/typography.types.d.mts +70 -0
- package/dist/typography.types.d.mts.map +1 -0
- package/dist/typography.types.mjs +2 -0
- package/dist/typography.types.mjs.map +1 -0
- package/package.json +83 -0
package/dist/hooks.d.mts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Theme } from "./Theme.types.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Hook that provides access to the current theme.
|
|
4
|
+
* Use this when you need to conditionally render content based on theme.
|
|
5
|
+
*
|
|
6
|
+
* @returns The current theme ('light' or 'dark')
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const theme = useTheme();
|
|
10
|
+
* const inverseTheme = theme === Theme.Light ? Theme.Dark : Theme.Light;
|
|
11
|
+
* return (
|
|
12
|
+
* <ThemeProvider theme={inverseTheme}>
|
|
13
|
+
* <View style={tw`bg-default`}>
|
|
14
|
+
* <Text style={tw`text-default`}>Toast message</Text>
|
|
15
|
+
* </View>
|
|
16
|
+
* </ThemeProvider>
|
|
17
|
+
* );
|
|
18
|
+
*/
|
|
19
|
+
export declare const useTheme: () => Theme;
|
|
20
|
+
/**
|
|
21
|
+
* Hook that provides access to the tailwind utility function.
|
|
22
|
+
* Use this when you only need styling capabilities.
|
|
23
|
+
*
|
|
24
|
+
* @returns Tailwind utility function for styling
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* const tw = useTailwind();
|
|
28
|
+
* return (
|
|
29
|
+
* <View style={tw`p-4 bg-primary`}>
|
|
30
|
+
* <Text>Styled content</Text>
|
|
31
|
+
* </View>
|
|
32
|
+
* );
|
|
33
|
+
*/
|
|
34
|
+
export declare const useTailwind: () => import("twrnc").TailwindFn;
|
|
35
|
+
//# sourceMappingURL=hooks.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.mts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,0BAAsB;AAG3C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,QAAQ,QAAO,KAG3B,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,kCAGvB,CAAC"}
|
package/dist/hooks.mjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { ThemeContext } from "./ThemeContext.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Hook that provides access to the current theme.
|
|
5
|
+
* Use this when you need to conditionally render content based on theme.
|
|
6
|
+
*
|
|
7
|
+
* @returns The current theme ('light' or 'dark')
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const theme = useTheme();
|
|
11
|
+
* const inverseTheme = theme === Theme.Light ? Theme.Dark : Theme.Light;
|
|
12
|
+
* return (
|
|
13
|
+
* <ThemeProvider theme={inverseTheme}>
|
|
14
|
+
* <View style={tw`bg-default`}>
|
|
15
|
+
* <Text style={tw`text-default`}>Toast message</Text>
|
|
16
|
+
* </View>
|
|
17
|
+
* </ThemeProvider>
|
|
18
|
+
* );
|
|
19
|
+
*/
|
|
20
|
+
export const useTheme = () => {
|
|
21
|
+
const { theme } = useContext(ThemeContext);
|
|
22
|
+
return theme;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Hook that provides access to the tailwind utility function.
|
|
26
|
+
* Use this when you only need styling capabilities.
|
|
27
|
+
*
|
|
28
|
+
* @returns Tailwind utility function for styling
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* const tw = useTailwind();
|
|
32
|
+
* return (
|
|
33
|
+
* <View style={tw`p-4 bg-primary`}>
|
|
34
|
+
* <Text>Styled content</Text>
|
|
35
|
+
* </View>
|
|
36
|
+
* );
|
|
37
|
+
*/
|
|
38
|
+
export const useTailwind = () => {
|
|
39
|
+
const { tw } = useContext(ThemeContext);
|
|
40
|
+
return tw;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=hooks.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.mjs","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc;AAGnC,OAAO,EAAE,YAAY,EAAE,2BAAuB;AAE9C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAU,EAAE;IAClC,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAC3C,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,MAAM,EAAE,EAAE,EAAE,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACxC,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC","sourcesContent":["import { useContext } from 'react';\n\nimport type { Theme } from './Theme.types';\nimport { ThemeContext } from './ThemeContext';\n\n/**\n * Hook that provides access to the current theme.\n * Use this when you need to conditionally render content based on theme.\n *\n * @returns The current theme ('light' or 'dark')\n *\n * @example\n * const theme = useTheme();\n * const inverseTheme = theme === Theme.Light ? Theme.Dark : Theme.Light;\n * return (\n * <ThemeProvider theme={inverseTheme}>\n * <View style={tw`bg-default`}>\n * <Text style={tw`text-default`}>Toast message</Text>\n * </View>\n * </ThemeProvider>\n * );\n */\nexport const useTheme = (): Theme => {\n const { theme } = useContext(ThemeContext);\n return theme;\n};\n\n/**\n * Hook that provides access to the tailwind utility function.\n * Use this when you only need styling capabilities.\n *\n * @returns Tailwind utility function for styling\n *\n * @example\n * const tw = useTailwind();\n * return (\n * <View style={tw`p-4 bg-primary`}>\n * <Text>Styled content</Text>\n * </View>\n * );\n */\nexport const useTailwind = () => {\n const { tw } = useContext(ThemeContext);\n return tw;\n};\n"]}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTheme = exports.useTailwind = exports.Theme = exports.ThemeProvider = void 0;
|
|
4
|
+
// Provider and type
|
|
5
|
+
var ThemeProvider_1 = require("./ThemeProvider.cjs");
|
|
6
|
+
Object.defineProperty(exports, "ThemeProvider", { enumerable: true, get: function () { return ThemeProvider_1.ThemeProvider; } });
|
|
7
|
+
var Theme_types_1 = require("./Theme.types.cjs");
|
|
8
|
+
Object.defineProperty(exports, "Theme", { enumerable: true, get: function () { return Theme_types_1.Theme; } });
|
|
9
|
+
// Hooks
|
|
10
|
+
var hooks_1 = require("./hooks.cjs");
|
|
11
|
+
Object.defineProperty(exports, "useTailwind", { enumerable: true, get: function () { return hooks_1.useTailwind; } });
|
|
12
|
+
Object.defineProperty(exports, "useTheme", { enumerable: true, get: function () { return hooks_1.useTheme; } });
|
|
13
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,oBAAoB;AACpB,qDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,iDAAsC;AAA7B,oGAAA,KAAK,OAAA;AAEd,QAAQ;AACR,qCAAgD;AAAvC,oGAAA,WAAW,OAAA;AAAE,iGAAA,QAAQ,OAAA","sourcesContent":["// Provider and type\nexport { ThemeProvider } from './ThemeProvider';\nexport { Theme } from './Theme.types';\n\n// Hooks\nexport { useTailwind, useTheme } from './hooks';\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAChD,OAAO,EAAE,KAAK,EAAE,0BAAsB;AAGtC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,oBAAgB"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAChD,OAAO,EAAE,KAAK,EAAE,0BAAsB;AAGtC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,oBAAgB"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAChD,OAAO,EAAE,KAAK,EAAE,0BAAsB;AAEtC,QAAQ;AACR,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,oBAAgB","sourcesContent":["// Provider and type\nexport { ThemeProvider } from './ThemeProvider';\nexport { Theme } from './Theme.types';\n\n// Hooks\nexport { useTailwind, useTheme } from './hooks';\n"]}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateTailwindConfig = void 0;
|
|
4
|
+
const colors_1 = require("./colors.cjs");
|
|
5
|
+
const typography_1 = require("./typography.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* Extracts colors by prefix from the flattened colors object and removes the prefix from keys.
|
|
8
|
+
* This creates structured color objects that enable shorter Tailwind class names by removing
|
|
9
|
+
* redundant prefixes (e.g., "background-default" becomes "default" for backgroundColor).
|
|
10
|
+
*
|
|
11
|
+
* @param colors - The flattened colors object containing all theme colors with kebab-case keys.
|
|
12
|
+
* @param prefix - The prefix to extract colors for (e.g., 'background', 'text', 'border').
|
|
13
|
+
* @returns A new object containing only colors matching the prefix, with the prefix removed from keys.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const colors = { 'background-default': '#fff', 'background-muted': '#eee', 'text-default': '#000' };
|
|
17
|
+
* extractColorsByPrefix(colors, 'background');
|
|
18
|
+
* // Returns: { 'default': '#fff', 'muted': '#eee' }
|
|
19
|
+
*/
|
|
20
|
+
const extractColorsByPrefix = (colors, prefix) => {
|
|
21
|
+
const extracted = {};
|
|
22
|
+
const prefixWithDash = `${prefix}-`;
|
|
23
|
+
Object.entries(colors).forEach(([key, value]) => {
|
|
24
|
+
if (key.startsWith(prefixWithDash)) {
|
|
25
|
+
const colorName = key.replace(prefixWithDash, '');
|
|
26
|
+
extracted[colorName] = value;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return extracted;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Generates a Tailwind CSS configuration object based on the specified theme.
|
|
33
|
+
* This configuration extends the base Tailwind settings with custom theme colors, typography settings,
|
|
34
|
+
* and other style properties for use in React Native with `twrnc`.
|
|
35
|
+
*
|
|
36
|
+
* @param theme - The theme ('light' or 'dark'). Specifies whether to use light or dark mode styles.
|
|
37
|
+
* @returns A Tailwind CSS configuration object with extended theme properties and plugins.
|
|
38
|
+
*/
|
|
39
|
+
const generateTailwindConfig = (theme) => {
|
|
40
|
+
const colors = colors_1.themeColors[theme];
|
|
41
|
+
if (!colors) {
|
|
42
|
+
console.error('Theme colors not found.');
|
|
43
|
+
return {};
|
|
44
|
+
}
|
|
45
|
+
// Extract structured colors from the flattened colors
|
|
46
|
+
const backgroundColors = extractColorsByPrefix(colors, 'background');
|
|
47
|
+
const textColors = extractColorsByPrefix(colors, 'text');
|
|
48
|
+
const borderColors = extractColorsByPrefix(colors, 'border');
|
|
49
|
+
const config = {
|
|
50
|
+
theme: {
|
|
51
|
+
// Keep essential semantic colors, remove default palette colors to enforce use of design system components
|
|
52
|
+
colors: {
|
|
53
|
+
inherit: 'inherit',
|
|
54
|
+
current: 'currentColor',
|
|
55
|
+
transparent: 'transparent',
|
|
56
|
+
black: '#000000',
|
|
57
|
+
white: '#ffffff',
|
|
58
|
+
},
|
|
59
|
+
fontSize: {
|
|
60
|
+
// Empty to remove default Tailwind font sizes (text-sm, text-lg, etc.)
|
|
61
|
+
// Design system font sizes added via extend
|
|
62
|
+
},
|
|
63
|
+
extend: {
|
|
64
|
+
colors: {
|
|
65
|
+
...colors,
|
|
66
|
+
},
|
|
67
|
+
textColor: {
|
|
68
|
+
...colors,
|
|
69
|
+
...textColors, // e.g. text-default instead of text-text-default
|
|
70
|
+
},
|
|
71
|
+
backgroundColor: {
|
|
72
|
+
...colors,
|
|
73
|
+
...backgroundColors, // e.g. bg-default instead of bg-background-default
|
|
74
|
+
},
|
|
75
|
+
borderColor: {
|
|
76
|
+
...colors,
|
|
77
|
+
...borderColors, // e.g. border-default instead of border-border-default
|
|
78
|
+
},
|
|
79
|
+
fontSize: {
|
|
80
|
+
...typography_1.typographyTailwindConfig.fontSize,
|
|
81
|
+
},
|
|
82
|
+
fontFamily: {
|
|
83
|
+
...typography_1.typographyTailwindConfig.fontFamily,
|
|
84
|
+
},
|
|
85
|
+
letterSpacing: {
|
|
86
|
+
...typography_1.typographyTailwindConfig.letterSpacing,
|
|
87
|
+
},
|
|
88
|
+
lineHeight: {
|
|
89
|
+
...typography_1.typographyTailwindConfig.lineHeight,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
return config;
|
|
95
|
+
};
|
|
96
|
+
exports.generateTailwindConfig = generateTailwindConfig;
|
|
97
|
+
//# sourceMappingURL=tailwind.config.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind.config.cjs","sourceRoot":"","sources":["../src/tailwind.config.ts"],"names":[],"mappings":";;;AAEA,yCAAuC;AAEvC,iDAAwD;AAExD;;;;;;;;;;;;;GAaG;AACH,MAAM,qBAAqB,GAAG,CAC5B,MAA8B,EAC9B,MAAc,EACd,EAAE;IACF,MAAM,SAAS,GAA2B,EAAE,CAAC;IAC7C,MAAM,cAAc,GAAG,GAAG,MAAM,GAAG,CAAC;IAEpC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC9C,IAAI,GAAG,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;YAClC,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;YAClD,SAAS,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;SAC9B;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF;;;;;;;GAOG;AACI,MAAM,sBAAsB,GAAG,CAAC,KAAY,EAAY,EAAE;IAC/D,MAAM,MAAM,GAAG,oBAAW,CAAC,KAAK,CAAC,CAAC;IAElC,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACzC,OAAO,EAAE,CAAC;KACX;IAED,sDAAsD;IACtD,MAAM,gBAAgB,GAAG,qBAAqB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACrE,MAAM,UAAU,GAAG,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzD,MAAM,YAAY,GAAG,qBAAqB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAE7D,MAAM,MAAM,GAAG;QACb,KAAK,EAAE;YACL,2GAA2G;YAC3G,MAAM,EAAE;gBACN,OAAO,EAAE,SAAS;gBAClB,OAAO,EAAE,cAAc;gBACvB,WAAW,EAAE,aAAa;gBAC1B,KAAK,EAAE,SAAS;gBAChB,KAAK,EAAE,SAAS;aACjB;YACD,QAAQ,EAAE;YACR,uEAAuE;YACvE,4CAA4C;aAC7C;YACD,MAAM,EAAE;gBACN,MAAM,EAAE;oBACN,GAAG,MAAM;iBACV;gBACD,SAAS,EAAE;oBACT,GAAG,MAAM;oBACT,GAAG,UAAU,EAAE,iDAAiD;iBACjE;gBACD,eAAe,EAAE;oBACf,GAAG,MAAM;oBACT,GAAG,gBAAgB,EAAE,mDAAmD;iBACzE;gBACD,WAAW,EAAE;oBACX,GAAG,MAAM;oBACT,GAAG,YAAY,EAAE,uDAAuD;iBACzE;gBACD,QAAQ,EAAE;oBACR,GAAG,qCAAwB,CAAC,QAAQ;iBACrC;gBACD,UAAU,EAAE;oBACV,GAAG,qCAAwB,CAAC,UAAU;iBACvC;gBACD,aAAa,EAAE;oBACb,GAAG,qCAAwB,CAAC,aAAa;iBAC1C;gBACD,UAAU,EAAE;oBACV,GAAG,qCAAwB,CAAC,UAAU;iBACvC;aACF;SACF;KACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AA5DW,QAAA,sBAAsB,0BA4DjC","sourcesContent":["import type { TwConfig } from 'twrnc';\n\nimport { themeColors } from './colors';\nimport type { Theme } from './Theme.types';\nimport { typographyTailwindConfig } from './typography';\n\n/**\n * Extracts colors by prefix from the flattened colors object and removes the prefix from keys.\n * This creates structured color objects that enable shorter Tailwind class names by removing\n * redundant prefixes (e.g., \"background-default\" becomes \"default\" for backgroundColor).\n *\n * @param colors - The flattened colors object containing all theme colors with kebab-case keys.\n * @param prefix - The prefix to extract colors for (e.g., 'background', 'text', 'border').\n * @returns A new object containing only colors matching the prefix, with the prefix removed from keys.\n *\n * @example\n * const colors = { 'background-default': '#fff', 'background-muted': '#eee', 'text-default': '#000' };\n * extractColorsByPrefix(colors, 'background');\n * // Returns: { 'default': '#fff', 'muted': '#eee' }\n */\nconst extractColorsByPrefix = (\n colors: Record<string, string>,\n prefix: string,\n) => {\n const extracted: Record<string, string> = {};\n const prefixWithDash = `${prefix}-`;\n\n Object.entries(colors).forEach(([key, value]) => {\n if (key.startsWith(prefixWithDash)) {\n const colorName = key.replace(prefixWithDash, '');\n extracted[colorName] = value;\n }\n });\n\n return extracted;\n};\n\n/**\n * Generates a Tailwind CSS configuration object based on the specified theme.\n * This configuration extends the base Tailwind settings with custom theme colors, typography settings,\n * and other style properties for use in React Native with `twrnc`.\n *\n * @param theme - The theme ('light' or 'dark'). Specifies whether to use light or dark mode styles.\n * @returns A Tailwind CSS configuration object with extended theme properties and plugins.\n */\nexport const generateTailwindConfig = (theme: Theme): TwConfig => {\n const colors = themeColors[theme];\n\n if (!colors) {\n console.error('Theme colors not found.');\n return {};\n }\n\n // Extract structured colors from the flattened colors\n const backgroundColors = extractColorsByPrefix(colors, 'background');\n const textColors = extractColorsByPrefix(colors, 'text');\n const borderColors = extractColorsByPrefix(colors, 'border');\n\n const config = {\n theme: {\n // Keep essential semantic colors, remove default palette colors to enforce use of design system components\n colors: {\n inherit: 'inherit',\n current: 'currentColor',\n transparent: 'transparent',\n black: '#000000',\n white: '#ffffff',\n },\n fontSize: {\n // Empty to remove default Tailwind font sizes (text-sm, text-lg, etc.)\n // Design system font sizes added via extend\n },\n extend: {\n colors: {\n ...colors,\n },\n textColor: {\n ...colors,\n ...textColors, // e.g. text-default instead of text-text-default\n },\n backgroundColor: {\n ...colors, // Incorporate existing color utilities like bg-primary-default\n ...backgroundColors, // e.g. bg-default instead of bg-background-default\n },\n borderColor: {\n ...colors, // Incorporate existing color utilities like border-primary-default\n ...borderColors, // e.g. border-default instead of border-border-default\n },\n fontSize: {\n ...typographyTailwindConfig.fontSize,\n },\n fontFamily: {\n ...typographyTailwindConfig.fontFamily,\n },\n letterSpacing: {\n ...typographyTailwindConfig.letterSpacing,\n },\n lineHeight: {\n ...typographyTailwindConfig.lineHeight,\n },\n },\n },\n };\n\n return config;\n};\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TwConfig } from "twrnc";
|
|
2
|
+
import type { Theme } from "./Theme.types.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* Generates a Tailwind CSS configuration object based on the specified theme.
|
|
5
|
+
* This configuration extends the base Tailwind settings with custom theme colors, typography settings,
|
|
6
|
+
* and other style properties for use in React Native with `twrnc`.
|
|
7
|
+
*
|
|
8
|
+
* @param theme - The theme ('light' or 'dark'). Specifies whether to use light or dark mode styles.
|
|
9
|
+
* @returns A Tailwind CSS configuration object with extended theme properties and plugins.
|
|
10
|
+
*/
|
|
11
|
+
export declare const generateTailwindConfig: (theme: Theme) => TwConfig;
|
|
12
|
+
//# sourceMappingURL=tailwind.config.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind.config.d.cts","sourceRoot":"","sources":["../src/tailwind.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc;AAGtC,OAAO,KAAK,EAAE,KAAK,EAAE,0BAAsB;AAkC3C;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,UAAW,KAAK,KAAG,QA4DrD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TwConfig } from "twrnc";
|
|
2
|
+
import type { Theme } from "./Theme.types.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Generates a Tailwind CSS configuration object based on the specified theme.
|
|
5
|
+
* This configuration extends the base Tailwind settings with custom theme colors, typography settings,
|
|
6
|
+
* and other style properties for use in React Native with `twrnc`.
|
|
7
|
+
*
|
|
8
|
+
* @param theme - The theme ('light' or 'dark'). Specifies whether to use light or dark mode styles.
|
|
9
|
+
* @returns A Tailwind CSS configuration object with extended theme properties and plugins.
|
|
10
|
+
*/
|
|
11
|
+
export declare const generateTailwindConfig: (theme: Theme) => TwConfig;
|
|
12
|
+
//# sourceMappingURL=tailwind.config.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind.config.d.mts","sourceRoot":"","sources":["../src/tailwind.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc;AAGtC,OAAO,KAAK,EAAE,KAAK,EAAE,0BAAsB;AAkC3C;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,UAAW,KAAK,KAAG,QA4DrD,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { themeColors } from "./colors.mjs";
|
|
2
|
+
import { typographyTailwindConfig } from "./typography.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Extracts colors by prefix from the flattened colors object and removes the prefix from keys.
|
|
5
|
+
* This creates structured color objects that enable shorter Tailwind class names by removing
|
|
6
|
+
* redundant prefixes (e.g., "background-default" becomes "default" for backgroundColor).
|
|
7
|
+
*
|
|
8
|
+
* @param colors - The flattened colors object containing all theme colors with kebab-case keys.
|
|
9
|
+
* @param prefix - The prefix to extract colors for (e.g., 'background', 'text', 'border').
|
|
10
|
+
* @returns A new object containing only colors matching the prefix, with the prefix removed from keys.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const colors = { 'background-default': '#fff', 'background-muted': '#eee', 'text-default': '#000' };
|
|
14
|
+
* extractColorsByPrefix(colors, 'background');
|
|
15
|
+
* // Returns: { 'default': '#fff', 'muted': '#eee' }
|
|
16
|
+
*/
|
|
17
|
+
const extractColorsByPrefix = (colors, prefix) => {
|
|
18
|
+
const extracted = {};
|
|
19
|
+
const prefixWithDash = `${prefix}-`;
|
|
20
|
+
Object.entries(colors).forEach(([key, value]) => {
|
|
21
|
+
if (key.startsWith(prefixWithDash)) {
|
|
22
|
+
const colorName = key.replace(prefixWithDash, '');
|
|
23
|
+
extracted[colorName] = value;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return extracted;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Generates a Tailwind CSS configuration object based on the specified theme.
|
|
30
|
+
* This configuration extends the base Tailwind settings with custom theme colors, typography settings,
|
|
31
|
+
* and other style properties for use in React Native with `twrnc`.
|
|
32
|
+
*
|
|
33
|
+
* @param theme - The theme ('light' or 'dark'). Specifies whether to use light or dark mode styles.
|
|
34
|
+
* @returns A Tailwind CSS configuration object with extended theme properties and plugins.
|
|
35
|
+
*/
|
|
36
|
+
export const generateTailwindConfig = (theme) => {
|
|
37
|
+
const colors = themeColors[theme];
|
|
38
|
+
if (!colors) {
|
|
39
|
+
console.error('Theme colors not found.');
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
// Extract structured colors from the flattened colors
|
|
43
|
+
const backgroundColors = extractColorsByPrefix(colors, 'background');
|
|
44
|
+
const textColors = extractColorsByPrefix(colors, 'text');
|
|
45
|
+
const borderColors = extractColorsByPrefix(colors, 'border');
|
|
46
|
+
const config = {
|
|
47
|
+
theme: {
|
|
48
|
+
// Keep essential semantic colors, remove default palette colors to enforce use of design system components
|
|
49
|
+
colors: {
|
|
50
|
+
inherit: 'inherit',
|
|
51
|
+
current: 'currentColor',
|
|
52
|
+
transparent: 'transparent',
|
|
53
|
+
black: '#000000',
|
|
54
|
+
white: '#ffffff',
|
|
55
|
+
},
|
|
56
|
+
fontSize: {
|
|
57
|
+
// Empty to remove default Tailwind font sizes (text-sm, text-lg, etc.)
|
|
58
|
+
// Design system font sizes added via extend
|
|
59
|
+
},
|
|
60
|
+
extend: {
|
|
61
|
+
colors: {
|
|
62
|
+
...colors,
|
|
63
|
+
},
|
|
64
|
+
textColor: {
|
|
65
|
+
...colors,
|
|
66
|
+
...textColors, // e.g. text-default instead of text-text-default
|
|
67
|
+
},
|
|
68
|
+
backgroundColor: {
|
|
69
|
+
...colors,
|
|
70
|
+
...backgroundColors, // e.g. bg-default instead of bg-background-default
|
|
71
|
+
},
|
|
72
|
+
borderColor: {
|
|
73
|
+
...colors,
|
|
74
|
+
...borderColors, // e.g. border-default instead of border-border-default
|
|
75
|
+
},
|
|
76
|
+
fontSize: {
|
|
77
|
+
...typographyTailwindConfig.fontSize,
|
|
78
|
+
},
|
|
79
|
+
fontFamily: {
|
|
80
|
+
...typographyTailwindConfig.fontFamily,
|
|
81
|
+
},
|
|
82
|
+
letterSpacing: {
|
|
83
|
+
...typographyTailwindConfig.letterSpacing,
|
|
84
|
+
},
|
|
85
|
+
lineHeight: {
|
|
86
|
+
...typographyTailwindConfig.lineHeight,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
return config;
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=tailwind.config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tailwind.config.mjs","sourceRoot":"","sources":["../src/tailwind.config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,qBAAiB;AAEvC,OAAO,EAAE,wBAAwB,EAAE,yBAAqB;AAExD;;;;;;;;;;;;;GAaG;AACH,MAAM,qBAAqB,GAAG,CAC5B,MAA8B,EAC9B,MAAc,EACd,EAAE;IACF,MAAM,SAAS,GAA2B,EAAE,CAAC;IAC7C,MAAM,cAAc,GAAG,GAAG,MAAM,GAAG,CAAC;IAEpC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC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AAG,MAAM;oBACT,GAAG,YAAY,EAAE,uDAAuD;iBACzE;gBACD,QAAQ,EAAE;oBACR,GAAG,wBAAwB,CAAC,QAAQ;iBACrC;gBACD,UAAU,EAAE;oBACV,GAAG,wBAAwB,CAAC,UAAU;iBACvC;gBACD,aAAa,EAAE;oBACb,GAAG,wBAAwB,CAAC,aAAa;iBAC1C;gBACD,UAAU,EAAE;oBACV,GAAG,wBAAwB,CAAC,UAAU;iBACvC;aACF;SACF;KACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import type { TwConfig } from 'twrnc';\n\nimport { themeColors } from './colors';\nimport type { Theme } from './Theme.types';\nimport { typographyTailwindConfig } from './typography';\n\n/**\n * Extracts colors by prefix from the flattened colors object and removes the prefix from keys.\n * This creates structured color objects that enable shorter Tailwind class names by removing\n * redundant prefixes (e.g., \"background-default\" becomes \"default\" for backgroundColor).\n *\n * @param colors - The flattened colors object containing all theme colors with kebab-case keys.\n * @param prefix - The prefix to extract colors for (e.g., 'background', 'text', 'border').\n * @returns A new object containing only colors matching the prefix, with the prefix removed from keys.\n *\n * @example\n * const colors = { 'background-default': '#fff', 'background-muted': '#eee', 'text-default': '#000' };\n * extractColorsByPrefix(colors, 'background');\n * // Returns: { 'default': '#fff', 'muted': '#eee' }\n */\nconst extractColorsByPrefix = (\n colors: Record<string, string>,\n prefix: string,\n) => {\n const extracted: Record<string, string> = {};\n const prefixWithDash = `${prefix}-`;\n\n Object.entries(colors).forEach(([key, value]) => {\n if (key.startsWith(prefixWithDash)) {\n const colorName = key.replace(prefixWithDash, '');\n extracted[colorName] = value;\n }\n });\n\n return extracted;\n};\n\n/**\n * Generates a Tailwind CSS configuration object based on the specified theme.\n * This configuration extends the base Tailwind settings with custom theme colors, typography settings,\n * and other style properties for use in React Native with `twrnc`.\n *\n * @param theme - The theme ('light' or 'dark'). Specifies whether to use light or dark mode styles.\n * @returns A Tailwind CSS configuration object with extended theme properties and plugins.\n */\nexport const generateTailwindConfig = (theme: Theme): TwConfig => {\n const colors = themeColors[theme];\n\n if (!colors) {\n console.error('Theme colors not found.');\n return {};\n }\n\n // Extract structured colors from the flattened colors\n const backgroundColors = extractColorsByPrefix(colors, 'background');\n const textColors = extractColorsByPrefix(colors, 'text');\n const borderColors = extractColorsByPrefix(colors, 'border');\n\n const config = {\n theme: {\n // Keep essential semantic colors, remove default palette colors to enforce use of design system components\n colors: {\n inherit: 'inherit',\n current: 'currentColor',\n transparent: 'transparent',\n black: '#000000',\n white: '#ffffff',\n },\n fontSize: {\n // Empty to remove default Tailwind font sizes (text-sm, text-lg, etc.)\n // Design system font sizes added via extend\n },\n extend: {\n colors: {\n ...colors,\n },\n textColor: {\n ...colors,\n ...textColors, // e.g. text-default instead of text-text-default\n },\n backgroundColor: {\n ...colors, // Incorporate existing color utilities like bg-primary-default\n ...backgroundColors, // e.g. bg-default instead of bg-background-default\n },\n borderColor: {\n ...colors, // Incorporate existing color utilities like border-primary-default\n ...borderColors, // e.g. border-default instead of border-border-default\n },\n fontSize: {\n ...typographyTailwindConfig.fontSize,\n },\n fontFamily: {\n ...typographyTailwindConfig.fontFamily,\n },\n letterSpacing: {\n ...typographyTailwindConfig.letterSpacing,\n },\n lineHeight: {\n ...typographyTailwindConfig.lineHeight,\n },\n },\n },\n };\n\n return config;\n};\n"]}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.typographyTailwindConfig = void 0;
|
|
4
|
+
const design_tokens_1 = require("@metamask/design-tokens");
|
|
5
|
+
exports.typographyTailwindConfig = {
|
|
6
|
+
fontSize: {
|
|
7
|
+
'display-lg': [
|
|
8
|
+
design_tokens_1.typography.sDisplayLG.fontSize.toString(),
|
|
9
|
+
{
|
|
10
|
+
lineHeight: `${design_tokens_1.typography.sDisplayLG.lineHeight}px`,
|
|
11
|
+
letterSpacing: `${design_tokens_1.typography.sDisplayLG.letterSpacing}`,
|
|
12
|
+
fontWeight: design_tokens_1.typography.sDisplayLG.fontWeight,
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
'display-md': [
|
|
16
|
+
design_tokens_1.typography.sDisplayMD.fontSize.toString(),
|
|
17
|
+
{
|
|
18
|
+
lineHeight: `${design_tokens_1.typography.sDisplayMD.lineHeight}px`,
|
|
19
|
+
letterSpacing: `${design_tokens_1.typography.sDisplayMD.letterSpacing}`,
|
|
20
|
+
fontWeight: design_tokens_1.typography.sDisplayMD.fontWeight,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
'heading-lg': [
|
|
24
|
+
design_tokens_1.typography.sHeadingLG.fontSize.toString(),
|
|
25
|
+
{
|
|
26
|
+
lineHeight: `${design_tokens_1.typography.sHeadingLG.lineHeight}px`,
|
|
27
|
+
letterSpacing: `${design_tokens_1.typography.sHeadingLG.letterSpacing}`,
|
|
28
|
+
fontWeight: design_tokens_1.typography.sHeadingLG.fontWeight,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
'heading-md': [
|
|
32
|
+
design_tokens_1.typography.sHeadingMD.fontSize.toString(),
|
|
33
|
+
{
|
|
34
|
+
lineHeight: `${design_tokens_1.typography.sHeadingMD.lineHeight}px`,
|
|
35
|
+
letterSpacing: `${design_tokens_1.typography.sHeadingMD.letterSpacing}`,
|
|
36
|
+
fontWeight: design_tokens_1.typography.sHeadingMD.fontWeight,
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
'heading-sm': [
|
|
40
|
+
design_tokens_1.typography.sHeadingSM.fontSize.toString(),
|
|
41
|
+
{
|
|
42
|
+
lineHeight: `${design_tokens_1.typography.sHeadingSM.lineHeight}px`,
|
|
43
|
+
letterSpacing: `${design_tokens_1.typography.sHeadingSM.letterSpacing}`,
|
|
44
|
+
fontWeight: design_tokens_1.typography.sHeadingSM.fontWeight,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
'body-lg': [
|
|
48
|
+
design_tokens_1.typography.sBodyLGMedium.fontSize.toString(),
|
|
49
|
+
{
|
|
50
|
+
lineHeight: `${design_tokens_1.typography.sBodyLGMedium.lineHeight}px`,
|
|
51
|
+
letterSpacing: `${design_tokens_1.typography.sBodyLGMedium.letterSpacing}`,
|
|
52
|
+
fontWeight: design_tokens_1.typography.sBodyLGMedium.fontWeight,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
'body-md': [
|
|
56
|
+
design_tokens_1.typography.sBodyMD.fontSize.toString(),
|
|
57
|
+
{
|
|
58
|
+
lineHeight: `${design_tokens_1.typography.sBodyMD.lineHeight}px`,
|
|
59
|
+
letterSpacing: `${design_tokens_1.typography.sBodyMD.letterSpacing}`,
|
|
60
|
+
fontWeight: design_tokens_1.typography.sBodyMD.fontWeight,
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
'body-sm': [
|
|
64
|
+
design_tokens_1.typography.sBodySM.fontSize.toString(),
|
|
65
|
+
{
|
|
66
|
+
lineHeight: `${design_tokens_1.typography.sBodySM.lineHeight}px`,
|
|
67
|
+
letterSpacing: `${design_tokens_1.typography.sBodySM.letterSpacing}`,
|
|
68
|
+
fontWeight: design_tokens_1.typography.sBodySM.fontWeight,
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
'body-xs': [
|
|
72
|
+
design_tokens_1.typography.sBodyXS.fontSize.toString(),
|
|
73
|
+
{
|
|
74
|
+
lineHeight: `${design_tokens_1.typography.sBodyXS.lineHeight}px`,
|
|
75
|
+
letterSpacing: `${design_tokens_1.typography.sBodyXS.letterSpacing}`,
|
|
76
|
+
fontWeight: design_tokens_1.typography.sBodyXS.fontWeight,
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
fontFamily: {
|
|
81
|
+
'default-regular': 'Geist-Regular',
|
|
82
|
+
'default-regular-italic': 'Geist-RegularItalic',
|
|
83
|
+
'default-medium': 'Geist-Medium',
|
|
84
|
+
'default-medium-italic': 'Geist-MediumItalic',
|
|
85
|
+
'default-bold': 'Geist-Bold',
|
|
86
|
+
'default-bold-italic': 'Geist-BoldItalic',
|
|
87
|
+
'accent-regular': 'MMSans-Regular',
|
|
88
|
+
'accent-medium': 'MMSans-Medium',
|
|
89
|
+
'accent-bold': 'MMSans-Bold',
|
|
90
|
+
'hero-regular': 'MMPoly-Regular',
|
|
91
|
+
},
|
|
92
|
+
letterSpacing: {
|
|
93
|
+
'display-lg': `${design_tokens_1.typography.sDisplayLG.letterSpacing}`,
|
|
94
|
+
'display-md': `${design_tokens_1.typography.sDisplayMD.letterSpacing}`,
|
|
95
|
+
'heading-lg': `${design_tokens_1.typography.sHeadingLG.letterSpacing}`,
|
|
96
|
+
'heading-md': `${design_tokens_1.typography.sHeadingMD.letterSpacing}`,
|
|
97
|
+
'heading-sm': `${design_tokens_1.typography.sHeadingSM.letterSpacing}`,
|
|
98
|
+
'body-lg': `${design_tokens_1.typography.sBodyLGMedium.letterSpacing}`,
|
|
99
|
+
'body-md': `${design_tokens_1.typography.sBodyMD.letterSpacing}`,
|
|
100
|
+
'body-sm': `${design_tokens_1.typography.sBodySM.letterSpacing}`,
|
|
101
|
+
'body-xs': `${design_tokens_1.typography.sBodyXS.letterSpacing}`,
|
|
102
|
+
},
|
|
103
|
+
lineHeight: {
|
|
104
|
+
'display-lg': `${design_tokens_1.typography.sDisplayLG.lineHeight}px`,
|
|
105
|
+
'display-md': `${design_tokens_1.typography.sDisplayMD.lineHeight}px`,
|
|
106
|
+
'heading-lg': `${design_tokens_1.typography.sHeadingLG.lineHeight}px`,
|
|
107
|
+
'heading-md': `${design_tokens_1.typography.sHeadingMD.lineHeight}px`,
|
|
108
|
+
'heading-sm': `${design_tokens_1.typography.sHeadingSM.lineHeight}px`,
|
|
109
|
+
'body-lg': `${design_tokens_1.typography.sBodyLGMedium.lineHeight}px`,
|
|
110
|
+
'body-md': `${design_tokens_1.typography.sBodyMD.lineHeight}px`,
|
|
111
|
+
'body-sm': `${design_tokens_1.typography.sBodySM.lineHeight}px`,
|
|
112
|
+
'body-xs': `${design_tokens_1.typography.sBodyXS.lineHeight}px`,
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
//# sourceMappingURL=typography.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.cjs","sourceRoot":"","sources":["../src/typography.ts"],"names":[],"mappings":";;;AAAA,2DAAqD;AAIxC,QAAA,wBAAwB,GAAkC;IACrE,QAAQ,EAAE;QACR,YAAY,EAAE;YACZ,0BAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACzC;gBACE,UAAU,EAAE,GAAG,0BAAU,CAAC,UAAU,CAAC,UAAoB,IAAI;gBAC7D,aAAa,EAAE,GAAG,0BAAU,CAAC,UAAU,CAAC,aAAuB,EAAE;gBACjE,UAAU,EAAE,0BAAU,CAAC,UAAU,CAAC,UAAU;aAC7C;SACF;QACD,YAAY,EAAE;YACZ,0BAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACzC;gBACE,UAAU,EAAE,GAAG,0BAAU,CAAC,UAAU,CAAC,UAAoB,IAAI;gBAC7D,aAAa,EAAE,GAAG,0BAAU,CAAC,UAAU,CAAC,aAAuB,EAAE;gBACjE,UAAU,EAAE,0BAAU,CAAC,UAAU,CAAC,UAAU;aAC7C;SACF;QACD,YAAY,EAAE;YACZ,0BAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACzC;gBACE,UAAU,EAAE,GAAG,0BAAU,CAAC,UAAU,CAAC,UAAoB,IAAI;gBAC7D,aAAa,EAAE,GAAG,0BAAU,CAAC,UAAU,CAAC,aAAuB,EAAE;gBACjE,UAAU,EAAE,0BAAU,CAAC,UAAU,CAAC,UAAU;aAC7C;SACF;QACD,YAAY,EAAE;YACZ,0BAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACzC;gBACE,UAAU,EAAE,GAAG,0BAAU,CAAC,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AAI;QAC/D,YAAY,EAAE,GAAG,0BAAU,CAAC,UAAU,CAAC,UAAoB,IAAI;QAC/D,YAAY,EAAE,GAAG,0BAAU,CAAC,UAAU,CAAC,UAAoB,IAAI;QAC/D,YAAY,EAAE,GAAG,0BAAU,CAAC,UAAU,CAAC,UAAoB,IAAI;QAC/D,YAAY,EAAE,GAAG,0BAAU,CAAC,UAAU,CAAC,UAAoB,IAAI;QAC/D,SAAS,EAAE,GAAG,0BAAU,CAAC,aAAa,CAAC,UAAoB,IAAI;QAC/D,SAAS,EAAE,GAAG,0BAAU,CAAC,OAAO,CAAC,UAAoB,IAAI;QACzD,SAAS,EAAE,GAAG,0BAAU,CAAC,OAAO,CAAC,UAAoB,IAAI;QACzD,SAAS,EAAE,GAAG,0BAAU,CAAC,OAAO,CAAC,UAAoB,IAAI;KAC1D;CACF,CAAC","sourcesContent":["import { typography } from '@metamask/design-tokens';\n\nimport type { TypographyTailwindConfigProps } from './typography.types';\n\nexport const typographyTailwindConfig: TypographyTailwindConfigProps = {\n fontSize: {\n 'display-lg': [\n typography.sDisplayLG.fontSize.toString(),\n {\n lineHeight: `${typography.sDisplayLG.lineHeight as number}px`,\n letterSpacing: `${typography.sDisplayLG.letterSpacing as number}`,\n fontWeight: typography.sDisplayLG.fontWeight,\n },\n ],\n 'display-md': [\n typography.sDisplayMD.fontSize.toString(),\n {\n lineHeight: `${typography.sDisplayMD.lineHeight as number}px`,\n letterSpacing: `${typography.sDisplayMD.letterSpacing as number}`,\n fontWeight: typography.sDisplayMD.fontWeight,\n },\n ],\n 'heading-lg': [\n typography.sHeadingLG.fontSize.toString(),\n {\n lineHeight: `${typography.sHeadingLG.lineHeight as number}px`,\n letterSpacing: `${typography.sHeadingLG.letterSpacing as number}`,\n fontWeight: typography.sHeadingLG.fontWeight,\n },\n ],\n 'heading-md': [\n typography.sHeadingMD.fontSize.toString(),\n {\n lineHeight: `${typography.sHeadingMD.lineHeight as number}px`,\n letterSpacing: `${typography.sHeadingMD.letterSpacing as number}`,\n fontWeight: typography.sHeadingMD.fontWeight,\n },\n ],\n 'heading-sm': [\n typography.sHeadingSM.fontSize.toString(),\n {\n lineHeight: `${typography.sHeadingSM.lineHeight as number}px`,\n letterSpacing: `${typography.sHeadingSM.letterSpacing as number}`,\n fontWeight: typography.sHeadingSM.fontWeight,\n },\n ],\n 'body-lg': [\n typography.sBodyLGMedium.fontSize.toString(),\n {\n lineHeight: `${typography.sBodyLGMedium.lineHeight as number}px`,\n letterSpacing: `${typography.sBodyLGMedium.letterSpacing as number}`,\n fontWeight: typography.sBodyLGMedium.fontWeight,\n },\n ],\n 'body-md': [\n typography.sBodyMD.fontSize.toString(),\n {\n lineHeight: `${typography.sBodyMD.lineHeight as number}px`,\n letterSpacing: `${typography.sBodyMD.letterSpacing as number}`,\n fontWeight: typography.sBodyMD.fontWeight,\n },\n ],\n 'body-sm': [\n typography.sBodySM.fontSize.toString(),\n {\n lineHeight: `${typography.sBodySM.lineHeight as number}px`,\n letterSpacing: `${typography.sBodySM.letterSpacing as number}`,\n fontWeight: typography.sBodySM.fontWeight,\n },\n ],\n 'body-xs': [\n typography.sBodyXS.fontSize.toString(),\n {\n lineHeight: `${typography.sBodyXS.lineHeight as number}px`,\n letterSpacing: `${typography.sBodyXS.letterSpacing as number}`,\n fontWeight: typography.sBodyXS.fontWeight,\n },\n ],\n },\n fontFamily: {\n 'default-regular': 'Geist-Regular',\n 'default-regular-italic': 'Geist-RegularItalic',\n 'default-medium': 'Geist-Medium',\n 'default-medium-italic': 'Geist-MediumItalic',\n 'default-bold': 'Geist-Bold',\n 'default-bold-italic': 'Geist-BoldItalic',\n 'accent-regular': 'MMSans-Regular',\n 'accent-medium': 'MMSans-Medium',\n 'accent-bold': 'MMSans-Bold',\n 'hero-regular': 'MMPoly-Regular',\n },\n letterSpacing: {\n 'display-lg': `${typography.sDisplayLG.letterSpacing as number}`,\n 'display-md': `${typography.sDisplayMD.letterSpacing as number}`,\n 'heading-lg': `${typography.sHeadingLG.letterSpacing as number}`,\n 'heading-md': `${typography.sHeadingMD.letterSpacing as number}`,\n 'heading-sm': `${typography.sHeadingSM.letterSpacing as number}`,\n 'body-lg': `${typography.sBodyLGMedium.letterSpacing as number}`,\n 'body-md': `${typography.sBodyMD.letterSpacing as number}`,\n 'body-sm': `${typography.sBodySM.letterSpacing as number}`,\n 'body-xs': `${typography.sBodyXS.letterSpacing as number}`,\n },\n lineHeight: {\n 'display-lg': `${typography.sDisplayLG.lineHeight as number}px`,\n 'display-md': `${typography.sDisplayMD.lineHeight as number}px`,\n 'heading-lg': `${typography.sHeadingLG.lineHeight as number}px`,\n 'heading-md': `${typography.sHeadingMD.lineHeight as number}px`,\n 'heading-sm': `${typography.sHeadingSM.lineHeight as number}px`,\n 'body-lg': `${typography.sBodyLGMedium.lineHeight as number}px`,\n 'body-md': `${typography.sBodyMD.lineHeight as number}px`,\n 'body-sm': `${typography.sBodySM.lineHeight as number}px`,\n 'body-xs': `${typography.sBodyXS.lineHeight as number}px`,\n },\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.d.cts","sourceRoot":"","sources":["../src/typography.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,+BAA2B;AAExE,eAAO,MAAM,wBAAwB,EAAE,6BA6GtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.d.mts","sourceRoot":"","sources":["../src/typography.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,+BAA2B;AAExE,eAAO,MAAM,wBAAwB,EAAE,6BA6GtC,CAAC"}
|