@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.
Files changed (76) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/LICENSE +20 -0
  3. package/README.md +31 -0
  4. package/dist/Theme.types.cjs +12 -0
  5. package/dist/Theme.types.cjs.map +1 -0
  6. package/dist/Theme.types.d.cts +8 -0
  7. package/dist/Theme.types.d.cts.map +1 -0
  8. package/dist/Theme.types.d.mts +8 -0
  9. package/dist/Theme.types.d.mts.map +1 -0
  10. package/dist/Theme.types.mjs +9 -0
  11. package/dist/Theme.types.mjs.map +1 -0
  12. package/dist/ThemeContext.cjs +13 -0
  13. package/dist/ThemeContext.cjs.map +1 -0
  14. package/dist/ThemeContext.d.cts +15 -0
  15. package/dist/ThemeContext.d.cts.map +1 -0
  16. package/dist/ThemeContext.d.mts +15 -0
  17. package/dist/ThemeContext.d.mts.map +1 -0
  18. package/dist/ThemeContext.mjs +10 -0
  19. package/dist/ThemeContext.mjs.map +1 -0
  20. package/dist/ThemeProvider.cjs +53 -0
  21. package/dist/ThemeProvider.cjs.map +1 -0
  22. package/dist/ThemeProvider.d.cts +15 -0
  23. package/dist/ThemeProvider.d.cts.map +1 -0
  24. package/dist/ThemeProvider.d.mts +15 -0
  25. package/dist/ThemeProvider.d.mts.map +1 -0
  26. package/dist/ThemeProvider.mjs +33 -0
  27. package/dist/ThemeProvider.mjs.map +1 -0
  28. package/dist/colors.cjs +67 -0
  29. package/dist/colors.cjs.map +1 -0
  30. package/dist/colors.d.cts +3 -0
  31. package/dist/colors.d.cts.map +1 -0
  32. package/dist/colors.d.mts +3 -0
  33. package/dist/colors.d.mts.map +1 -0
  34. package/dist/colors.mjs +64 -0
  35. package/dist/colors.mjs.map +1 -0
  36. package/dist/hooks.cjs +47 -0
  37. package/dist/hooks.cjs.map +1 -0
  38. package/dist/hooks.d.cts +35 -0
  39. package/dist/hooks.d.cts.map +1 -0
  40. package/dist/hooks.d.mts +35 -0
  41. package/dist/hooks.d.mts.map +1 -0
  42. package/dist/hooks.mjs +42 -0
  43. package/dist/hooks.mjs.map +1 -0
  44. package/dist/index.cjs +13 -0
  45. package/dist/index.cjs.map +1 -0
  46. package/dist/index.d.cts +4 -0
  47. package/dist/index.d.cts.map +1 -0
  48. package/dist/index.d.mts +4 -0
  49. package/dist/index.d.mts.map +1 -0
  50. package/dist/index.mjs +6 -0
  51. package/dist/index.mjs.map +1 -0
  52. package/dist/tailwind.config.cjs +97 -0
  53. package/dist/tailwind.config.cjs.map +1 -0
  54. package/dist/tailwind.config.d.cts +12 -0
  55. package/dist/tailwind.config.d.cts.map +1 -0
  56. package/dist/tailwind.config.d.mts +12 -0
  57. package/dist/tailwind.config.d.mts.map +1 -0
  58. package/dist/tailwind.config.mjs +93 -0
  59. package/dist/tailwind.config.mjs.map +1 -0
  60. package/dist/typography.cjs +115 -0
  61. package/dist/typography.cjs.map +1 -0
  62. package/dist/typography.d.cts +3 -0
  63. package/dist/typography.d.cts.map +1 -0
  64. package/dist/typography.d.mts +3 -0
  65. package/dist/typography.d.mts.map +1 -0
  66. package/dist/typography.mjs +112 -0
  67. package/dist/typography.mjs.map +1 -0
  68. package/dist/typography.types.cjs +3 -0
  69. package/dist/typography.types.cjs.map +1 -0
  70. package/dist/typography.types.d.cts +70 -0
  71. package/dist/typography.types.d.cts.map +1 -0
  72. package/dist/typography.types.d.mts +70 -0
  73. package/dist/typography.types.d.mts.map +1 -0
  74. package/dist/typography.types.mjs +2 -0
  75. package/dist/typography.types.mjs.map +1 -0
  76. package/package.json +83 -0
@@ -0,0 +1,112 @@
1
+ import { typography } from "@metamask/design-tokens";
2
+ export const typographyTailwindConfig = {
3
+ fontSize: {
4
+ 'display-lg': [
5
+ typography.sDisplayLG.fontSize.toString(),
6
+ {
7
+ lineHeight: `${typography.sDisplayLG.lineHeight}px`,
8
+ letterSpacing: `${typography.sDisplayLG.letterSpacing}`,
9
+ fontWeight: typography.sDisplayLG.fontWeight,
10
+ },
11
+ ],
12
+ 'display-md': [
13
+ typography.sDisplayMD.fontSize.toString(),
14
+ {
15
+ lineHeight: `${typography.sDisplayMD.lineHeight}px`,
16
+ letterSpacing: `${typography.sDisplayMD.letterSpacing}`,
17
+ fontWeight: typography.sDisplayMD.fontWeight,
18
+ },
19
+ ],
20
+ 'heading-lg': [
21
+ typography.sHeadingLG.fontSize.toString(),
22
+ {
23
+ lineHeight: `${typography.sHeadingLG.lineHeight}px`,
24
+ letterSpacing: `${typography.sHeadingLG.letterSpacing}`,
25
+ fontWeight: typography.sHeadingLG.fontWeight,
26
+ },
27
+ ],
28
+ 'heading-md': [
29
+ typography.sHeadingMD.fontSize.toString(),
30
+ {
31
+ lineHeight: `${typography.sHeadingMD.lineHeight}px`,
32
+ letterSpacing: `${typography.sHeadingMD.letterSpacing}`,
33
+ fontWeight: typography.sHeadingMD.fontWeight,
34
+ },
35
+ ],
36
+ 'heading-sm': [
37
+ typography.sHeadingSM.fontSize.toString(),
38
+ {
39
+ lineHeight: `${typography.sHeadingSM.lineHeight}px`,
40
+ letterSpacing: `${typography.sHeadingSM.letterSpacing}`,
41
+ fontWeight: typography.sHeadingSM.fontWeight,
42
+ },
43
+ ],
44
+ 'body-lg': [
45
+ typography.sBodyLGMedium.fontSize.toString(),
46
+ {
47
+ lineHeight: `${typography.sBodyLGMedium.lineHeight}px`,
48
+ letterSpacing: `${typography.sBodyLGMedium.letterSpacing}`,
49
+ fontWeight: typography.sBodyLGMedium.fontWeight,
50
+ },
51
+ ],
52
+ 'body-md': [
53
+ typography.sBodyMD.fontSize.toString(),
54
+ {
55
+ lineHeight: `${typography.sBodyMD.lineHeight}px`,
56
+ letterSpacing: `${typography.sBodyMD.letterSpacing}`,
57
+ fontWeight: typography.sBodyMD.fontWeight,
58
+ },
59
+ ],
60
+ 'body-sm': [
61
+ typography.sBodySM.fontSize.toString(),
62
+ {
63
+ lineHeight: `${typography.sBodySM.lineHeight}px`,
64
+ letterSpacing: `${typography.sBodySM.letterSpacing}`,
65
+ fontWeight: typography.sBodySM.fontWeight,
66
+ },
67
+ ],
68
+ 'body-xs': [
69
+ typography.sBodyXS.fontSize.toString(),
70
+ {
71
+ lineHeight: `${typography.sBodyXS.lineHeight}px`,
72
+ letterSpacing: `${typography.sBodyXS.letterSpacing}`,
73
+ fontWeight: typography.sBodyXS.fontWeight,
74
+ },
75
+ ],
76
+ },
77
+ fontFamily: {
78
+ 'default-regular': 'Geist-Regular',
79
+ 'default-regular-italic': 'Geist-RegularItalic',
80
+ 'default-medium': 'Geist-Medium',
81
+ 'default-medium-italic': 'Geist-MediumItalic',
82
+ 'default-bold': 'Geist-Bold',
83
+ 'default-bold-italic': 'Geist-BoldItalic',
84
+ 'accent-regular': 'MMSans-Regular',
85
+ 'accent-medium': 'MMSans-Medium',
86
+ 'accent-bold': 'MMSans-Bold',
87
+ 'hero-regular': 'MMPoly-Regular',
88
+ },
89
+ letterSpacing: {
90
+ 'display-lg': `${typography.sDisplayLG.letterSpacing}`,
91
+ 'display-md': `${typography.sDisplayMD.letterSpacing}`,
92
+ 'heading-lg': `${typography.sHeadingLG.letterSpacing}`,
93
+ 'heading-md': `${typography.sHeadingMD.letterSpacing}`,
94
+ 'heading-sm': `${typography.sHeadingSM.letterSpacing}`,
95
+ 'body-lg': `${typography.sBodyLGMedium.letterSpacing}`,
96
+ 'body-md': `${typography.sBodyMD.letterSpacing}`,
97
+ 'body-sm': `${typography.sBodySM.letterSpacing}`,
98
+ 'body-xs': `${typography.sBodyXS.letterSpacing}`,
99
+ },
100
+ lineHeight: {
101
+ 'display-lg': `${typography.sDisplayLG.lineHeight}px`,
102
+ 'display-md': `${typography.sDisplayMD.lineHeight}px`,
103
+ 'heading-lg': `${typography.sHeadingLG.lineHeight}px`,
104
+ 'heading-md': `${typography.sHeadingMD.lineHeight}px`,
105
+ 'heading-sm': `${typography.sHeadingSM.lineHeight}px`,
106
+ 'body-lg': `${typography.sBodyLGMedium.lineHeight}px`,
107
+ 'body-md': `${typography.sBodyMD.lineHeight}px`,
108
+ 'body-sm': `${typography.sBodySM.lineHeight}px`,
109
+ 'body-xs': `${typography.sBodyXS.lineHeight}px`,
110
+ },
111
+ };
112
+ //# sourceMappingURL=typography.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.mjs","sourceRoot":"","sources":["../src/typography.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gCAAgC;AAIrD,MAAM,CAAC,MAAM,wBAAwB,GAAkC;IACrE,QAAQ,EAAE;QACR,YAAY,EAAE;YACZ,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACzC;gBACE,UAAU,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,UAAoB,IAAI;gBAC7D,aAAa,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,aAAuB,EAAE;gBACjE,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,UAAU;aAC7C;SACF;QACD,YAAY,EAAE;YACZ,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACzC;gBACE,UAAU,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,UAAoB,IAAI;gBAC7D,aAAa,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,aAAuB,EAAE;gBACjE,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,UAAU;aAC7C;SACF;QACD,YAAY,EAAE;YACZ,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACzC;gBACE,UAAU,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,UAAoB,IAAI;gBAC7D,aAAa,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,aAAuB,EAAE;gBACjE,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,UAAU;aAC7C;SACF;QACD,YAAY,EAAE;YACZ,UAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACzC;gBACE,U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D,YAAY,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,UAAoB,IAAI;QAC/D,YAAY,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,UAAoB,IAAI;QAC/D,YAAY,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,UAAoB,IAAI;QAC/D,YAAY,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,UAAoB,IAAI;QAC/D,SAAS,EAAE,GAAG,UAAU,CAAC,aAAa,CAAC,UAAoB,IAAI;QAC/D,SAAS,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC,UAAoB,IAAI;QACzD,SAAS,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC,UAAoB,IAAI;QACzD,SAAS,EAAE,GAAG,UAAU,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,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=typography.types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.types.cjs","sourceRoot":"","sources":["../src/typography.types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Different Typography variants to be used as twrnc classNames\n */\nexport type TypographyVariant =\n | 'display-lg'\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 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 *\n * @example\n * {\n * fontSize: {\n * 'display-md': {\n * fontFamily: 'Geist-Bold',\n * fontSize: '32',\n * fontWeight: '700',\n * letterSpacing: '0',\n * lineHeight: '40px',\n * },\n * },\n * fontFamily: {\n * sans: [\n * 'Geist',\n * 'Helvetica Neue',\n * 'Helvetica',\n * 'Arial',\n * 'sans-serif',\n * ],\n * 'display-md': 'Geist',\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 string,\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 'default-regular': string;\n 'default-regular-italic': string;\n 'default-medium': string;\n 'default-medium-italic': string;\n 'default-bold': string;\n 'default-bold-italic': string;\n 'accent-regular': string;\n 'accent-medium': string;\n 'accent-bold': string;\n 'hero-regular': string;\n };\n letterSpacing: Record<TypographyVariant, string>;\n lineHeight: Record<TypographyVariant, string>; // Make sure to include units - \"40px\" instead of \"40\"\n};\n"]}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Different Typography variants to be used as twrnc classNames
3
+ */
4
+ export type TypographyVariant = 'display-lg' | 'display-md' | 'heading-lg' | 'heading-md' | 'heading-sm' | 'body-lg' | 'body-md' | 'body-sm' | 'body-xs';
5
+ /**
6
+ * Different FontWeight and FontStyle to be used to calculate the FontFamily
7
+ * in getFontFamilyFromWeightAndStyle
8
+ */
9
+ export type FontWeight = '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | 'normal' | 'bold';
10
+ export type FontStyle = 'normal' | 'italic';
11
+ /**
12
+ * Props for TypographyTailwindConfig
13
+ *
14
+ * @example
15
+ * {
16
+ * fontSize: {
17
+ * 'display-md': {
18
+ * fontFamily: 'Geist-Bold',
19
+ * fontSize: '32',
20
+ * fontWeight: '700',
21
+ * letterSpacing: '0',
22
+ * lineHeight: '40px',
23
+ * },
24
+ * },
25
+ * fontFamily: {
26
+ * sans: [
27
+ * 'Geist',
28
+ * 'Helvetica Neue',
29
+ * 'Helvetica',
30
+ * 'Arial',
31
+ * 'sans-serif',
32
+ * ],
33
+ * 'display-md': 'Geist',
34
+ * },
35
+ * letterSpacing: {
36
+ * 'display-md': '0',
37
+ * },
38
+ * fontWeight: {
39
+ * 'display-md': '400',
40
+ * },
41
+ * lineHeight: {
42
+ * 'display-md': '40px',
43
+ * },
44
+ * }
45
+ */
46
+ export type TypographyTailwindConfigProps = {
47
+ fontSize: Record<TypographyVariant, [
48
+ string,
49
+ {
50
+ lineHeight: string;
51
+ letterSpacing: string;
52
+ fontWeight: string;
53
+ }
54
+ ]>;
55
+ fontFamily: {
56
+ 'default-regular': string;
57
+ 'default-regular-italic': string;
58
+ 'default-medium': string;
59
+ 'default-medium-italic': string;
60
+ 'default-bold': string;
61
+ 'default-bold-italic': string;
62
+ 'accent-regular': string;
63
+ 'accent-medium': string;
64
+ 'accent-bold': string;
65
+ 'hero-regular': string;
66
+ };
67
+ letterSpacing: Record<TypographyVariant, string>;
68
+ lineHeight: Record<TypographyVariant, string>;
69
+ };
70
+ //# sourceMappingURL=typography.types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.types.d.cts","sourceRoot":"","sources":["../src/typography.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,CAAC;AAEd;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;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,iBAAiB,EAAE,MAAM,CAAC;QAC1B,wBAAwB,EAAE,MAAM,CAAC;QACjC,gBAAgB,EAAE,MAAM,CAAC;QACzB,uBAAuB,EAAE,MAAM,CAAC;QAChC,cAAc,EAAE,MAAM,CAAC;QACvB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,gBAAgB,EAAE,MAAM,CAAC;QACzB,eAAe,EAAE,MAAM,CAAC;QACxB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,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,70 @@
1
+ /**
2
+ * Different Typography variants to be used as twrnc classNames
3
+ */
4
+ export type TypographyVariant = 'display-lg' | 'display-md' | 'heading-lg' | 'heading-md' | 'heading-sm' | 'body-lg' | 'body-md' | 'body-sm' | 'body-xs';
5
+ /**
6
+ * Different FontWeight and FontStyle to be used to calculate the FontFamily
7
+ * in getFontFamilyFromWeightAndStyle
8
+ */
9
+ export type FontWeight = '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | 'normal' | 'bold';
10
+ export type FontStyle = 'normal' | 'italic';
11
+ /**
12
+ * Props for TypographyTailwindConfig
13
+ *
14
+ * @example
15
+ * {
16
+ * fontSize: {
17
+ * 'display-md': {
18
+ * fontFamily: 'Geist-Bold',
19
+ * fontSize: '32',
20
+ * fontWeight: '700',
21
+ * letterSpacing: '0',
22
+ * lineHeight: '40px',
23
+ * },
24
+ * },
25
+ * fontFamily: {
26
+ * sans: [
27
+ * 'Geist',
28
+ * 'Helvetica Neue',
29
+ * 'Helvetica',
30
+ * 'Arial',
31
+ * 'sans-serif',
32
+ * ],
33
+ * 'display-md': 'Geist',
34
+ * },
35
+ * letterSpacing: {
36
+ * 'display-md': '0',
37
+ * },
38
+ * fontWeight: {
39
+ * 'display-md': '400',
40
+ * },
41
+ * lineHeight: {
42
+ * 'display-md': '40px',
43
+ * },
44
+ * }
45
+ */
46
+ export type TypographyTailwindConfigProps = {
47
+ fontSize: Record<TypographyVariant, [
48
+ string,
49
+ {
50
+ lineHeight: string;
51
+ letterSpacing: string;
52
+ fontWeight: string;
53
+ }
54
+ ]>;
55
+ fontFamily: {
56
+ 'default-regular': string;
57
+ 'default-regular-italic': string;
58
+ 'default-medium': string;
59
+ 'default-medium-italic': string;
60
+ 'default-bold': string;
61
+ 'default-bold-italic': string;
62
+ 'accent-regular': string;
63
+ 'accent-medium': string;
64
+ 'accent-bold': string;
65
+ 'hero-regular': string;
66
+ };
67
+ letterSpacing: Record<TypographyVariant, string>;
68
+ lineHeight: Record<TypographyVariant, string>;
69
+ };
70
+ //# sourceMappingURL=typography.types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.types.d.mts","sourceRoot":"","sources":["../src/typography.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,CAAC;AAEd;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;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,iBAAiB,EAAE,MAAM,CAAC;QAC1B,wBAAwB,EAAE,MAAM,CAAC;QACjC,gBAAgB,EAAE,MAAM,CAAC;QACzB,uBAAuB,EAAE,MAAM,CAAC;QAChC,cAAc,EAAE,MAAM,CAAC;QACvB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,gBAAgB,EAAE,MAAM,CAAC;QACzB,eAAe,EAAE,MAAM,CAAC;QACxB,aAAa,EAAE,MAAM,CAAC;QACtB,cAAc,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=typography.types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.types.mjs","sourceRoot":"","sources":["../src/typography.types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Different Typography variants to be used as twrnc classNames\n */\nexport type TypographyVariant =\n | 'display-lg'\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 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 *\n * @example\n * {\n * fontSize: {\n * 'display-md': {\n * fontFamily: 'Geist-Bold',\n * fontSize: '32',\n * fontWeight: '700',\n * letterSpacing: '0',\n * lineHeight: '40px',\n * },\n * },\n * fontFamily: {\n * sans: [\n * 'Geist',\n * 'Helvetica Neue',\n * 'Helvetica',\n * 'Arial',\n * 'sans-serif',\n * ],\n * 'display-md': 'Geist',\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 string,\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 'default-regular': string;\n 'default-regular-italic': string;\n 'default-medium': string;\n 'default-medium-italic': string;\n 'default-bold': string;\n 'default-bold-italic': string;\n 'accent-regular': string;\n 'accent-medium': string;\n 'accent-bold': string;\n 'hero-regular': string;\n };\n letterSpacing: Record<TypographyVariant, string>;\n lineHeight: Record<TypographyVariant, string>; // Make sure to include units - \"40px\" instead of \"40\"\n};\n"]}
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "@metamask/design-system-twrnc-preset",
3
+ "version": "0.1.0",
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
+ "import": {
22
+ "types": "./dist/index.d.mts",
23
+ "default": "./dist/index.mjs"
24
+ },
25
+ "require": {
26
+ "types": "./dist/index.d.cts",
27
+ "default": "./dist/index.cjs"
28
+ }
29
+ },
30
+ "./package.json": "./package.json"
31
+ },
32
+ "main": "./dist/index.cjs",
33
+ "types": "./dist/index.d.cts",
34
+ "files": [
35
+ "dist/"
36
+ ],
37
+ "scripts": {
38
+ "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
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",
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
+ "twrnc": "^4.5.1"
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": "^5.0.2",
57
+ "@metamask/design-tokens": "^8.0.0",
58
+ "@testing-library/react-native": "^12.8.1",
59
+ "@ts-bridge/cli": "^0.6.3",
60
+ "@types/babel__preset-env": "^7",
61
+ "@types/jest": "^27.4.1",
62
+ "@types/react-test-renderer": "^18",
63
+ "babel-jest": "^29.7.0",
64
+ "deepmerge": "^4.2.2",
65
+ "jest": "^29.7.0",
66
+ "metro-react-native-babel-preset": "^0.77.0",
67
+ "react": "^18.2.0",
68
+ "react-test-renderer": "^18.3.1",
69
+ "ts-jest": "^29.2.5",
70
+ "typescript": "~5.2.2"
71
+ },
72
+ "peerDependencies": {
73
+ "@metamask/design-tokens": "^8.0.0",
74
+ "react": "^18.2.0"
75
+ },
76
+ "engines": {
77
+ "node": "^18.18 || >=20"
78
+ },
79
+ "publishConfig": {
80
+ "access": "public",
81
+ "registry": "https://registry.npmjs.org/"
82
+ }
83
+ }