@metamask-previews/design-system-twrnc-preset 0.0.0-preview.04cb60f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/LICENSE +20 -0
  3. package/README.md +15 -0
  4. package/dist/Theme/Theme.hooks.d.ts +2 -0
  5. package/dist/Theme/Theme.hooks.d.ts.map +1 -0
  6. package/dist/Theme/Theme.hooks.js +11 -0
  7. package/dist/Theme/Theme.hooks.js.map +1 -0
  8. package/dist/Theme/Theme.providers.d.ts +6 -0
  9. package/dist/Theme/Theme.providers.d.ts.map +1 -0
  10. package/dist/Theme/Theme.providers.js +75 -0
  11. package/dist/Theme/Theme.providers.js.map +1 -0
  12. package/dist/Theme/Theme.types.d.ts +20 -0
  13. package/dist/Theme/Theme.types.d.ts.map +1 -0
  14. package/dist/Theme/Theme.types.js +10 -0
  15. package/dist/Theme/Theme.types.js.map +1 -0
  16. package/dist/Theme/Theme.utilities.d.ts +49 -0
  17. package/dist/Theme/Theme.utilities.d.ts.map +1 -0
  18. package/dist/Theme/Theme.utilities.js +90 -0
  19. package/dist/Theme/Theme.utilities.js.map +1 -0
  20. package/dist/Theme/index.d.ts +5 -0
  21. package/dist/Theme/index.d.ts.map +1 -0
  22. package/dist/Theme/index.js +12 -0
  23. package/dist/Theme/index.js.map +1 -0
  24. package/dist/hocs/index.d.ts +2 -0
  25. package/dist/hocs/index.d.ts.map +1 -0
  26. package/dist/hocs/index.js +6 -0
  27. package/dist/hocs/index.js.map +1 -0
  28. package/dist/hocs/withThemeProvider.d.ts +7 -0
  29. package/dist/hocs/withThemeProvider.d.ts.map +1 -0
  30. package/dist/hocs/withThemeProvider.js +53 -0
  31. package/dist/hocs/withThemeProvider.js.map +1 -0
  32. package/dist/index.d.ts +5 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +13 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/twrnc-settings/colors.d.ts +3 -0
  37. package/dist/twrnc-settings/colors.d.ts.map +1 -0
  38. package/dist/twrnc-settings/colors.js +13 -0
  39. package/dist/twrnc-settings/colors.js.map +1 -0
  40. package/dist/twrnc-settings/colors.types.d.ts +30 -0
  41. package/dist/twrnc-settings/colors.types.d.ts.map +1 -0
  42. package/dist/twrnc-settings/colors.types.js +19 -0
  43. package/dist/twrnc-settings/colors.types.js.map +1 -0
  44. package/dist/twrnc-settings/colors.utilities.d.ts +26 -0
  45. package/dist/twrnc-settings/colors.utilities.d.ts.map +1 -0
  46. package/dist/twrnc-settings/colors.utilities.js +45 -0
  47. package/dist/twrnc-settings/colors.utilities.js.map +1 -0
  48. package/dist/twrnc-settings/index.d.ts +4 -0
  49. package/dist/twrnc-settings/index.d.ts.map +1 -0
  50. package/dist/twrnc-settings/index.js +11 -0
  51. package/dist/twrnc-settings/index.js.map +1 -0
  52. package/dist/twrnc-settings/typography.d.ts +3 -0
  53. package/dist/twrnc-settings/typography.d.ts.map +1 -0
  54. package/dist/twrnc-settings/typography.js +139 -0
  55. package/dist/twrnc-settings/typography.js.map +1 -0
  56. package/dist/twrnc-settings/typography.types.d.ts +64 -0
  57. package/dist/twrnc-settings/typography.types.d.ts.map +1 -0
  58. package/dist/twrnc-settings/typography.types.js +3 -0
  59. package/dist/twrnc-settings/typography.types.js.map +1 -0
  60. package/dist/twrnc-settings/typography.utilities.d.ts +22 -0
  61. package/dist/twrnc-settings/typography.utilities.d.ts.map +1 -0
  62. package/dist/twrnc-settings/typography.utilities.js +42 -0
  63. package/dist/twrnc-settings/typography.utilities.js.map +1 -0
  64. package/package.json +81 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ [Unreleased]: https://github.com/MetaMask/metamask-design-system/
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 MetaMask
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
package/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # `@metamask/design-system-twrnc-preset`
2
+
3
+ Design System twrnc preset
4
+
5
+ ## Installation
6
+
7
+ `yarn add @metamask/design-system-twrnc-preset`
8
+
9
+ or
10
+
11
+ `npm install @metamask/design-system-twrnc-preset`
12
+
13
+ ## Contributing
14
+
15
+ This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/metamask-design-system#readme).
@@ -0,0 +1,2 @@
1
+ export declare const useTailwind: () => import("twrnc").TailwindFn;
2
+ //# sourceMappingURL=Theme.hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Theme.hooks.d.ts","sourceRoot":"","sources":["../../src/Theme/Theme.hooks.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,kCAGvB,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useTailwind = void 0;
4
+ const react_1 = require("react");
5
+ const Theme_providers_1 = require("./Theme.providers");
6
+ const useTailwind = () => {
7
+ const { tw } = (0, react_1.useContext)(Theme_providers_1.ThemeContext);
8
+ return tw;
9
+ };
10
+ exports.useTailwind = useTailwind;
11
+ //# sourceMappingURL=Theme.hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Theme.hooks.js","sourceRoot":"","sources":["../../src/Theme/Theme.hooks.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AAEnC,uDAAiD;AAE1C,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,MAAM,EAAE,EAAE,EAAE,GAAG,IAAA,kBAAU,EAAC,8BAAY,CAAC,CAAC;IACxC,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAHW,QAAA,WAAW,eAGtB","sourcesContent":["import { useContext } from 'react';\n\nimport { ThemeContext } from './Theme.providers';\n\nexport const useTailwind = () => {\n const { tw } = useContext(ThemeContext);\n return tw;\n};\n"]}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { ThemeContextProps, ThemeProviderProps } from './Theme.types';
3
+ export declare const defaultThemeContextValue: ThemeContextProps;
4
+ export declare const ThemeContext: React.Context<ThemeContextProps>;
5
+ export declare const ThemeProvider: React.FC<ThemeProviderProps>;
6
+ //# sourceMappingURL=Theme.providers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Theme.providers.d.ts","sourceRoot":"","sources":["../../src/Theme/Theme.providers.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAKhE,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAI3E,eAAO,MAAM,wBAAwB,EAAE,iBAMtC,CAAC;AAEF,eAAO,MAAM,YAAY,kCAExB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA6CtD,CAAC"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ThemeProvider = exports.ThemeContext = exports.defaultThemeContextValue = void 0;
27
+ /* eslint-disable @typescript-eslint/no-empty-function */
28
+ const react_1 = __importStar(require("react"));
29
+ const react_native_1 = require("react-native");
30
+ const twrnc_1 = require("twrnc");
31
+ const twrnc_settings_1 = require("../twrnc-settings");
32
+ const Theme_types_1 = require("./Theme.types");
33
+ const Theme_utilities_1 = require("./Theme.utilities");
34
+ exports.defaultThemeContextValue = {
35
+ tw: (0, twrnc_1.create)((0, Theme_utilities_1.generateTailwindConfig)(twrnc_settings_1.ColorSet.Brand, twrnc_settings_1.ColorScheme.Light)),
36
+ colorSet: twrnc_settings_1.ColorSet.Brand,
37
+ theme: Theme_types_1.Theme.Light,
38
+ setColorSet: () => { },
39
+ setTheme: () => { },
40
+ };
41
+ exports.ThemeContext = (0, react_1.createContext)(exports.defaultThemeContextValue);
42
+ const ThemeProvider = ({ children, colorSet = twrnc_settings_1.ColorSet.Brand, theme = Theme_types_1.Theme.Default, }) => {
43
+ const [currentColorSet, setCurrentColorSet] = (0, react_1.useState)(colorSet);
44
+ const [currentTheme, setCurrentTheme] = (0, react_1.useState)(theme);
45
+ const systemColorScheme = (0, react_native_1.useColorScheme)(); // 'light' | 'dark' | null
46
+ const activeColorScheme = (0, react_1.useMemo)(() => {
47
+ if (currentTheme === Theme_types_1.Theme.Default) {
48
+ return systemColorScheme === 'dark'
49
+ ? twrnc_settings_1.ColorScheme.Dark
50
+ : twrnc_settings_1.ColorScheme.Light;
51
+ }
52
+ if (currentTheme === Theme_types_1.Theme.Light) {
53
+ return twrnc_settings_1.ColorScheme.Light;
54
+ }
55
+ if (currentTheme === Theme_types_1.Theme.Dark) {
56
+ return twrnc_settings_1.ColorScheme.Dark;
57
+ }
58
+ throw new Error('Invalid theme value');
59
+ }, [currentTheme, systemColorScheme]);
60
+ const tw = (0, react_1.useMemo)(() => {
61
+ const tailwindConfig = (0, Theme_utilities_1.generateTailwindConfig)(currentColorSet, activeColorScheme);
62
+ return (0, twrnc_1.create)(tailwindConfig);
63
+ }, [currentColorSet, activeColorScheme]);
64
+ return (<exports.ThemeContext.Provider value={{
65
+ tw,
66
+ colorSet: currentColorSet,
67
+ theme: currentTheme,
68
+ setColorSet: setCurrentColorSet,
69
+ setTheme: setCurrentTheme,
70
+ }}>
71
+ {children}
72
+ </exports.ThemeContext.Provider>);
73
+ };
74
+ exports.ThemeProvider = ThemeProvider;
75
+ //# sourceMappingURL=Theme.providers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Theme.providers.js","sourceRoot":"","sources":["../../src/Theme/Theme.providers.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAyD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/B,OAAO,4BAAW,CAAC,IAAI,CAAC;SACzB;QACD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC,EAAE,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEtC,MAAM,EAAE,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QACtB,MAAM,cAAc,GAAG,IAAA,wCAAsB,EAC3C,eAAe,EACf,iBAAiB,CAClB,CAAC;QACF,OAAO,IAAA,cAAM,EAAC,cAAc,CAAC,CAAC;IAChC,CAAC,EAAE,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEzC,OAAO,CACL,CAAC,oBAAY,CAAC,QAAQ,CACpB,KAAK,CAAC,CAAC;YACL,EAAE;YACF,QAAQ,EAAE,eAAe;YACzB,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,kBAAkB;YAC/B,QAAQ,EAAE,eAAe;SAC1B,CAAC,CAEF;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,oBAAY,CAAC,QAAQ,CAAC,CACzB,CAAC;AACJ,CAAC,CAAC;AA7CW,QAAA,aAAa,iBA6CxB","sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\nimport React, { createContext, useState, useMemo } from 'react';\nimport { useColorScheme } from 'react-native';\nimport { create } from 'twrnc';\n\nimport { ColorSet, ColorScheme } from '../twrnc-settings';\nimport type { ThemeContextProps, ThemeProviderProps } from './Theme.types';\nimport { Theme } from './Theme.types';\nimport { generateTailwindConfig } from './Theme.utilities';\n\nexport const defaultThemeContextValue: ThemeContextProps = {\n tw: create(generateTailwindConfig(ColorSet.Brand, ColorScheme.Light)),\n colorSet: ColorSet.Brand,\n theme: Theme.Light,\n setColorSet: () => {},\n setTheme: () => {},\n};\n\nexport const ThemeContext = createContext<ThemeContextProps>(\n defaultThemeContextValue,\n);\n\nexport const ThemeProvider: React.FC<ThemeProviderProps> = ({\n children,\n colorSet = ColorSet.Brand,\n theme = Theme.Default,\n}) => {\n const [currentColorSet, setCurrentColorSet] = useState<ColorSet>(colorSet);\n const [currentTheme, setCurrentTheme] = useState<Theme>(theme);\n const systemColorScheme = useColorScheme(); // 'light' | 'dark' | null\n\n const activeColorScheme: ColorScheme = useMemo(() => {\n if (currentTheme === Theme.Default) {\n return systemColorScheme === 'dark'\n ? ColorScheme.Dark\n : ColorScheme.Light;\n }\n if (currentTheme === Theme.Light) {\n return ColorScheme.Light;\n }\n if (currentTheme === Theme.Dark) {\n return ColorScheme.Dark;\n }\n throw new Error('Invalid theme value');\n }, [currentTheme, systemColorScheme]);\n\n const tw = useMemo(() => {\n const tailwindConfig = generateTailwindConfig(\n currentColorSet,\n activeColorScheme,\n );\n return create(tailwindConfig);\n }, [currentColorSet, activeColorScheme]);\n\n return (\n <ThemeContext.Provider\n value={{\n tw,\n colorSet: currentColorSet,\n theme: currentTheme,\n setColorSet: setCurrentColorSet,\n setTheme: setCurrentTheme,\n }}\n >\n {children}\n </ThemeContext.Provider>\n );\n};\n"]}
@@ -0,0 +1,20 @@
1
+ import type { create } from 'twrnc';
2
+ import type { ColorSet } from '../twrnc-settings';
3
+ export declare enum Theme {
4
+ Default = "default",
5
+ Light = "light",
6
+ Dark = "dark"
7
+ }
8
+ export type ThemeContextProps = {
9
+ tw: ReturnType<typeof create>;
10
+ colorSet: ColorSet;
11
+ theme: Theme;
12
+ setColorSet: (theme: ColorSet) => void;
13
+ setTheme: (scheme: Theme) => void;
14
+ };
15
+ export type ThemeProviderProps = {
16
+ children: React.ReactNode;
17
+ colorSet?: ColorSet;
18
+ theme?: Theme;
19
+ };
20
+ //# sourceMappingURL=Theme.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Theme.types.d.ts","sourceRoot":"","sources":["../../src/Theme/Theme.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,oBAAY,KAAK;IACf,OAAO,YAAY;IACnB,KAAK,UAAoB;IACzB,IAAI,SAAmB;CACxB;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;IAC9B,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,CAAC,MAAM,EAAE,KAAK,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Theme = void 0;
4
+ var Theme;
5
+ (function (Theme) {
6
+ Theme["Default"] = "default";
7
+ Theme["Light"] = "light";
8
+ Theme["Dark"] = "dark";
9
+ })(Theme || (exports.Theme = Theme = {}));
10
+ //# sourceMappingURL=Theme.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Theme.types.js","sourceRoot":"","sources":["../../src/Theme/Theme.types.ts"],"names":[],"mappings":";;;AAKA,IAAY,KAIX;AAJD,WAAY,KAAK;IACf,4BAAmB,CAAA;IACnB,wBAAyB,CAAA;IACzB,sBAAuB,CAAA;AACzB,CAAC,EAJW,KAAK,qBAAL,KAAK,QAIhB","sourcesContent":["import type { create } from 'twrnc';\n\nimport { ColorScheme } from '../twrnc-settings';\nimport type { ColorSet } from '../twrnc-settings';\n\nexport enum Theme {\n Default = 'default',\n Light = ColorScheme.Light,\n Dark = ColorScheme.Dark,\n}\n\nexport type ThemeContextProps = {\n tw: ReturnType<typeof create>;\n colorSet: ColorSet;\n theme: Theme;\n setColorSet: (theme: ColorSet) => void;\n setTheme: (scheme: Theme) => void;\n};\n\nexport type ThemeProviderProps = {\n children: React.ReactNode;\n colorSet?: ColorSet;\n theme?: Theme;\n};\n"]}
@@ -0,0 +1,49 @@
1
+ import type { ColorSet, ColorScheme } from '../twrnc-settings';
2
+ /**
3
+ * Generates a Tailwind CSS configuration object based on the specified color set and color scheme.
4
+ * This configuration extends the base Tailwind settings with custom theme colors, typography settings,
5
+ * and other style properties for use in React Native with `twrnc`.
6
+ *
7
+ * @param colorSet - The color set to use (e.g., 'Brand', 'Neutral'). Determines the base palette for the theme.
8
+ * @param colorScheme - The current color scheme ('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
+ * @example
11
+ * const colorSet = 'Brand';
12
+ * const colorScheme = 'dark';
13
+ *
14
+ * const tailwindConfig = generateTailwindConfig(colorSet, colorScheme);
15
+ * console.log(tailwindConfig);
16
+ *
17
+ * // Output:
18
+ * // {
19
+ * // theme: {
20
+ * // extend: {
21
+ * // colors: {
22
+ * // primary: '#1a202c',
23
+ * // secondary: '#2d3748',
24
+ * // // ...additional flattened colors
25
+ * // },
26
+ * // fontSize: {
27
+ * // 'display-md': [32, { lineHeight: '40', letterSpacing: '0', fontWeight: '700' }],
28
+ * // // ...other font sizes
29
+ * // },
30
+ * // fontFamily: {
31
+ * // sans: ['Euclid Circular B', 'Helvetica Neue', 'Arial', 'sans-serif'],
32
+ * // // ...other font families
33
+ * // },
34
+ * // letterSpacing: {
35
+ * // 'display-md': '0',
36
+ * // // ...other letter spacings
37
+ * // },
38
+ * // lineHeight: {
39
+ * // 'display-md': '40',
40
+ * // // ...other line heights
41
+ * // },
42
+ * // },
43
+ * // },
44
+ * // plugins: [],
45
+ * // }
46
+ * @throws Will log an error and return an empty object if theme colors are not found for the specified color set and color scheme.
47
+ */
48
+ export declare const generateTailwindConfig: (colorSet: ColorSet, colorScheme: ColorScheme) => {};
49
+ //# sourceMappingURL=Theme.utilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Theme.utilities.d.ts","sourceRoot":"","sources":["../../src/Theme/Theme.utilities.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,sBAAsB,aACvB,QAAQ,eACL,WAAW,OAmCzB,CAAC"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generateTailwindConfig = void 0;
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ const tailwind_config_1 = __importDefault(require("../../tailwind.config"));
9
+ const twrnc_settings_1 = require("../twrnc-settings");
10
+ /**
11
+ * Generates a Tailwind CSS configuration object based on the specified color set and color scheme.
12
+ * This configuration extends the base Tailwind settings with custom theme colors, typography settings,
13
+ * and other style properties for use in React Native with `twrnc`.
14
+ *
15
+ * @param colorSet - The color set to use (e.g., 'Brand', 'Neutral'). Determines the base palette for the theme.
16
+ * @param colorScheme - The current color scheme ('light' or 'dark'). Specifies whether to use light or dark mode styles.
17
+ * @returns A Tailwind CSS configuration object with extended theme properties and plugins.
18
+ * @example
19
+ * const colorSet = 'Brand';
20
+ * const colorScheme = 'dark';
21
+ *
22
+ * const tailwindConfig = generateTailwindConfig(colorSet, colorScheme);
23
+ * console.log(tailwindConfig);
24
+ *
25
+ * // Output:
26
+ * // {
27
+ * // theme: {
28
+ * // extend: {
29
+ * // colors: {
30
+ * // primary: '#1a202c',
31
+ * // secondary: '#2d3748',
32
+ * // // ...additional flattened colors
33
+ * // },
34
+ * // fontSize: {
35
+ * // 'display-md': [32, { lineHeight: '40', letterSpacing: '0', fontWeight: '700' }],
36
+ * // // ...other font sizes
37
+ * // },
38
+ * // fontFamily: {
39
+ * // sans: ['Euclid Circular B', 'Helvetica Neue', 'Arial', 'sans-serif'],
40
+ * // // ...other font families
41
+ * // },
42
+ * // letterSpacing: {
43
+ * // 'display-md': '0',
44
+ * // // ...other letter spacings
45
+ * // },
46
+ * // lineHeight: {
47
+ * // 'display-md': '40',
48
+ * // // ...other line heights
49
+ * // },
50
+ * // },
51
+ * // },
52
+ * // plugins: [],
53
+ * // }
54
+ * @throws Will log an error and return an empty object if theme colors are not found for the specified color set and color scheme.
55
+ */
56
+ const generateTailwindConfig = (colorSet, colorScheme) => {
57
+ const themeColors = twrnc_settings_1.colorSetList[colorSet][colorScheme];
58
+ if (!themeColors) {
59
+ console.error('Theme colors not found.');
60
+ return {};
61
+ }
62
+ return {
63
+ ...tailwind_config_1.default,
64
+ theme: {
65
+ ...tailwind_config_1.default.theme,
66
+ extend: {
67
+ ...tailwind_config_1.default.theme?.extend,
68
+ colors: {
69
+ ...tailwind_config_1.default.theme?.extend?.colors,
70
+ ...themeColors,
71
+ },
72
+ fontSize: {
73
+ ...twrnc_settings_1.typographyTailwindConfig.fontSize,
74
+ },
75
+ fontFamily: {
76
+ ...twrnc_settings_1.typographyTailwindConfig.fontFamily,
77
+ },
78
+ letterSpacing: {
79
+ ...twrnc_settings_1.typographyTailwindConfig.letterSpacing,
80
+ },
81
+ lineHeight: {
82
+ ...twrnc_settings_1.typographyTailwindConfig.lineHeight,
83
+ },
84
+ },
85
+ },
86
+ plugins: tailwind_config_1.default.plugins || [],
87
+ };
88
+ };
89
+ exports.generateTailwindConfig = generateTailwindConfig;
90
+ //# sourceMappingURL=Theme.utilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Theme.utilities.js","sourceRoot":"","sources":["../../src/Theme/Theme.utilities.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAuD;AACvD,4EAA+C;AAE/C,sDAA2E;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACI,MAAM,sBAAsB,GAAG,CACpC,QAAkB,EAClB,WAAwB,EACxB,EAAE;IACF,MAAM,WAAW,GAAG,6BAAY,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC;IAExD,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACzC,OAAO,EAAE,CAAC;KACX;IAED,OAAO;QACL,GAAG,yBAAU;QACb,KAAK,EAAE;YACL,GAAG,yBAAU,CAAC,KAAK;YACnB,MAAM,EAAE;gBACN,GAAG,yBAAU,CAAC,KAAK,EAAE,MAAM;gBAC3B,MAAM,EAAE;oBACN,GAAG,yBAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM;oBACnC,GAAG,WAAW;iBACf;gBACD,QAAQ,EAAE;oBACR,GAAG,yCAAwB,CAAC,QAAQ;iBACrC;gBACD,UAAU,EAAE;oBACV,GAAG,yCAAwB,CAAC,UAAU;iBACvC;gBACD,aAAa,EAAE;oBACb,GAAG,yCAAwB,CAAC,aAAa;iBAC1C;gBACD,UAAU,EAAE;oBACV,GAAG,yCAAwB,CAAC,UAAU;iBACvC;aACF;SACF;QACD,OAAO,EAAE,yBAAU,CAAC,OAAO,IAAI,EAAE;KAClC,CAAC;AACJ,CAAC,CAAC;AArCW,QAAA,sBAAsB,0BAqCjC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport baseConfig from '../../tailwind.config';\nimport type { ColorSet, ColorScheme } from '../twrnc-settings';\nimport { colorSetList, typographyTailwindConfig } from '../twrnc-settings';\n\n/**\n * Generates a Tailwind CSS configuration object based on the specified color set and color scheme.\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 colorSet - The color set to use (e.g., 'Brand', 'Neutral'). Determines the base palette for the theme.\n * @param colorScheme - The current color scheme ('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 * @example\n * const colorSet = 'Brand';\n * const colorScheme = 'dark';\n *\n * const tailwindConfig = generateTailwindConfig(colorSet, colorScheme);\n * console.log(tailwindConfig);\n *\n * // Output:\n * // {\n * // theme: {\n * // extend: {\n * // colors: {\n * // primary: '#1a202c',\n * // secondary: '#2d3748',\n * // // ...additional flattened colors\n * // },\n * // fontSize: {\n * // 'display-md': [32, { lineHeight: '40', letterSpacing: '0', fontWeight: '700' }],\n * // // ...other font sizes\n * // },\n * // fontFamily: {\n * // sans: ['Euclid Circular B', 'Helvetica Neue', 'Arial', 'sans-serif'],\n * // // ...other font families\n * // },\n * // letterSpacing: {\n * // 'display-md': '0',\n * // // ...other letter spacings\n * // },\n * // lineHeight: {\n * // 'display-md': '40',\n * // // ...other line heights\n * // },\n * // },\n * // },\n * // plugins: [],\n * // }\n * @throws Will log an error and return an empty object if theme colors are not found for the specified color set and color scheme.\n */\nexport const generateTailwindConfig = (\n colorSet: ColorSet,\n colorScheme: ColorScheme,\n) => {\n const themeColors = colorSetList[colorSet][colorScheme];\n\n if (!themeColors) {\n console.error('Theme colors not found.');\n return {};\n }\n\n return {\n ...baseConfig,\n theme: {\n ...baseConfig.theme,\n extend: {\n ...baseConfig.theme?.extend,\n colors: {\n ...baseConfig.theme?.extend?.colors,\n ...themeColors,\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 plugins: baseConfig.plugins || [],\n };\n};\n"]}
@@ -0,0 +1,5 @@
1
+ export { useTailwind } from './Theme.hooks';
2
+ export { ThemeContext, ThemeProvider, defaultThemeContextValue, } from './Theme.providers';
3
+ export { Theme } from './Theme.types';
4
+ export type { ThemeContextProps, ThemeProviderProps } from './Theme.types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,aAAa,EACb,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Theme = exports.defaultThemeContextValue = exports.ThemeProvider = exports.ThemeContext = exports.useTailwind = void 0;
4
+ var Theme_hooks_1 = require("./Theme.hooks");
5
+ Object.defineProperty(exports, "useTailwind", { enumerable: true, get: function () { return Theme_hooks_1.useTailwind; } });
6
+ var Theme_providers_1 = require("./Theme.providers");
7
+ Object.defineProperty(exports, "ThemeContext", { enumerable: true, get: function () { return Theme_providers_1.ThemeContext; } });
8
+ Object.defineProperty(exports, "ThemeProvider", { enumerable: true, get: function () { return Theme_providers_1.ThemeProvider; } });
9
+ Object.defineProperty(exports, "defaultThemeContextValue", { enumerable: true, get: function () { return Theme_providers_1.defaultThemeContextValue; } });
10
+ var Theme_types_1 = require("./Theme.types");
11
+ Object.defineProperty(exports, "Theme", { enumerable: true, get: function () { return Theme_types_1.Theme; } });
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Theme/index.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,qDAI2B;AAHzB,+GAAA,YAAY,OAAA;AACZ,gHAAA,aAAa,OAAA;AACb,2HAAA,wBAAwB,OAAA;AAE1B,6CAAsC;AAA7B,oGAAA,KAAK,OAAA","sourcesContent":["export { useTailwind } from './Theme.hooks';\nexport {\n ThemeContext,\n ThemeProvider,\n defaultThemeContextValue,\n} from './Theme.providers';\nexport { Theme } from './Theme.types';\nexport type { ThemeContextProps, ThemeProviderProps } from './Theme.types';\n"]}
@@ -0,0 +1,2 @@
1
+ export { withThemeProvider } from './withThemeProvider';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hocs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withThemeProvider = void 0;
4
+ var withThemeProvider_1 = require("./withThemeProvider");
5
+ Object.defineProperty(exports, "withThemeProvider", { enumerable: true, get: function () { return withThemeProvider_1.withThemeProvider; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hocs/index.ts"],"names":[],"mappings":";;;AAAA,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA","sourcesContent":["export { withThemeProvider } from './withThemeProvider';\n"]}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ /**
3
+ * HOC to wrap components with ThemeProvider if none is present.
4
+ * @param Component - The component to wrap with ThemeProvider.
5
+ */
6
+ export declare function withThemeProvider<Props extends object>(Component: React.ComponentType<Props>): React.ForwardRefExoticComponent<React.PropsWithoutRef<Props> & React.RefAttributes<any>>;
7
+ //# sourceMappingURL=withThemeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withThemeProvider.d.ts","sourceRoot":"","sources":["../../src/hocs/withThemeProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAiC,MAAM,OAAO,CAAC;AAUtD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,SAAS,MAAM,EACpD,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,4FAoBtC"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ /* eslint-disable jsdoc/require-returns */
4
+ // src/hocs/withThemeProvider.tsx
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.withThemeProvider = void 0;
30
+ const react_1 = __importStar(require("react"));
31
+ const Theme_1 = require("../Theme");
32
+ const twrnc_settings_1 = require("../twrnc-settings");
33
+ /**
34
+ * HOC to wrap components with ThemeProvider if none is present.
35
+ * @param Component - The component to wrap with ThemeProvider.
36
+ */
37
+ function withThemeProvider(Component) {
38
+ const WrappedComponent = (0, react_1.forwardRef)((props, ref) => {
39
+ // Check if a ThemeProvider is already present
40
+ const themeContext = (0, react_1.useContext)(Theme_1.ThemeContext);
41
+ // If ThemeProvider exists, use the component as is
42
+ if (themeContext !== Theme_1.defaultThemeContextValue) {
43
+ return <Component {...props} ref={ref}/>;
44
+ }
45
+ // Otherwise, wrap with ThemeProvider
46
+ return (<Theme_1.ThemeProvider colorSet={twrnc_settings_1.ColorSet.Brand} theme={Theme_1.Theme.Default}>
47
+ <Component {...props} ref={ref}/>
48
+ </Theme_1.ThemeProvider>);
49
+ });
50
+ return WrappedComponent;
51
+ }
52
+ exports.withThemeProvider = withThemeProvider;
53
+ //# sourceMappingURL=withThemeProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withThemeProvider.js","sourceRoot":"","sources":["../../src/hocs/withThemeProvider.tsx"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,0CAA0C;AAC1C,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;AAEjC,+CAAsD;AAEtD,oCAKkB;AAClB,sDAA6C;AAE7C;;;GAGG;AACH,SAAgB,iBAAiB,CAC/B,SAAqC;IAErC,MAAM,gBAAgB,GAAG,IAAA,kBAAU,EAAa,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAC7D,8CAA8C;QAC9C,MAAM,YAAY,GAAG,IAAA,kBAAU,EAAC,oBAAY,CAAC,CAAC;QAE9C,mDAAmD;QACnD,IAAI,YAAY,KAAK,gCAAwB,EAAE;YAC7C,OAAO,CAAC,SAAS,CAAC,IAAK,KAAe,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAG,CAAC;SACtD;QAED,qCAAqC;QACrC,OAAO,CACL,CAAC,qBAAa,CAAC,QAAQ,CAAC,CAAC,yBAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,aAAK,CAAC,OAAO,CAAC,CAC5D;QAAA,CAAC,SAAS,CAAC,IAAK,KAAe,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAC5C;MAAA,EAAE,qBAAa,CAAC,CACjB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AArBD,8CAqBC","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable jsdoc/require-returns */\n// src/hocs/withThemeProvider.tsx\n\nimport React, { forwardRef, useContext } from 'react';\n\nimport {\n ThemeProvider,\n ThemeContext,\n Theme,\n defaultThemeContextValue,\n} from '../Theme';\nimport { ColorSet } from '../twrnc-settings';\n\n/**\n * HOC to wrap components with ThemeProvider if none is present.\n * @param Component - The component to wrap with ThemeProvider.\n */\nexport function withThemeProvider<Props extends object>(\n Component: React.ComponentType<Props>,\n) {\n const WrappedComponent = forwardRef<any, Props>((props, ref) => {\n // Check if a ThemeProvider is already present\n const themeContext = useContext(ThemeContext);\n\n // If ThemeProvider exists, use the component as is\n if (themeContext !== defaultThemeContextValue) {\n return <Component {...(props as Props)} ref={ref} />;\n }\n\n // Otherwise, wrap with ThemeProvider\n return (\n <ThemeProvider colorSet={ColorSet.Brand} theme={Theme.Default}>\n <Component {...(props as Props)} ref={ref} />\n </ThemeProvider>\n );\n });\n\n return WrappedComponent;\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export type { ThemeContextProps, ThemeProviderProps } from './Theme';
2
+ export { useTailwind, ThemeContext, ThemeProvider, Theme } from './Theme';
3
+ export { ColorSet } from './twrnc-settings';
4
+ export { withThemeProvider } from './hocs';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAE1E,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withThemeProvider = exports.ColorSet = exports.Theme = exports.ThemeProvider = exports.ThemeContext = exports.useTailwind = void 0;
4
+ var Theme_1 = require("./Theme");
5
+ Object.defineProperty(exports, "useTailwind", { enumerable: true, get: function () { return Theme_1.useTailwind; } });
6
+ Object.defineProperty(exports, "ThemeContext", { enumerable: true, get: function () { return Theme_1.ThemeContext; } });
7
+ Object.defineProperty(exports, "ThemeProvider", { enumerable: true, get: function () { return Theme_1.ThemeProvider; } });
8
+ Object.defineProperty(exports, "Theme", { enumerable: true, get: function () { return Theme_1.Theme; } });
9
+ var twrnc_settings_1 = require("./twrnc-settings");
10
+ Object.defineProperty(exports, "ColorSet", { enumerable: true, get: function () { return twrnc_settings_1.ColorSet; } });
11
+ var hocs_1 = require("./hocs");
12
+ Object.defineProperty(exports, "withThemeProvider", { enumerable: true, get: function () { return hocs_1.withThemeProvider; } });
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,iCAA0E;AAAjE,oGAAA,WAAW,OAAA;AAAE,qGAAA,YAAY,OAAA;AAAE,sGAAA,aAAa,OAAA;AAAE,8FAAA,KAAK,OAAA;AAExD,mDAA4C;AAAnC,0GAAA,QAAQ,OAAA;AAEjB,+BAA2C;AAAlC,yGAAA,iBAAiB,OAAA","sourcesContent":["export type { ThemeContextProps, ThemeProviderProps } from './Theme';\nexport { useTailwind, ThemeContext, ThemeProvider, Theme } from './Theme';\n\nexport { ColorSet } from './twrnc-settings';\n\nexport { withThemeProvider } from './hocs';\n"]}
@@ -0,0 +1,3 @@
1
+ import type { ColorSetListProps } from './colors.types';
2
+ export declare const colorSetList: ColorSetListProps;
3
+ //# sourceMappingURL=colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/twrnc-settings/colors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIxD,eAAO,MAAM,YAAY,EAAE,iBAK1B,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.colorSetList = void 0;
4
+ const design_tokens_1 = require("@metamask-previews/design-tokens");
5
+ const colors_types_1 = require("./colors.types");
6
+ const colors_utilities_1 = require("./colors.utilities");
7
+ exports.colorSetList = {
8
+ [colors_types_1.ColorSet.Brand]: {
9
+ [colors_types_1.ColorScheme.Light]: (0, colors_utilities_1.flattenColors)(design_tokens_1.lightTheme.colors),
10
+ [colors_types_1.ColorScheme.Dark]: (0, colors_utilities_1.flattenColors)(design_tokens_1.darkTheme.colors),
11
+ },
12
+ };
13
+ //# sourceMappingURL=colors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/twrnc-settings/colors.ts"],"names":[],"mappings":";;;AAAA,oEAAyE;AAGzE,iDAAuD;AACvD,yDAAmD;AAEtC,QAAA,YAAY,GAAsB;IAC7C,CAAC,uBAAQ,CAAC,KAAK,CAAC,EAAE;QAChB,CAAC,0BAAW,CAAC,KAAK,CAAC,EAAE,IAAA,gCAAa,EAAC,0BAAU,CAAC,MAAM,CAAC;QACrD,CAAC,0BAAW,CAAC,IAAI,CAAC,EAAE,IAAA,gCAAa,EAAC,yBAAS,CAAC,MAAM,CAAC;KACpD;CACF,CAAC","sourcesContent":["import { lightTheme, darkTheme } from '@metamask-previews/design-tokens';\n\nimport type { ColorSetListProps } from './colors.types';\nimport { ColorSet, ColorScheme } from './colors.types';\nimport { flattenColors } from './colors.utilities';\n\nexport const colorSetList: ColorSetListProps = {\n [ColorSet.Brand]: {\n [ColorScheme.Light]: flattenColors(lightTheme.colors),\n [ColorScheme.Dark]: flattenColors(darkTheme.colors),\n },\n};\n"]}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Enum for different color set options.
3
+ */
4
+ export declare enum ColorSet {
5
+ Brand = "brand"
6
+ }
7
+ /**
8
+ * Enum for different color scheme options.
9
+ */
10
+ export declare enum ColorScheme {
11
+ Light = "light",
12
+ Dark = "dark"
13
+ }
14
+ /**
15
+ * Props for ColorSet. Each color set - color scheme should contain
16
+ * an object with twrnc-className string as key and color string as value.
17
+ * @example
18
+ * // {
19
+ * // 'primary-default': '#abc',
20
+ * // 'primary-alternative ': '#123',
21
+ * // 'secondary': '#456'
22
+ * // }
23
+ */
24
+ export type ColorSetListProps = {
25
+ brand: {
26
+ [ColorScheme.Light]: Record<string, string>;
27
+ [ColorScheme.Dark]: Record<string, string>;
28
+ };
29
+ };
30
+ //# sourceMappingURL=colors.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.types.d.ts","sourceRoot":"","sources":["../../src/twrnc-settings/colors.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,QAAQ;IAClB,KAAK,UAAU;CAChB;AAED;;GAEG;AACH,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE;QACL,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC5C,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC5C,CAAC;CACH,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ColorScheme = exports.ColorSet = void 0;
4
+ /**
5
+ * Enum for different color set options.
6
+ */
7
+ var ColorSet;
8
+ (function (ColorSet) {
9
+ ColorSet["Brand"] = "brand";
10
+ })(ColorSet || (exports.ColorSet = ColorSet = {}));
11
+ /**
12
+ * Enum for different color scheme options.
13
+ */
14
+ var ColorScheme;
15
+ (function (ColorScheme) {
16
+ ColorScheme["Light"] = "light";
17
+ ColorScheme["Dark"] = "dark";
18
+ })(ColorScheme || (exports.ColorScheme = ColorScheme = {}));
19
+ //# sourceMappingURL=colors.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.types.js","sourceRoot":"","sources":["../../src/twrnc-settings/colors.types.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,QAEX;AAFD,WAAY,QAAQ;IAClB,2BAAe,CAAA;AACjB,CAAC,EAFW,QAAQ,wBAAR,QAAQ,QAEnB;AAED;;GAEG;AACH,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,4BAAa,CAAA;AACf,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB","sourcesContent":["/**\n * Enum for different color set options.\n */\nexport enum ColorSet {\n Brand = 'brand',\n}\n\n/**\n * Enum for different color scheme options.\n */\nexport enum ColorScheme {\n Light = 'light',\n Dark = 'dark',\n}\n\n/**\n * Props for ColorSet. Each color set - color scheme should contain\n * an object with twrnc-className string as key and color string as value.\n * @example\n * // {\n * // 'primary-default': '#abc',\n * // 'primary-alternative ': '#123',\n * // 'secondary': '#456'\n * // }\n */\nexport type ColorSetListProps = {\n brand: {\n [ColorScheme.Light]: Record<string, string>;\n [ColorScheme.Dark]: Record<string, string>;\n };\n};\n"]}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Helper function to flatten a nested color object into a single-level object
3
+ * with keys as kebab-case strings and values as strings.
4
+ *
5
+ * @param colors - A nested object representing color values.
6
+ * @param prefix - A string prefix used for constructing flattened keys.
7
+ * @returns A single-level object with flattened keys and their corresponding color values.
8
+ * @example
9
+ * const colors = {
10
+ * primary: {
11
+ * default: '#abc',
12
+ * alternative: '#123',
13
+ * },
14
+ * secondary: '#456',
15
+ * };
16
+ *
17
+ * flattenColors(colors);
18
+ * // Returns:
19
+ * // {
20
+ * // 'primary-default': '#abc',
21
+ * // 'primary-alternative': '#123',
22
+ * // 'secondary': '#456'
23
+ * // }
24
+ */
25
+ export declare const flattenColors: (colors: Record<string, any>, prefix?: string) => Record<string, string>;
26
+ //# sourceMappingURL=colors.utilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.utilities.d.ts","sourceRoot":"","sources":["../../src/twrnc-settings/colors.utilities.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,aAAa,WAAY,OAAO,MAAM,EAAE,GAAG,CAAC,4CAYxD,CAAC"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.flattenColors = void 0;
4
+ /* eslint-disable @typescript-eslint/no-explicit-any */
5
+ /**
6
+ * Helper function to flatten a nested color object into a single-level object
7
+ * with keys as kebab-case strings and values as strings.
8
+ *
9
+ * @param colors - A nested object representing color values.
10
+ * @param prefix - A string prefix used for constructing flattened keys.
11
+ * @returns A single-level object with flattened keys and their corresponding color values.
12
+ * @example
13
+ * const colors = {
14
+ * primary: {
15
+ * default: '#abc',
16
+ * alternative: '#123',
17
+ * },
18
+ * secondary: '#456',
19
+ * };
20
+ *
21
+ * flattenColors(colors);
22
+ * // Returns:
23
+ * // {
24
+ * // 'primary-default': '#abc',
25
+ * // 'primary-alternative': '#123',
26
+ * // 'secondary': '#456'
27
+ * // }
28
+ */
29
+ const flattenColors = (colors, prefix = '') => {
30
+ let result = {};
31
+ for (const [key, value] of Object.entries(colors)) {
32
+ if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
33
+ result = { ...result, ...(0, exports.flattenColors)(value, `${prefix}${key}-`) };
34
+ }
35
+ else if (typeof value === 'string') {
36
+ result[`${prefix}${key}`] = value;
37
+ }
38
+ else {
39
+ console.warn(`Invalid color value for ${prefix}${key}:`, value);
40
+ }
41
+ }
42
+ return result;
43
+ };
44
+ exports.flattenColors = flattenColors;
45
+ //# sourceMappingURL=colors.utilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.utilities.js","sourceRoot":"","sources":["../../src/twrnc-settings/colors.utilities.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACI,MAAM,aAAa,GAAG,CAAC,MAA2B,EAAE,MAAM,GAAG,EAAE,EAAE,EAAE;IACxE,IAAI,MAAM,GAA2B,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACjD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACxE,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,GAAG,IAAA,qBAAa,EAAC,KAAK,EAAE,GAAG,MAAM,GAAG,GAAG,GAAG,CAAC,EAAE,CAAC;SACrE;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YACpC,MAAM,CAAC,GAAG,MAAM,GAAG,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;SACnC;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,2BAA2B,MAAM,GAAG,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC;SACjE;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAZW,QAAA,aAAa,iBAYxB","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * Helper function to flatten a nested color object into a single-level object\n * with keys as kebab-case strings and values as strings.\n *\n * @param colors - A nested object representing color values.\n * @param prefix - A string prefix used for constructing flattened keys.\n * @returns A single-level object with flattened keys and their corresponding color values.\n * @example\n * const colors = {\n * primary: {\n * default: '#abc',\n * alternative: '#123',\n * },\n * secondary: '#456',\n * };\n *\n * flattenColors(colors);\n * // Returns:\n * // {\n * // 'primary-default': '#abc',\n * // 'primary-alternative': '#123',\n * // 'secondary': '#456'\n * // }\n */\nexport const flattenColors = (colors: Record<string, any>, prefix = '') => {\n let result: Record<string, string> = {};\n for (const [key, value] of Object.entries(colors)) {\n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n result = { ...result, ...flattenColors(value, `${prefix}${key}-`) };\n } else if (typeof value === 'string') {\n result[`${prefix}${key}`] = value;\n } else {\n console.warn(`Invalid color value for ${prefix}${key}:`, value);\n }\n }\n return result;\n};\n"]}
@@ -0,0 +1,4 @@
1
+ export { colorSetList } from './colors';
2
+ export { ColorSet, ColorScheme } from './colors.types';
3
+ export { typographyTailwindConfig } from './typography';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/twrnc-settings/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.typographyTailwindConfig = exports.ColorScheme = exports.ColorSet = exports.colorSetList = void 0;
4
+ var colors_1 = require("./colors");
5
+ Object.defineProperty(exports, "colorSetList", { enumerable: true, get: function () { return colors_1.colorSetList; } });
6
+ var colors_types_1 = require("./colors.types");
7
+ Object.defineProperty(exports, "ColorSet", { enumerable: true, get: function () { return colors_types_1.ColorSet; } });
8
+ Object.defineProperty(exports, "ColorScheme", { enumerable: true, get: function () { return colors_types_1.ColorScheme; } });
9
+ var typography_1 = require("./typography");
10
+ Object.defineProperty(exports, "typographyTailwindConfig", { enumerable: true, get: function () { return typography_1.typographyTailwindConfig; } });
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/twrnc-settings/index.ts"],"names":[],"mappings":";;;AAAA,mCAAwC;AAA/B,sGAAA,YAAY,OAAA;AACrB,+CAAuD;AAA9C,wGAAA,QAAQ,OAAA;AAAE,2GAAA,WAAW,OAAA;AAE9B,2CAAwD;AAA/C,sHAAA,wBAAwB,OAAA","sourcesContent":["export { colorSetList } from './colors';\nexport { ColorSet, ColorScheme } from './colors.types';\n\nexport { typographyTailwindConfig } from './typography';\n"]}
@@ -0,0 +1,3 @@
1
+ import type { TypographyTailwindConfigProps } from './typography.types';
2
+ export declare const typographyTailwindConfig: TypographyTailwindConfigProps;
3
+ //# sourceMappingURL=typography.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../src/twrnc-settings/typography.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,6BAA6B,EAG9B,MAAM,oBAAoB,CAAC;AAG5B,eAAO,MAAM,wBAAwB,EAAE,6BAmOtC,CAAC"}
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.typographyTailwindConfig = void 0;
4
+ /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
5
+ const design_tokens_1 = require("@metamask-previews/design-tokens");
6
+ const typography_utilities_1 = require("./typography.utilities");
7
+ exports.typographyTailwindConfig = {
8
+ fontSize: {
9
+ 'display-md': [
10
+ design_tokens_1.typography.sDisplayMD.fontSize,
11
+ {
12
+ lineHeight: `${design_tokens_1.typography.sDisplayMD.lineHeight}px`,
13
+ letterSpacing: `${design_tokens_1.typography.sDisplayMD.letterSpacing}`,
14
+ fontWeight: design_tokens_1.typography.sDisplayMD.fontWeight,
15
+ },
16
+ ],
17
+ 'heading-lg': [
18
+ design_tokens_1.typography.sHeadingLG.fontSize,
19
+ {
20
+ lineHeight: `${design_tokens_1.typography.sHeadingLG.lineHeight}px`,
21
+ letterSpacing: `${design_tokens_1.typography.sHeadingLG.letterSpacing}`,
22
+ fontWeight: design_tokens_1.typography.sHeadingLG.fontWeight,
23
+ },
24
+ ],
25
+ 'heading-md': [
26
+ design_tokens_1.typography.sHeadingMD.fontSize,
27
+ {
28
+ lineHeight: `${design_tokens_1.typography.sHeadingMD.lineHeight}px`,
29
+ letterSpacing: `${design_tokens_1.typography.sHeadingMD.letterSpacing}`,
30
+ fontWeight: design_tokens_1.typography.sHeadingMD.fontWeight,
31
+ },
32
+ ],
33
+ 'heading-sm': [
34
+ design_tokens_1.typography.sHeadingSM.fontSize,
35
+ {
36
+ lineHeight: `${design_tokens_1.typography.sHeadingSM.lineHeight}px`,
37
+ letterSpacing: `${design_tokens_1.typography.sHeadingSM.letterSpacing}`,
38
+ fontWeight: design_tokens_1.typography.sHeadingSM.fontWeight,
39
+ },
40
+ ],
41
+ 'body-lg': [
42
+ design_tokens_1.typography.sBodyLGMedium.fontSize,
43
+ {
44
+ lineHeight: `${design_tokens_1.typography.sBodyLGMedium.lineHeight}px`,
45
+ letterSpacing: `${design_tokens_1.typography.sBodyLGMedium.letterSpacing}`,
46
+ fontWeight: design_tokens_1.typography.sBodyLGMedium.fontWeight,
47
+ },
48
+ ],
49
+ 'body-md': [
50
+ design_tokens_1.typography.sBodyMD.fontSize,
51
+ {
52
+ lineHeight: `${design_tokens_1.typography.sBodyMD.lineHeight}px`,
53
+ letterSpacing: `${design_tokens_1.typography.sBodyMD.letterSpacing}`,
54
+ fontWeight: design_tokens_1.typography.sBodyMD.fontWeight,
55
+ },
56
+ ],
57
+ 'body-sm': [
58
+ design_tokens_1.typography.sBodySM.fontSize,
59
+ {
60
+ lineHeight: `${design_tokens_1.typography.sBodySM.lineHeight}px`,
61
+ letterSpacing: `${design_tokens_1.typography.sBodySM.letterSpacing}`,
62
+ fontWeight: design_tokens_1.typography.sBodySM.fontWeight,
63
+ },
64
+ ],
65
+ 'body-xs': [
66
+ design_tokens_1.typography.sBodyXS.fontSize,
67
+ {
68
+ lineHeight: `${design_tokens_1.typography.sBodyXS.lineHeight}px`,
69
+ letterSpacing: `${design_tokens_1.typography.sBodyXS.letterSpacing}`,
70
+ fontWeight: design_tokens_1.typography.sBodyXS.fontWeight,
71
+ },
72
+ ],
73
+ },
74
+ fontFamily: {
75
+ sans: [
76
+ 'EuclidCircularB-Regular',
77
+ 'Helvetica Neue',
78
+ 'Helvetica',
79
+ 'Arial',
80
+ 'sans-serif',
81
+ ],
82
+ bold: (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'normal'),
83
+ italic: (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('400', 'italic'),
84
+ 'bold-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'italic'),
85
+ 'display-md': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)(design_tokens_1.typography.sDisplayMD.fontWeight, 'normal'),
86
+ 'display-md-bold': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'normal'),
87
+ 'display-md-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)(design_tokens_1.typography.sDisplayMD.fontWeight, 'italic'),
88
+ 'display-md-bold-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'italic'),
89
+ 'heading-lg': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)(design_tokens_1.typography.sHeadingLG.fontWeight, 'normal'),
90
+ 'heading-lg-bold': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'normal'),
91
+ 'heading-lg-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)(design_tokens_1.typography.sHeadingLG.fontWeight, 'italic'),
92
+ 'heading-lg-bold-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'italic'),
93
+ 'heading-md': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)(design_tokens_1.typography.sHeadingMD.fontWeight, 'normal'),
94
+ 'heading-md-bold': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'normal'),
95
+ 'heading-md-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)(design_tokens_1.typography.sHeadingMD.fontWeight, 'italic'),
96
+ 'heading-md-bold-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'italic'),
97
+ 'heading-sm': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)(design_tokens_1.typography.sHeadingSM.fontWeight, 'normal'),
98
+ 'heading-sm-bold': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'normal'),
99
+ 'heading-sm-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)(design_tokens_1.typography.sHeadingSM.fontWeight, 'italic'),
100
+ 'heading-sm-bold-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'italic'),
101
+ 'body-lg': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)(design_tokens_1.typography.sBodyLGMedium.fontWeight, 'normal'),
102
+ 'body-lg-bold': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'normal'),
103
+ 'body-lg-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)(design_tokens_1.typography.sBodyLGMedium.fontWeight, 'italic'),
104
+ 'body-lg-bold-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'italic'),
105
+ 'body-md': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)(design_tokens_1.typography.sBodyMD.fontWeight, 'normal'),
106
+ 'body-md-bold': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'normal'),
107
+ 'body-md-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)(design_tokens_1.typography.sBodyMD.fontWeight, 'italic'),
108
+ 'body-md-bold-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'italic'),
109
+ 'body-sm': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)(design_tokens_1.typography.sBodySM.fontWeight, 'normal'),
110
+ 'body-sm-bold': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'normal'),
111
+ 'body-sm-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)(design_tokens_1.typography.sBodySM.fontWeight, 'italic'),
112
+ 'body-sm-bold-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'italic'),
113
+ 'body-xs': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)(design_tokens_1.typography.sBodyXS.fontWeight, 'normal'),
114
+ 'body-xs-bold': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'normal'),
115
+ 'body-xs-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)(design_tokens_1.typography.sBodyXS.fontWeight, 'italic'),
116
+ 'body-xs-bold-italic': (0, typography_utilities_1.getFontFamilyFromWeightAndStyle)('700', 'italic'),
117
+ },
118
+ letterSpacing: {
119
+ 'display-md': `${design_tokens_1.typography.sDisplayMD.letterSpacing}`,
120
+ 'heading-lg': `${design_tokens_1.typography.sHeadingLG.letterSpacing}`,
121
+ 'heading-md': `${design_tokens_1.typography.sHeadingMD.letterSpacing}`,
122
+ 'heading-sm': `${design_tokens_1.typography.sHeadingSM.letterSpacing}`,
123
+ 'body-lg': `${design_tokens_1.typography.sBodyLGMedium.letterSpacing}`,
124
+ 'body-md': `${design_tokens_1.typography.sBodyMD.letterSpacing}`,
125
+ 'body-sm': `${design_tokens_1.typography.sBodySM.letterSpacing}`,
126
+ 'body-xs': `${design_tokens_1.typography.sBodyXS.letterSpacing}`,
127
+ },
128
+ lineHeight: {
129
+ 'display-md': `${design_tokens_1.typography.sDisplayMD.lineHeight}px`,
130
+ 'heading-lg': `${design_tokens_1.typography.sHeadingLG.lineHeight}px`,
131
+ 'heading-md': `${design_tokens_1.typography.sHeadingMD.lineHeight}px`,
132
+ 'heading-sm': `${design_tokens_1.typography.sHeadingSM.lineHeight}px`,
133
+ 'body-lg': `${design_tokens_1.typography.sBodyLGMedium.lineHeight}px`,
134
+ 'body-md': `${design_tokens_1.typography.sBodyMD.lineHeight}px`,
135
+ 'body-sm': `${design_tokens_1.typography.sBodySM.lineHeight}px`,
136
+ 'body-xs': `${design_tokens_1.typography.sBodyXS.lineHeight}px`,
137
+ },
138
+ };
139
+ //# sourceMappingURL=typography.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.js","sourceRoot":"","sources":["../../src/twrnc-settings/typography.ts"],"names":[],"mappings":";;;AAAA,qEAAqE;AACrE,oEAA8D;AAO9D,iEAAyE;AAE5D,QAAA,wBAAwB,GAAkC;IACrE,QAAQ,EAAE;QACR,YAAY,EAAE;YACZ,0BAAU,CAAC,UAAU,CAAC,QAAQ;YAC9B;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;YAC9B;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;YAC9B;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;YAC9B;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,SAAS,EAA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ask-previews/design-tokens';\n\nimport type {\n TypographyTailwindConfigProps,\n FontStyle,\n FontWeight,\n} from './typography.types';\nimport { getFontFamilyFromWeightAndStyle } from './typography.utilities';\n\nexport const typographyTailwindConfig: TypographyTailwindConfigProps = {\n fontSize: {\n 'display-md': [\n typography.sDisplayMD.fontSize,\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,\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,\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,\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,\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,\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,\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,\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 sans: [\n 'EuclidCircularB-Regular',\n 'Helvetica Neue',\n 'Helvetica',\n 'Arial',\n 'sans-serif',\n ],\n bold: getFontFamilyFromWeightAndStyle('700', 'normal'),\n italic: getFontFamilyFromWeightAndStyle('400', 'italic'),\n 'bold-italic': getFontFamilyFromWeightAndStyle('700', 'italic'),\n 'display-md': getFontFamilyFromWeightAndStyle(\n typography.sDisplayMD.fontWeight as FontWeight,\n 'normal' as FontStyle,\n ),\n 'display-md-bold': getFontFamilyFromWeightAndStyle(\n '700' as FontWeight,\n 'normal' as FontStyle,\n ),\n 'display-md-italic': getFontFamilyFromWeightAndStyle(\n typography.sDisplayMD.fontWeight as FontWeight,\n 'italic' as FontStyle,\n ),\n 'display-md-bold-italic': getFontFamilyFromWeightAndStyle(\n '700',\n 'italic' as FontStyle,\n ),\n 'heading-lg': getFontFamilyFromWeightAndStyle(\n typography.sHeadingLG.fontWeight as FontWeight,\n 'normal' as FontStyle,\n ),\n 'heading-lg-bold': getFontFamilyFromWeightAndStyle(\n '700' as FontWeight,\n 'normal' as FontStyle,\n ),\n 'heading-lg-italic': getFontFamilyFromWeightAndStyle(\n typography.sHeadingLG.fontWeight as FontWeight,\n 'italic' as FontStyle,\n ),\n 'heading-lg-bold-italic': getFontFamilyFromWeightAndStyle(\n '700',\n 'italic' as FontStyle,\n ),\n 'heading-md': getFontFamilyFromWeightAndStyle(\n typography.sHeadingMD.fontWeight as FontWeight,\n 'normal' as FontStyle,\n ),\n 'heading-md-bold': getFontFamilyFromWeightAndStyle(\n '700' as FontWeight,\n 'normal' as FontStyle,\n ),\n 'heading-md-italic': getFontFamilyFromWeightAndStyle(\n typography.sHeadingMD.fontWeight as FontWeight,\n 'italic' as FontStyle,\n ),\n 'heading-md-bold-italic': getFontFamilyFromWeightAndStyle(\n '700',\n 'italic' as FontStyle,\n ),\n 'heading-sm': getFontFamilyFromWeightAndStyle(\n typography.sHeadingSM.fontWeight as FontWeight,\n 'normal' as FontStyle,\n ),\n 'heading-sm-bold': getFontFamilyFromWeightAndStyle(\n '700' as FontWeight,\n 'normal' as FontStyle,\n ),\n 'heading-sm-italic': getFontFamilyFromWeightAndStyle(\n typography.sHeadingSM.fontWeight as FontWeight,\n 'italic' as FontStyle,\n ),\n 'heading-sm-bold-italic': getFontFamilyFromWeightAndStyle(\n '700',\n 'italic' as FontStyle,\n ),\n 'body-lg': getFontFamilyFromWeightAndStyle(\n typography.sBodyLGMedium.fontWeight as FontWeight,\n 'normal' as FontStyle,\n ),\n 'body-lg-bold': getFontFamilyFromWeightAndStyle(\n '700' as FontWeight,\n 'normal' as FontStyle,\n ),\n 'body-lg-italic': getFontFamilyFromWeightAndStyle(\n typography.sBodyLGMedium.fontWeight as FontWeight,\n 'italic' as FontStyle,\n ),\n 'body-lg-bold-italic': getFontFamilyFromWeightAndStyle(\n '700',\n 'italic' as FontStyle,\n ),\n 'body-md': getFontFamilyFromWeightAndStyle(\n typography.sBodyMD.fontWeight as FontWeight,\n 'normal' as FontStyle,\n ),\n 'body-md-bold': getFontFamilyFromWeightAndStyle(\n '700' as FontWeight,\n 'normal' as FontStyle,\n ),\n 'body-md-italic': getFontFamilyFromWeightAndStyle(\n typography.sBodyMD.fontWeight as FontWeight,\n 'italic' as FontStyle,\n ),\n 'body-md-bold-italic': getFontFamilyFromWeightAndStyle(\n '700',\n 'italic' as FontStyle,\n ),\n 'body-sm': getFontFamilyFromWeightAndStyle(\n typography.sBodySM.fontWeight as FontWeight,\n 'normal' as FontStyle,\n ),\n 'body-sm-bold': getFontFamilyFromWeightAndStyle(\n '700' as FontWeight,\n 'normal' as FontStyle,\n ),\n 'body-sm-italic': getFontFamilyFromWeightAndStyle(\n typography.sBodySM.fontWeight as FontWeight,\n 'italic' as FontStyle,\n ),\n 'body-sm-bold-italic': getFontFamilyFromWeightAndStyle(\n '700',\n 'italic' as FontStyle,\n ),\n 'body-xs': getFontFamilyFromWeightAndStyle(\n typography.sBodyXS.fontWeight as FontWeight,\n 'normal' as FontStyle,\n ),\n 'body-xs-bold': getFontFamilyFromWeightAndStyle(\n '700' as FontWeight,\n 'normal' as FontStyle,\n ),\n 'body-xs-italic': getFontFamilyFromWeightAndStyle(\n typography.sBodyXS.fontWeight as FontWeight,\n 'italic' as FontStyle,\n ),\n 'body-xs-bold-italic': getFontFamilyFromWeightAndStyle(\n '700',\n 'italic' as FontStyle,\n ),\n },\n letterSpacing: {\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-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,64 @@
1
+ /**
2
+ * Different Typography variants to be used as twrnc classNames
3
+ */
4
+ export type TypographyVariant = 'display-md' | 'heading-lg' | 'heading-md' | 'heading-sm' | 'body-lg' | 'body-md' | 'body-sm' | 'body-xs';
5
+ /**
6
+ * Different FontFamily variants to be used as twrnc classNames
7
+ */
8
+ export type FontFamilyVariant = TypographyVariant | 'display-md-bold' | 'display-md-italic' | 'display-md-bold-italic' | 'heading-lg-bold' | 'heading-lg-italic' | 'heading-lg-bold-italic' | 'heading-md-bold' | 'heading-md-italic' | 'heading-md-bold-italic' | 'heading-sm-bold' | 'heading-sm-italic' | 'heading-sm-bold-italic' | 'body-lg-bold' | 'body-lg-italic' | 'body-lg-bold-italic' | 'body-md-bold' | 'body-md-italic' | 'body-md-bold-italic' | 'body-sm-bold' | 'body-sm-italic' | 'body-sm-bold-italic' | 'body-xs-bold' | 'body-xs-italic' | 'body-xs-bold-italic' | 'bold' | 'italic' | 'bold-italic';
9
+ /**
10
+ * Different FontWeight and FontStyle to be used to calculate the FontFamily
11
+ * in getFontFamilyFromWeightAndStyle
12
+ */
13
+ export type FontWeight = '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | 'normal' | 'bold';
14
+ export type FontStyle = 'normal' | 'italic';
15
+ /**
16
+ * Props for TypographyTailwindConfig
17
+ * @example
18
+ * // {
19
+ * // fontSize: {
20
+ * // 'display-md': {
21
+ * // fontFamily: 'EuclidCircularB-Bold',
22
+ * // fontSize: '32',
23
+ * // fontWeight: '700',
24
+ * // letterSpacing: '0',
25
+ * // lineHeight: '40px',
26
+ * // },
27
+ * // },
28
+ * // fontFamily: {
29
+ * // sans: [
30
+ * // 'EuclidCircularB',
31
+ * // 'Helvetica Neue',
32
+ * // 'Helvetica',
33
+ * // 'Arial',
34
+ * // 'sans-serif',
35
+ * // ],
36
+ * // 'display-md': 'EuclidCircularB',
37
+ * // },
38
+ * // letterSpacing: {
39
+ * // 'display-md': '0',
40
+ * // },
41
+ * // fontWeight: {
42
+ * // 'display-md': '400',
43
+ * // },
44
+ * // lineHeight: {
45
+ * // 'display-md': '40px',
46
+ * // },
47
+ * // }
48
+ */
49
+ export type TypographyTailwindConfigProps = {
50
+ fontSize: Record<TypographyVariant, [
51
+ number,
52
+ {
53
+ lineHeight: string;
54
+ letterSpacing: string;
55
+ fontWeight: string;
56
+ }
57
+ ]>;
58
+ fontFamily: {
59
+ sans: string[];
60
+ } & Record<FontFamilyVariant, string>;
61
+ letterSpacing: Record<TypographyVariant, string>;
62
+ lineHeight: Record<TypographyVariant, string>;
63
+ };
64
+ //# sourceMappingURL=typography.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.types.d.ts","sourceRoot":"","sources":["../../src/twrnc-settings/typography.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GACnB,wBAAwB,GACxB,iBAAiB,GACjB,mBAAmB,GACnB,wBAAwB,GACxB,iBAAiB,GACjB,mBAAmB,GACnB,wBAAwB,GACxB,iBAAiB,GACjB,mBAAmB,GACnB,wBAAwB,GACxB,cAAc,GACd,gBAAgB,GAChB,qBAAqB,GACrB,cAAc,GACd,gBAAgB,GAChB,qBAAqB,GACrB,cAAc,GACd,gBAAgB,GAChB,qBAAqB,GACrB,cAAc,GACd,gBAAgB,GAChB,qBAAqB,GACrB,MAAM,GACN,QAAQ,GACR,aAAa,CAAC;AAElB;;;GAGG;AACH,MAAM,MAAM,UAAU,GAClB,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,QAAQ,GACR,MAAM,CAAC;AACX,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C,QAAQ,EAAE,MAAM,CACd,iBAAiB,EACjB;QACE,MAAM;QACN;YACE,UAAU,EAAE,MAAM,CAAC;YACnB,aAAa,EAAE,MAAM,CAAC;YACtB,UAAU,EAAE,MAAM,CAAC;SACpB;KACF,CACF,CAAC;IACF,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,EAAE,CAAC;KAChB,GAAG,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IACtC,aAAa,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IACjD,UAAU,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;CAC/C,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=typography.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.types.js","sourceRoot":"","sources":["../../src/twrnc-settings/typography.types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Different Typography variants to be used as twrnc classNames\n */\nexport type TypographyVariant =\n | 'display-md'\n | 'heading-lg'\n | 'heading-md'\n | 'heading-sm'\n | 'body-lg'\n | 'body-md'\n | 'body-sm'\n | 'body-xs';\n\n/**\n * Different FontFamily variants to be used as twrnc classNames\n */\nexport type FontFamilyVariant =\n | TypographyVariant\n | 'display-md-bold'\n | 'display-md-italic'\n | 'display-md-bold-italic'\n | 'heading-lg-bold'\n | 'heading-lg-italic'\n | 'heading-lg-bold-italic'\n | 'heading-md-bold'\n | 'heading-md-italic'\n | 'heading-md-bold-italic'\n | 'heading-sm-bold'\n | 'heading-sm-italic'\n | 'heading-sm-bold-italic'\n | 'body-lg-bold'\n | 'body-lg-italic'\n | 'body-lg-bold-italic'\n | 'body-md-bold'\n | 'body-md-italic'\n | 'body-md-bold-italic'\n | 'body-sm-bold'\n | 'body-sm-italic'\n | 'body-sm-bold-italic'\n | 'body-xs-bold'\n | 'body-xs-italic'\n | 'body-xs-bold-italic'\n | 'bold'\n | 'italic'\n | 'bold-italic';\n\n/**\n * Different FontWeight and FontStyle to be used to calculate the FontFamily\n * in getFontFamilyFromWeightAndStyle\n */\nexport type FontWeight =\n | '100'\n | '200'\n | '300'\n | '400'\n | '500'\n | '600'\n | '700'\n | '800'\n | '900'\n | 'normal'\n | 'bold';\nexport type FontStyle = 'normal' | 'italic';\n\n/**\n * Props for TypographyTailwindConfig\n * @example\n * // {\n * // fontSize: {\n * // 'display-md': {\n * // fontFamily: 'EuclidCircularB-Bold',\n * // fontSize: '32',\n * // fontWeight: '700',\n * // letterSpacing: '0',\n * // lineHeight: '40px',\n * // },\n * // },\n * // fontFamily: {\n * // sans: [\n * // 'EuclidCircularB',\n * // 'Helvetica Neue',\n * // 'Helvetica',\n * // 'Arial',\n * // 'sans-serif',\n * // ],\n * // 'display-md': 'EuclidCircularB',\n * // },\n * // letterSpacing: {\n * // 'display-md': '0',\n * // },\n * // fontWeight: {\n * // 'display-md': '400',\n * // },\n * // lineHeight: {\n * // 'display-md': '40px',\n * // },\n * // }\n */\nexport type TypographyTailwindConfigProps = {\n fontSize: Record<\n TypographyVariant,\n [\n number,\n {\n lineHeight: string; // Make sure to include units - \"40px\" instead of \"40\"\n letterSpacing: string;\n fontWeight: string;\n },\n ]\n >;\n fontFamily: {\n sans: string[];\n } & Record<FontFamilyVariant, string>;\n letterSpacing: Record<TypographyVariant, string>;\n lineHeight: Record<TypographyVariant, string>; // Make sure to include units - \"40px\" instead of \"40\"\n};\n"]}
@@ -0,0 +1,22 @@
1
+ import type { FontStyle, FontWeight } from './typography.types';
2
+ /**
3
+ * Helper function to determine the font family based on the font weight and style.
4
+ *
5
+ * @param fontWeight - The weight of the font as a string (e.g., '400', '500', 'bold').
6
+ * Default is '400'.
7
+ * @param fontStyle - The style of the font as a string (e.g., 'normal', 'italic').
8
+ * Default is 'normal'.
9
+ * @returns A string representing the font family name constructed based on the weight
10
+ * and style provided.
11
+ * @example
12
+ * getFontFamilyFromWeightAndStyle('400', 'normal');
13
+ * // Returns: 'EuclidCircularB-Regular'
14
+ *
15
+ * getFontFamilyFromWeightAndStyle('700', 'italic');
16
+ * // Returns: 'EuclidCircularB-BoldItalic'
17
+ *
18
+ * getFontFamilyFromWeightAndStyle('500');
19
+ * // Returns: 'EuclidCircularB-Medium'
20
+ */
21
+ export declare const getFontFamilyFromWeightAndStyle: (fontWeight?: FontWeight, fontStyle?: FontStyle) => string;
22
+ //# sourceMappingURL=typography.utilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.utilities.d.ts","sourceRoot":"","sources":["../../src/twrnc-settings/typography.utilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,+BAA+B,gBAC9B,UAAU,cACX,SAAS,KACnB,MAoBF,CAAC"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFontFamilyFromWeightAndStyle = void 0;
4
+ /**
5
+ * Helper function to determine the font family based on the font weight and style.
6
+ *
7
+ * @param fontWeight - The weight of the font as a string (e.g., '400', '500', 'bold').
8
+ * Default is '400'.
9
+ * @param fontStyle - The style of the font as a string (e.g., 'normal', 'italic').
10
+ * Default is 'normal'.
11
+ * @returns A string representing the font family name constructed based on the weight
12
+ * and style provided.
13
+ * @example
14
+ * getFontFamilyFromWeightAndStyle('400', 'normal');
15
+ * // Returns: 'EuclidCircularB-Regular'
16
+ *
17
+ * getFontFamilyFromWeightAndStyle('700', 'italic');
18
+ * // Returns: 'EuclidCircularB-BoldItalic'
19
+ *
20
+ * getFontFamilyFromWeightAndStyle('500');
21
+ * // Returns: 'EuclidCircularB-Medium'
22
+ */
23
+ const getFontFamilyFromWeightAndStyle = (fontWeight = '400', fontStyle = 'normal') => {
24
+ const weightMap = {
25
+ '100': 'Regular',
26
+ '200': 'Regular',
27
+ '300': 'Regular',
28
+ '400': 'Regular',
29
+ '500': 'Medium',
30
+ '600': 'Medium',
31
+ '700': 'Bold',
32
+ '800': 'Bold',
33
+ '900': 'Bold',
34
+ normal: 'Regular',
35
+ bold: 'Bold',
36
+ };
37
+ const styleSuffix = fontStyle === 'italic' ? 'Italic' : '';
38
+ const fontSuffix = weightMap[fontWeight];
39
+ return `EuclidCircularB-${fontSuffix}${styleSuffix}`;
40
+ };
41
+ exports.getFontFamilyFromWeightAndStyle = getFontFamilyFromWeightAndStyle;
42
+ //# sourceMappingURL=typography.utilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.utilities.js","sourceRoot":"","sources":["../../src/twrnc-settings/typography.utilities.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,+BAA+B,GAAG,CAC7C,aAAyB,KAAK,EAC9B,YAAuB,QAAQ,EACvB,EAAE;IACV,MAAM,SAAS,GAAoC;QACjD,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE,MAAM;KACb,CAAC;IAEF,MAAM,WAAW,GAAG,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAE3D,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAEzC,OAAO,mBAAmB,UAAU,GAAG,WAAW,EAAE,CAAC;AACvD,CAAC,CAAC;AAvBW,QAAA,+BAA+B,mCAuB1C","sourcesContent":["import type { FontStyle, FontWeight } from './typography.types';\n\n/**\n * Helper function to determine the font family based on the font weight and style.\n *\n * @param fontWeight - The weight of the font as a string (e.g., '400', '500', 'bold').\n * Default is '400'.\n * @param fontStyle - The style of the font as a string (e.g., 'normal', 'italic').\n * Default is 'normal'.\n * @returns A string representing the font family name constructed based on the weight\n * and style provided.\n * @example\n * getFontFamilyFromWeightAndStyle('400', 'normal');\n * // Returns: 'EuclidCircularB-Regular'\n *\n * getFontFamilyFromWeightAndStyle('700', 'italic');\n * // Returns: 'EuclidCircularB-BoldItalic'\n *\n * getFontFamilyFromWeightAndStyle('500');\n * // Returns: 'EuclidCircularB-Medium'\n */\nexport const getFontFamilyFromWeightAndStyle = (\n fontWeight: FontWeight = '400',\n fontStyle: FontStyle = 'normal',\n): string => {\n const weightMap: { [key in FontWeight]: string } = {\n '100': 'Regular',\n '200': 'Regular',\n '300': 'Regular',\n '400': 'Regular',\n '500': 'Medium',\n '600': 'Medium',\n '700': 'Bold',\n '800': 'Bold',\n '900': 'Bold',\n normal: 'Regular',\n bold: 'Bold',\n };\n\n const styleSuffix = fontStyle === 'italic' ? 'Italic' : '';\n\n const fontSuffix = weightMap[fontWeight];\n\n return `EuclidCircularB-${fontSuffix}${styleSuffix}`;\n};\n"]}
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "@metamask-previews/design-system-twrnc-preset",
3
+ "version": "0.0.0-preview.04cb60f",
4
+ "description": "Design System twrnc Preset",
5
+ "keywords": [
6
+ "MetaMask",
7
+ "Ethereum"
8
+ ],
9
+ "homepage": "https://github.com/MetaMask/metamask-design-system/tree/main/packages/design-system-twrnc-preset#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/MetaMask/metamask-design-system/issues"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/MetaMask/metamask-design-system.git"
16
+ },
17
+ "license": "MIT",
18
+ "sideEffects": false,
19
+ "exports": {
20
+ ".": {
21
+ "require": {
22
+ "types": "./dist/index.d.ts",
23
+ "default": "./dist/index.js"
24
+ },
25
+ "import": {
26
+ "types": "./dist/index.d.ts",
27
+ "default": "./dist/index.js"
28
+ }
29
+ },
30
+ "./package.json": "./package.json"
31
+ },
32
+ "main": "./dist/index.js",
33
+ "types": "./dist/index.d.ts",
34
+ "files": [
35
+ "dist/"
36
+ ],
37
+ "scripts": {
38
+ "build": "rm -rf tsconfig.build.tsbuildinfo dist && tsc --project tsconfig.build.json",
39
+ "changelog:update": "../../scripts/update-changelog.sh @metamask/design-system-twrnc-preset",
40
+ "changelog:validate": "../../scripts/validate-changelog.sh @metamask/design-system-twrnc-preset",
41
+ "publish:preview": "yarn npm publish --tag preview",
42
+ "since-latest-release": "../../scripts/since-latest-release.sh",
43
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter -passWithNoTests",
44
+ "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache",
45
+ "test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose",
46
+ "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
47
+ },
48
+ "dependencies": {
49
+ "@metamask-previews/design-tokens": "4.1.0-preview.04cb60f"
50
+ },
51
+ "devDependencies": {
52
+ "@babel/core": "^7.23.5",
53
+ "@babel/preset-env": "^7.26.0",
54
+ "@babel/preset-react": "^7.25.9",
55
+ "@babel/preset-typescript": "^7.23.3",
56
+ "@metamask/auto-changelog": "^3.4.4",
57
+ "@testing-library/react-native": "^12.8.1",
58
+ "@types/babel__preset-env": "^7",
59
+ "@types/jest": "^27.4.1",
60
+ "@types/react-test-renderer": "^18",
61
+ "babel-jest": "^29.7.0",
62
+ "deepmerge": "^4.2.2",
63
+ "jest": "^29.7.0",
64
+ "metro-react-native-babel-preset": "^0.77.0",
65
+ "react-test-renderer": "^18.3.1",
66
+ "ts-jest": "^29.2.5",
67
+ "typescript": "~5.2.2"
68
+ },
69
+ "peerDependencies": {
70
+ "react": "^18.2.0",
71
+ "react-native": "0.72.15",
72
+ "twrnc": "^4.5.1"
73
+ },
74
+ "engines": {
75
+ "node": "^18.18 || >=20"
76
+ },
77
+ "publishConfig": {
78
+ "access": "public",
79
+ "registry": "https://registry.npmjs.org/"
80
+ }
81
+ }