@metamask-previews/design-system-react-native 0.0.0-preview.019292f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/LICENSE +20 -0
- package/README.md +15 -0
- package/dist/components/Text/Text.constants.d.ts +9 -0
- package/dist/components/Text/Text.constants.d.ts.map +1 -0
- package/dist/components/Text/Text.constants.js +21 -0
- package/dist/components/Text/Text.constants.js.map +1 -0
- package/dist/components/Text/Text.d.ts +12 -0
- package/dist/components/Text/Text.d.ts.map +1 -0
- package/dist/components/Text/Text.js +26 -0
- package/dist/components/Text/Text.js.map +1 -0
- package/dist/components/Text/Text.types.d.ts +100 -0
- package/dist/components/Text/Text.types.d.ts.map +1 -0
- package/dist/components/Text/Text.types.js +79 -0
- package/dist/components/Text/Text.types.js.map +1 -0
- package/dist/components/Text/Text.utilities.d.ts +30 -0
- package/dist/components/Text/Text.utilities.d.ts.map +1 -0
- package/dist/components/Text/Text.utilities.js +45 -0
- package/dist/components/Text/Text.utilities.js.map +1 -0
- package/dist/components/Text/index.d.ts +3 -0
- package/dist/components/Text/index.d.ts.map +1 -0
- package/dist/components/Text/index.js +14 -0
- package/dist/components/Text/index.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/package.json +76 -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-react-native`
|
|
2
|
+
|
|
3
|
+
Design System React Native
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
`yarn add @metamask/design-system-react-native`
|
|
8
|
+
|
|
9
|
+
or
|
|
10
|
+
|
|
11
|
+
`npm install @metamask/design-system-react-native`
|
|
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,9 @@
|
|
|
1
|
+
import type { TextProps } from './Text.types';
|
|
2
|
+
import { FontWeight, TextColor, TextVariant } from './Text.types';
|
|
3
|
+
export declare const DEFAULT_TEXT_VARIANT = TextVariant.BodyMd;
|
|
4
|
+
export declare const DEFAULT_TEXT_COLOR = TextColor.TextDefault;
|
|
5
|
+
export declare const MAPPING_FONTWEIGHT_TO_FONTFAMILYSTYLECLASSNAME: {
|
|
6
|
+
[key in FontWeight]: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const SAMPLE_TEXT_PROPS: TextProps;
|
|
9
|
+
//# sourceMappingURL=Text.constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.constants.d.ts","sourceRoot":"","sources":["../../../src/components/Text/Text.constants.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGlE,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AACvD,eAAO,MAAM,kBAAkB,wBAAwB,CAAC;AAGxD,eAAO,MAAM,8CAA8C,EAAE;KAC1D,GAAG,IAAI,UAAU,GAAG,MAAM;CAK5B,CAAC;AAGF,eAAO,MAAM,iBAAiB,EAAE,SAI/B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable import/prefer-default-export */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SAMPLE_TEXT_PROPS = exports.MAPPING_FONTWEIGHT_TO_FONTFAMILYSTYLECLASSNAME = exports.DEFAULT_TEXT_COLOR = exports.DEFAULT_TEXT_VARIANT = void 0;
|
|
5
|
+
const Text_types_1 = require("./Text.types");
|
|
6
|
+
// Defaults
|
|
7
|
+
exports.DEFAULT_TEXT_VARIANT = Text_types_1.TextVariant.BodyMd;
|
|
8
|
+
exports.DEFAULT_TEXT_COLOR = Text_types_1.TextColor.TextDefault;
|
|
9
|
+
// Mappings
|
|
10
|
+
exports.MAPPING_FONTWEIGHT_TO_FONTFAMILYSTYLECLASSNAME = {
|
|
11
|
+
[Text_types_1.FontWeight.Normal]: '',
|
|
12
|
+
[Text_types_1.FontWeight.Medium]: '-medium',
|
|
13
|
+
[Text_types_1.FontWeight.Bold]: '-bold',
|
|
14
|
+
};
|
|
15
|
+
// Sample consts
|
|
16
|
+
exports.SAMPLE_TEXT_PROPS = {
|
|
17
|
+
variant: exports.DEFAULT_TEXT_VARIANT,
|
|
18
|
+
children: 'Sample Text',
|
|
19
|
+
color: exports.DEFAULT_TEXT_COLOR,
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=Text.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.constants.js","sourceRoot":"","sources":["../../../src/components/Text/Text.constants.ts"],"names":[],"mappings":";AAAA,iDAAiD;;;AAGjD,6CAAkE;AAElE,WAAW;AACE,QAAA,oBAAoB,GAAG,wBAAW,CAAC,MAAM,CAAC;AAC1C,QAAA,kBAAkB,GAAG,sBAAS,CAAC,WAAW,CAAC;AAExD,WAAW;AACE,QAAA,8CAA8C,GAEvD;IACF,CAAC,uBAAU,CAAC,MAAM,CAAC,EAAE,EAAE;IACvB,CAAC,uBAAU,CAAC,MAAM,CAAC,EAAE,SAAS;IAC9B,CAAC,uBAAU,CAAC,IAAI,CAAC,EAAE,OAAO;CAC3B,CAAC;AAEF,gBAAgB;AACH,QAAA,iBAAiB,GAAc;IAC1C,OAAO,EAAE,4BAAoB;IAC7B,QAAQ,EAAE,aAAa;IACvB,KAAK,EAAE,0BAAkB;CAC1B,CAAC","sourcesContent":["/* eslint-disable import/prefer-default-export */\n\nimport type { TextProps } from './Text.types';\nimport { FontWeight, TextColor, TextVariant } from './Text.types';\n\n// Defaults\nexport const DEFAULT_TEXT_VARIANT = TextVariant.BodyMd;\nexport const DEFAULT_TEXT_COLOR = TextColor.TextDefault;\n\n// Mappings\nexport const MAPPING_FONTWEIGHT_TO_FONTFAMILYSTYLECLASSNAME: {\n [key in FontWeight]: string;\n} = {\n [FontWeight.Normal]: '',\n [FontWeight.Medium]: '-medium',\n [FontWeight.Bold]: '-bold',\n};\n\n// Sample consts\nexport const SAMPLE_TEXT_PROPS: TextProps = {\n variant: DEFAULT_TEXT_VARIANT,\n children: 'Sample Text',\n color: DEFAULT_TEXT_COLOR,\n};\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FontWeight, FontStyle } from './Text.types';
|
|
3
|
+
declare const _default: React.ForwardRefExoticComponent<{
|
|
4
|
+
variant?: import("./Text.types").TextVariant | undefined;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
color?: import("./Text.types").TextColor | undefined;
|
|
7
|
+
fontWeight?: FontWeight | undefined;
|
|
8
|
+
fontStyle?: FontStyle | undefined;
|
|
9
|
+
twClassName?: string | undefined;
|
|
10
|
+
} & import("react-native").TextProps & React.RefAttributes<any>>;
|
|
11
|
+
export default _default;
|
|
12
|
+
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/Text/Text.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;;;;;;;;;AAiCrD,wBAAuC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
const design_system_twrnc_preset_1 = require("@metamask-previews/design-system-twrnc-preset");
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const react_native_1 = require("react-native");
|
|
9
|
+
const Text_constants_1 = require("./Text.constants");
|
|
10
|
+
const Text_types_1 = require("./Text.types");
|
|
11
|
+
const Text_utilities_1 = require("./Text.utilities");
|
|
12
|
+
const Text = ({ variant = Text_constants_1.DEFAULT_TEXT_VARIANT, color = Text_constants_1.DEFAULT_TEXT_COLOR, style, children, fontWeight = Text_types_1.FontWeight.Normal, fontStyle = Text_types_1.FontStyle.Normal, twClassName = '', ...props }) => {
|
|
13
|
+
const tw = (0, design_system_twrnc_preset_1.useTailwind)();
|
|
14
|
+
const mergedClassnames = (0, Text_utilities_1.generateTextClassNames)({
|
|
15
|
+
variant,
|
|
16
|
+
color,
|
|
17
|
+
fontWeight,
|
|
18
|
+
fontStyle,
|
|
19
|
+
twClassName,
|
|
20
|
+
});
|
|
21
|
+
return (<react_native_1.Text accessibilityRole="text" {...props} style={[tw `${mergedClassnames}`, style]}>
|
|
22
|
+
{children}
|
|
23
|
+
</react_native_1.Text>);
|
|
24
|
+
};
|
|
25
|
+
exports.default = (0, design_system_twrnc_preset_1.withThemeProvider)(Text);
|
|
26
|
+
//# sourceMappingURL=Text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../src/components/Text/Text.tsx"],"names":[],"mappings":";;;;;AAAA,8FAGuD;AACvD,kDAA0B;AAC1B,+CAA8C;AAE9C,qDAA4E;AAE5E,6CAAqD;AACrD,qDAA0D;AAE1D,MAAM,IAAI,GAAwB,CAAC,EACjC,OAAO,GAAG,qCAAoB,EAC9B,KAAK,GAAG,mCAAkB,EAC1B,KAAK,EACL,QAAQ,EACR,UAAU,GAAG,uBAAU,CAAC,MAAM,EAC9B,SAAS,GAAG,sBAAS,CAAC,MAAM,EAC5B,WAAW,GAAG,EAAE,EAChB,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IACzB,MAAM,gBAAgB,GAAG,IAAA,uCAAsB,EAAC;QAC9C,OAAO;QACP,KAAK;QACL,UAAU;QACV,SAAS;QACT,WAAW;KACZ,CAAC,CAAC;IAEH,OAAO,CACL,CAAC,mBAAM,CACL,iBAAiB,CAAC,MAAM,CACxB,IAAI,KAAK,CAAC,CACV,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA,GAAG,gBAAgB,EAAE,EAAE,KAAK,CAAC,CAAC,CAExC;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,mBAAM,CAAC,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,IAAA,8CAAiB,EAAC,IAAI,CAAC,CAAC","sourcesContent":["import {\n useTailwind,\n withThemeProvider,\n} from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\nimport { Text as RNText } from 'react-native';\n\nimport { DEFAULT_TEXT_COLOR, DEFAULT_TEXT_VARIANT } from './Text.constants';\nimport type { TextProps } from './Text.types';\nimport { FontWeight, FontStyle } from './Text.types';\nimport { generateTextClassNames } from './Text.utilities';\n\nconst Text: React.FC<TextProps> = ({\n variant = DEFAULT_TEXT_VARIANT,\n color = DEFAULT_TEXT_COLOR,\n style,\n children,\n fontWeight = FontWeight.Normal,\n fontStyle = FontStyle.Normal,\n twClassName = '',\n ...props\n}) => {\n const tw = useTailwind();\n const mergedClassnames = generateTextClassNames({\n variant,\n color,\n fontWeight,\n fontStyle,\n twClassName,\n });\n\n return (\n <RNText\n accessibilityRole=\"text\"\n {...props}\n style={[tw`${mergedClassnames}`, style]}\n >\n {children}\n </RNText>\n );\n};\n\nexport default withThemeProvider(Text);\n"]}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { TextProps as RNTextProps } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* Text component variants.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum TextVariant {
|
|
6
|
+
DisplayMd = "display-md",
|
|
7
|
+
HeadingLg = "heading-lg",
|
|
8
|
+
HeadingMd = "heading-md",
|
|
9
|
+
HeadingSm = "heading-sm",
|
|
10
|
+
BodyLg = "body-lg",
|
|
11
|
+
BodyMd = "body-md",
|
|
12
|
+
BodySm = "body-sm",
|
|
13
|
+
BodyXs = "body-xs"
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Text colors
|
|
17
|
+
*/
|
|
18
|
+
export declare enum TextColor {
|
|
19
|
+
/** For default neutral text. */
|
|
20
|
+
TextDefault = "text-default",
|
|
21
|
+
/** For softer contrast neutral text */
|
|
22
|
+
TextAlternative = "text-alternative",
|
|
23
|
+
/** For the softest contrast neutral text (not accessible) */
|
|
24
|
+
TextMuted = "text-muted",
|
|
25
|
+
/** For elements used on top of overlay/alternative. Used for text, icon or border */
|
|
26
|
+
OverlayInverse = "overlay-inverse",
|
|
27
|
+
/** For interactive, active, and selected semantics. Used for text, background, icon or border */
|
|
28
|
+
PrimaryDefault = "primary-default",
|
|
29
|
+
/** For elements used on top of primary/default. Used for text, icon or border */
|
|
30
|
+
PrimaryInverse = "primary-inverse",
|
|
31
|
+
/** For the critical alert semantic elements. Used for text, background, icon or border */
|
|
32
|
+
ErrorDefault = "error-default",
|
|
33
|
+
/** For the stronger contrast error semantic elements. */
|
|
34
|
+
ErrorAlternative = "error-alternative",
|
|
35
|
+
/** For elements used on top of error/default. Used for text, icon or border */
|
|
36
|
+
ErrorInverse = "error-inverse",
|
|
37
|
+
/** For the positive semantic elements. Used for text, background, icon or border */
|
|
38
|
+
SuccessDefault = "success-default",
|
|
39
|
+
/** For elements used on top of success/default. Used for text, icon or border */
|
|
40
|
+
SuccessInverse = "success-inverse",
|
|
41
|
+
/** For the caution alert semantic elements. Used for text, background, icon or border */
|
|
42
|
+
WarningDefault = "warning-default",
|
|
43
|
+
/** For elements used on top of warning/default. Used for text, icon or border */
|
|
44
|
+
WarningInverse = "warning-inverse",
|
|
45
|
+
/** For informational read-only elements. Used for text, background, icon or border */
|
|
46
|
+
InfoDefault = "info-default",
|
|
47
|
+
/** For elements used on top of info/default. Used for text, icon or border */
|
|
48
|
+
InfoInverse = "info-inverse",
|
|
49
|
+
/** Make the text color transparent */
|
|
50
|
+
Transparent = "transparent"
|
|
51
|
+
}
|
|
52
|
+
export declare enum FontWeight {
|
|
53
|
+
/**
|
|
54
|
+
* Weight - 700
|
|
55
|
+
*/
|
|
56
|
+
Bold = "700",
|
|
57
|
+
/**
|
|
58
|
+
* Weight - 500
|
|
59
|
+
*/
|
|
60
|
+
Medium = "500",
|
|
61
|
+
/**
|
|
62
|
+
* Weight - 400
|
|
63
|
+
*/
|
|
64
|
+
Normal = "400"
|
|
65
|
+
}
|
|
66
|
+
export declare enum FontStyle {
|
|
67
|
+
Italic = "italic",
|
|
68
|
+
Normal = "normal"
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Text component props.
|
|
72
|
+
*/
|
|
73
|
+
export type TextProps = {
|
|
74
|
+
/**
|
|
75
|
+
* Optional enum to select between Typography variants.
|
|
76
|
+
* @default BodyMD
|
|
77
|
+
*/
|
|
78
|
+
variant?: TextVariant;
|
|
79
|
+
/**
|
|
80
|
+
* Text to be displayed.
|
|
81
|
+
*/
|
|
82
|
+
children: React.ReactNode;
|
|
83
|
+
/**
|
|
84
|
+
* Optional prop to add color to text.
|
|
85
|
+
*/
|
|
86
|
+
color?: TextColor;
|
|
87
|
+
/**
|
|
88
|
+
* Optional prop to adjust the weight of the font.
|
|
89
|
+
*/
|
|
90
|
+
fontWeight?: FontWeight;
|
|
91
|
+
/**
|
|
92
|
+
* Optional prop to adjust the style of the font.
|
|
93
|
+
*/
|
|
94
|
+
fontStyle?: FontStyle;
|
|
95
|
+
/**
|
|
96
|
+
* Optional prop to add twrnc overriding classNames.
|
|
97
|
+
*/
|
|
98
|
+
twClassName?: string;
|
|
99
|
+
} & RNTextProps;
|
|
100
|
+
//# sourceMappingURL=Text.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.types.d.ts","sourceRoot":"","sources":["../../../src/components/Text/Text.types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AAE7D;;GAEG;AACH,oBAAY,WAAW;IAErB,SAAS,eAAe;IAGxB,SAAS,eAAe;IACxB,SAAS,eAAe;IACxB,SAAS,eAAe;IAGxB,MAAM,YAAY;IAClB,MAAM,YAAY;IAClB,MAAM,YAAY;IAClB,MAAM,YAAY;CACnB;AAED;;GAEG;AACH,oBAAY,SAAS;IACnB,gCAAgC;IAChC,WAAW,iBAAiB;IAC5B,uCAAuC;IACvC,eAAe,qBAAqB;IACpC,6DAA6D;IAC7D,SAAS,eAAe;IACxB,qFAAqF;IACrF,cAAc,oBAAoB;IAClC,iGAAiG;IACjG,cAAc,oBAAoB;IAClC,iFAAiF;IACjF,cAAc,oBAAoB;IAClC,0FAA0F;IAC1F,YAAY,kBAAkB;IAC9B,yDAAyD;IACzD,gBAAgB,sBAAsB;IACtC,+EAA+E;IAC/E,YAAY,kBAAkB;IAC9B,oFAAoF;IACpF,cAAc,oBAAoB;IAClC,iFAAiF;IACjF,cAAc,oBAAoB;IAClC,yFAAyF;IACzF,cAAc,oBAAoB;IAClC,iFAAiF;IACjF,cAAc,oBAAoB;IAClC,sFAAsF;IACtF,WAAW,iBAAiB;IAC5B,8EAA8E;IAC9E,WAAW,iBAAiB;IAC5B,sCAAsC;IACtC,WAAW,gBAAgB;CAC5B;AAED,oBAAY,UAAU;IACpB;;OAEG;IACH,IAAI,QAAQ;IACZ;;OAEG;IACH,MAAM,QAAQ;IACd;;OAEG;IACH,MAAM,QAAQ;CACf;AAED,oBAAY,SAAS;IACnB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AACD;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,WAAW,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FontStyle = exports.FontWeight = exports.TextColor = exports.TextVariant = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Text component variants.
|
|
6
|
+
*/
|
|
7
|
+
var TextVariant;
|
|
8
|
+
(function (TextVariant) {
|
|
9
|
+
// Display Sizes
|
|
10
|
+
TextVariant["DisplayMd"] = "display-md";
|
|
11
|
+
// Heading Sizes
|
|
12
|
+
TextVariant["HeadingLg"] = "heading-lg";
|
|
13
|
+
TextVariant["HeadingMd"] = "heading-md";
|
|
14
|
+
TextVariant["HeadingSm"] = "heading-sm";
|
|
15
|
+
// Body Sizes
|
|
16
|
+
TextVariant["BodyLg"] = "body-lg";
|
|
17
|
+
TextVariant["BodyMd"] = "body-md";
|
|
18
|
+
TextVariant["BodySm"] = "body-sm";
|
|
19
|
+
TextVariant["BodyXs"] = "body-xs";
|
|
20
|
+
})(TextVariant || (exports.TextVariant = TextVariant = {}));
|
|
21
|
+
/**
|
|
22
|
+
* Text colors
|
|
23
|
+
*/
|
|
24
|
+
var TextColor;
|
|
25
|
+
(function (TextColor) {
|
|
26
|
+
/** For default neutral text. */
|
|
27
|
+
TextColor["TextDefault"] = "text-default";
|
|
28
|
+
/** For softer contrast neutral text */
|
|
29
|
+
TextColor["TextAlternative"] = "text-alternative";
|
|
30
|
+
/** For the softest contrast neutral text (not accessible) */
|
|
31
|
+
TextColor["TextMuted"] = "text-muted";
|
|
32
|
+
/** For elements used on top of overlay/alternative. Used for text, icon or border */
|
|
33
|
+
TextColor["OverlayInverse"] = "overlay-inverse";
|
|
34
|
+
/** For interactive, active, and selected semantics. Used for text, background, icon or border */
|
|
35
|
+
TextColor["PrimaryDefault"] = "primary-default";
|
|
36
|
+
/** For elements used on top of primary/default. Used for text, icon or border */
|
|
37
|
+
TextColor["PrimaryInverse"] = "primary-inverse";
|
|
38
|
+
/** For the critical alert semantic elements. Used for text, background, icon or border */
|
|
39
|
+
TextColor["ErrorDefault"] = "error-default";
|
|
40
|
+
/** For the stronger contrast error semantic elements. */
|
|
41
|
+
TextColor["ErrorAlternative"] = "error-alternative";
|
|
42
|
+
/** For elements used on top of error/default. Used for text, icon or border */
|
|
43
|
+
TextColor["ErrorInverse"] = "error-inverse";
|
|
44
|
+
/** For the positive semantic elements. Used for text, background, icon or border */
|
|
45
|
+
TextColor["SuccessDefault"] = "success-default";
|
|
46
|
+
/** For elements used on top of success/default. Used for text, icon or border */
|
|
47
|
+
TextColor["SuccessInverse"] = "success-inverse";
|
|
48
|
+
/** For the caution alert semantic elements. Used for text, background, icon or border */
|
|
49
|
+
TextColor["WarningDefault"] = "warning-default";
|
|
50
|
+
/** For elements used on top of warning/default. Used for text, icon or border */
|
|
51
|
+
TextColor["WarningInverse"] = "warning-inverse";
|
|
52
|
+
/** For informational read-only elements. Used for text, background, icon or border */
|
|
53
|
+
TextColor["InfoDefault"] = "info-default";
|
|
54
|
+
/** For elements used on top of info/default. Used for text, icon or border */
|
|
55
|
+
TextColor["InfoInverse"] = "info-inverse";
|
|
56
|
+
/** Make the text color transparent */
|
|
57
|
+
TextColor["Transparent"] = "transparent";
|
|
58
|
+
})(TextColor || (exports.TextColor = TextColor = {}));
|
|
59
|
+
var FontWeight;
|
|
60
|
+
(function (FontWeight) {
|
|
61
|
+
/**
|
|
62
|
+
* Weight - 700
|
|
63
|
+
*/
|
|
64
|
+
FontWeight["Bold"] = "700";
|
|
65
|
+
/**
|
|
66
|
+
* Weight - 500
|
|
67
|
+
*/
|
|
68
|
+
FontWeight["Medium"] = "500";
|
|
69
|
+
/**
|
|
70
|
+
* Weight - 400
|
|
71
|
+
*/
|
|
72
|
+
FontWeight["Normal"] = "400";
|
|
73
|
+
})(FontWeight || (exports.FontWeight = FontWeight = {}));
|
|
74
|
+
var FontStyle;
|
|
75
|
+
(function (FontStyle) {
|
|
76
|
+
FontStyle["Italic"] = "italic";
|
|
77
|
+
FontStyle["Normal"] = "normal";
|
|
78
|
+
})(FontStyle || (exports.FontStyle = FontStyle = {}));
|
|
79
|
+
//# sourceMappingURL=Text.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.types.js","sourceRoot":"","sources":["../../../src/components/Text/Text.types.ts"],"names":[],"mappings":";;;AAIA;;GAEG;AACH,IAAY,WAcX;AAdD,WAAY,WAAW;IACrB,gBAAgB;IAChB,uCAAwB,CAAA;IAExB,gBAAgB;IAChB,uCAAwB,CAAA;IACxB,uCAAwB,CAAA;IACxB,uCAAwB,CAAA;IAExB,aAAa;IACb,iCAAkB,CAAA;IAClB,iCAAkB,CAAA;IAClB,iCAAkB,CAAA;IAClB,iCAAkB,CAAA;AACpB,CAAC,EAdW,WAAW,2BAAX,WAAW,QActB;AAED;;GAEG;AACH,IAAY,SAiCX;AAjCD,WAAY,SAAS;IACnB,gCAAgC;IAChC,yCAA4B,CAAA;IAC5B,uCAAuC;IACvC,iDAAoC,CAAA;IACpC,6DAA6D;IAC7D,qCAAwB,CAAA;IACxB,qFAAqF;IACrF,+CAAkC,CAAA;IAClC,iGAAiG;IACjG,+CAAkC,CAAA;IAClC,iFAAiF;IACjF,+CAAkC,CAAA;IAClC,0FAA0F;IAC1F,2CAA8B,CAAA;IAC9B,yDAAyD;IACzD,mDAAsC,CAAA;IACtC,+EAA+E;IAC/E,2CAA8B,CAAA;IAC9B,oFAAoF;IACpF,+CAAkC,CAAA;IAClC,iFAAiF;IACjF,+CAAkC,CAAA;IAClC,yFAAyF;IACzF,+CAAkC,CAAA;IAClC,iFAAiF;IACjF,+CAAkC,CAAA;IAClC,sFAAsF;IACtF,yCAA4B,CAAA;IAC5B,8EAA8E;IAC9E,yCAA4B,CAAA;IAC5B,sCAAsC;IACtC,wCAA2B,CAAA;AAC7B,CAAC,EAjCW,SAAS,yBAAT,SAAS,QAiCpB;AAED,IAAY,UAaX;AAbD,WAAY,UAAU;IACpB;;OAEG;IACH,0BAAY,CAAA;IACZ;;OAEG;IACH,4BAAc,CAAA;IACd;;OAEG;IACH,4BAAc,CAAA;AAChB,CAAC,EAbW,UAAU,0BAAV,UAAU,QAarB;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,8BAAiB,CAAA;AACnB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB","sourcesContent":["/* eslint-disable @typescript-eslint/no-shadow */\n// Third party dependencies.\nimport type { TextProps as RNTextProps } from 'react-native';\n\n/**\n * Text component variants.\n */\nexport enum TextVariant {\n // Display Sizes\n DisplayMd = 'display-md',\n\n // Heading Sizes\n HeadingLg = 'heading-lg',\n HeadingMd = 'heading-md',\n HeadingSm = 'heading-sm',\n\n // Body Sizes\n BodyLg = 'body-lg',\n BodyMd = 'body-md',\n BodySm = 'body-sm',\n BodyXs = 'body-xs',\n}\n\n/**\n * Text colors\n */\nexport enum TextColor {\n /** For default neutral text. */\n TextDefault = 'text-default',\n /** For softer contrast neutral text */\n TextAlternative = 'text-alternative',\n /** For the softest contrast neutral text (not accessible) */\n TextMuted = 'text-muted',\n /** For elements used on top of overlay/alternative. Used for text, icon or border */\n OverlayInverse = 'overlay-inverse',\n /** For interactive, active, and selected semantics. Used for text, background, icon or border */\n PrimaryDefault = 'primary-default',\n /** For elements used on top of primary/default. Used for text, icon or border */\n PrimaryInverse = 'primary-inverse',\n /** For the critical alert semantic elements. Used for text, background, icon or border */\n ErrorDefault = 'error-default',\n /** For the stronger contrast error semantic elements. */\n ErrorAlternative = 'error-alternative',\n /** For elements used on top of error/default. Used for text, icon or border */\n ErrorInverse = 'error-inverse',\n /** For the positive semantic elements. Used for text, background, icon or border */\n SuccessDefault = 'success-default',\n /** For elements used on top of success/default. Used for text, icon or border */\n SuccessInverse = 'success-inverse',\n /** For the caution alert semantic elements. Used for text, background, icon or border */\n WarningDefault = 'warning-default',\n /** For elements used on top of warning/default. Used for text, icon or border */\n WarningInverse = 'warning-inverse',\n /** For informational read-only elements. Used for text, background, icon or border */\n InfoDefault = 'info-default',\n /** For elements used on top of info/default. Used for text, icon or border */\n InfoInverse = 'info-inverse',\n /** Make the text color transparent */\n Transparent = 'transparent',\n}\n\nexport enum FontWeight {\n /**\n * Weight - 700\n */\n Bold = '700',\n /**\n * Weight - 500\n */\n Medium = '500',\n /**\n * Weight - 400\n */\n Normal = '400',\n}\n\nexport enum FontStyle {\n Italic = 'italic',\n Normal = 'normal',\n}\n/**\n * Text component props.\n */\nexport type TextProps = {\n /**\n * Optional enum to select between Typography variants.\n * @default BodyMD\n */\n variant?: TextVariant;\n /**\n * Text to be displayed.\n */\n children: React.ReactNode;\n /**\n * Optional prop to add color to text.\n */\n color?: TextColor;\n /**\n * Optional prop to adjust the weight of the font.\n */\n fontWeight?: FontWeight;\n /**\n * Optional prop to adjust the style of the font.\n */\n fontStyle?: FontStyle;\n /**\n * Optional prop to add twrnc overriding classNames.\n */\n twClassName?: string;\n} & RNTextProps;\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { TextProps } from './Text.types';
|
|
2
|
+
/**
|
|
3
|
+
* Generates a combined string of Tailwind CSS class names for the Text component
|
|
4
|
+
* based on the provided props. This utility simplifies the process of combining
|
|
5
|
+
* typography, color, font weight, and style classes, ensuring consistency with the
|
|
6
|
+
* design system.
|
|
7
|
+
*
|
|
8
|
+
* @param variant - Specifies the typography variant (e.g., body, heading, display).
|
|
9
|
+
* @param color - Specifies the text color based on the design system's color tokens.
|
|
10
|
+
* @param fontWeight - Specifies the font weight (e.g., normal, bold).
|
|
11
|
+
* @param fontStyle - Specifies the font style (e.g., normal, italic).
|
|
12
|
+
* @param twClassName - Additional custom Tailwind class names to be appended to the generated classes.
|
|
13
|
+
* @returns A string of combined Tailwind CSS class names.
|
|
14
|
+
*
|
|
15
|
+
* Example:
|
|
16
|
+
* ```
|
|
17
|
+
* const classNames = generateClassNames({
|
|
18
|
+
* variant: TextVariant.BodyMd,
|
|
19
|
+
* color: TextColor.PrimaryDefault,
|
|
20
|
+
* fontWeight: FontWeight.Bold,
|
|
21
|
+
* fontStyle: FontStyle.Italic,
|
|
22
|
+
* twClassName: 'text-center underline',
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* console.log(classNames);
|
|
26
|
+
* // Output: "text-body-md font-body-md-bold-italic text-primary-default text-center underline"
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare const generateTextClassNames: ({ variant, color, fontWeight, fontStyle, twClassName, }: Partial<TextProps>) => string;
|
|
30
|
+
//# sourceMappingURL=Text.utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.utilities.d.ts","sourceRoot":"","sources":["../../../src/components/Text/Text.utilities.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,sBAAsB,4DAMhC,QAAQ,SAAS,CAAC,KAAG,MAavB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateTextClassNames = void 0;
|
|
4
|
+
/* eslint-disable jsdoc/check-param-names */
|
|
5
|
+
/* eslint-disable jsdoc/require-param */
|
|
6
|
+
const Text_constants_1 = require("./Text.constants");
|
|
7
|
+
const Text_types_1 = require("./Text.types");
|
|
8
|
+
/**
|
|
9
|
+
* Generates a combined string of Tailwind CSS class names for the Text component
|
|
10
|
+
* based on the provided props. This utility simplifies the process of combining
|
|
11
|
+
* typography, color, font weight, and style classes, ensuring consistency with the
|
|
12
|
+
* design system.
|
|
13
|
+
*
|
|
14
|
+
* @param variant - Specifies the typography variant (e.g., body, heading, display).
|
|
15
|
+
* @param color - Specifies the text color based on the design system's color tokens.
|
|
16
|
+
* @param fontWeight - Specifies the font weight (e.g., normal, bold).
|
|
17
|
+
* @param fontStyle - Specifies the font style (e.g., normal, italic).
|
|
18
|
+
* @param twClassName - Additional custom Tailwind class names to be appended to the generated classes.
|
|
19
|
+
* @returns A string of combined Tailwind CSS class names.
|
|
20
|
+
*
|
|
21
|
+
* Example:
|
|
22
|
+
* ```
|
|
23
|
+
* const classNames = generateClassNames({
|
|
24
|
+
* variant: TextVariant.BodyMd,
|
|
25
|
+
* color: TextColor.PrimaryDefault,
|
|
26
|
+
* fontWeight: FontWeight.Bold,
|
|
27
|
+
* fontStyle: FontStyle.Italic,
|
|
28
|
+
* twClassName: 'text-center underline',
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* console.log(classNames);
|
|
32
|
+
* // Output: "text-body-md font-body-md-bold-italic text-primary-default text-center underline"
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
const generateTextClassNames = ({ variant = Text_constants_1.DEFAULT_TEXT_VARIANT, color = Text_constants_1.DEFAULT_TEXT_COLOR, fontWeight = Text_types_1.FontWeight.Normal, fontStyle = Text_types_1.FontStyle.Normal, twClassName = '', }) => {
|
|
36
|
+
const fontWeightStyleClassname = Text_constants_1.MAPPING_FONTWEIGHT_TO_FONTFAMILYSTYLECLASSNAME[fontWeight];
|
|
37
|
+
const isItalic = fontStyle === Text_types_1.FontStyle.Italic;
|
|
38
|
+
const textClassname = `text-${variant}`;
|
|
39
|
+
const fontFamilyClassname = `font-${variant}${fontWeightStyleClassname}${isItalic ? '-italic' : ''}`;
|
|
40
|
+
const textColorClassname = `text-${color}`;
|
|
41
|
+
const mergedClassnames = `${textClassname} ${fontFamilyClassname} ${textColorClassname} ${twClassName}`.trim();
|
|
42
|
+
return mergedClassnames;
|
|
43
|
+
};
|
|
44
|
+
exports.generateTextClassNames = generateTextClassNames;
|
|
45
|
+
//# sourceMappingURL=Text.utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.utilities.js","sourceRoot":"","sources":["../../../src/components/Text/Text.utilities.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,wCAAwC;AACxC,qDAI0B;AAE1B,6CAAqD;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACI,MAAM,sBAAsB,GAAG,CAAC,EACrC,OAAO,GAAG,qCAAoB,EAC9B,KAAK,GAAG,mCAAkB,EAC1B,UAAU,GAAG,uBAAU,CAAC,MAAM,EAC9B,SAAS,GAAG,sBAAS,CAAC,MAAM,EAC5B,WAAW,GAAG,EAAE,GACG,EAAU,EAAE;IAC/B,MAAM,wBAAwB,GAC5B,+DAA8C,CAAC,UAAU,CAAC,CAAC;IAC7D,MAAM,QAAQ,GAAG,SAAS,KAAK,sBAAS,CAAC,MAAM,CAAC;IAChD,MAAM,aAAa,GAAG,QAAQ,OAAO,EAAE,CAAC;IACxC,MAAM,mBAAmB,GAAG,QAAQ,OAAO,GAAG,wBAAwB,GACpE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EACzB,EAAE,CAAC;IACH,MAAM,kBAAkB,GAAG,QAAQ,KAAK,EAAE,CAAC;IAC3C,MAAM,gBAAgB,GACpB,GAAG,aAAa,IAAI,mBAAmB,IAAI,kBAAkB,IAAI,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IAExF,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAnBW,QAAA,sBAAsB,0BAmBjC","sourcesContent":["/* eslint-disable jsdoc/check-param-names */\n/* eslint-disable jsdoc/require-param */\nimport {\n DEFAULT_TEXT_COLOR,\n DEFAULT_TEXT_VARIANT,\n MAPPING_FONTWEIGHT_TO_FONTFAMILYSTYLECLASSNAME,\n} from './Text.constants';\nimport type { TextProps } from './Text.types';\nimport { FontWeight, FontStyle } from './Text.types';\n\n/**\n * Generates a combined string of Tailwind CSS class names for the Text component\n * based on the provided props. This utility simplifies the process of combining\n * typography, color, font weight, and style classes, ensuring consistency with the\n * design system.\n *\n * @param variant - Specifies the typography variant (e.g., body, heading, display).\n * @param color - Specifies the text color based on the design system's color tokens.\n * @param fontWeight - Specifies the font weight (e.g., normal, bold).\n * @param fontStyle - Specifies the font style (e.g., normal, italic).\n * @param twClassName - Additional custom Tailwind class names to be appended to the generated classes.\n * @returns A string of combined Tailwind CSS class names.\n *\n * Example:\n * ```\n * const classNames = generateClassNames({\n * variant: TextVariant.BodyMd,\n * color: TextColor.PrimaryDefault,\n * fontWeight: FontWeight.Bold,\n * fontStyle: FontStyle.Italic,\n * twClassName: 'text-center underline',\n * });\n *\n * console.log(classNames);\n * // Output: \"text-body-md font-body-md-bold-italic text-primary-default text-center underline\"\n * ```\n */\nexport const generateTextClassNames = ({\n variant = DEFAULT_TEXT_VARIANT,\n color = DEFAULT_TEXT_COLOR,\n fontWeight = FontWeight.Normal,\n fontStyle = FontStyle.Normal,\n twClassName = '',\n}: Partial<TextProps>): string => {\n const fontWeightStyleClassname =\n MAPPING_FONTWEIGHT_TO_FONTFAMILYSTYLECLASSNAME[fontWeight];\n const isItalic = fontStyle === FontStyle.Italic;\n const textClassname = `text-${variant}`;\n const fontFamilyClassname = `font-${variant}${fontWeightStyleClassname}${\n isItalic ? '-italic' : ''\n }`;\n const textColorClassname = `text-${color}`;\n const mergedClassnames =\n `${textClassname} ${fontFamilyClassname} ${textColorClassname} ${twClassName}`.trim();\n\n return mergedClassnames;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Text/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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.FontStyle = exports.FontWeight = exports.TextColor = exports.TextVariant = exports.default = void 0;
|
|
7
|
+
var Text_1 = require("./Text");
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Text_1).default; } });
|
|
9
|
+
var Text_types_1 = require("./Text.types");
|
|
10
|
+
Object.defineProperty(exports, "TextVariant", { enumerable: true, get: function () { return Text_types_1.TextVariant; } });
|
|
11
|
+
Object.defineProperty(exports, "TextColor", { enumerable: true, get: function () { return Text_types_1.TextColor; } });
|
|
12
|
+
Object.defineProperty(exports, "FontWeight", { enumerable: true, get: function () { return Text_types_1.FontWeight; } });
|
|
13
|
+
Object.defineProperty(exports, "FontStyle", { enumerable: true, get: function () { return Text_types_1.FontStyle; } });
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Text/index.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAiC;AAAxB,gHAAA,OAAO,OAAA;AAChB,2CAA6E;AAApE,yGAAA,WAAW,OAAA;AAAE,uGAAA,SAAS,OAAA;AAAE,wGAAA,UAAU,OAAA;AAAE,uGAAA,SAAS,OAAA","sourcesContent":["export { default } from './Text';\nexport { TextVariant, TextColor, FontWeight, FontStyle } from './Text.types';\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const Text: import("react").ForwardRefExoticComponent<Omit<{
|
|
2
|
+
variant?: import("./components/Text").TextVariant | undefined;
|
|
3
|
+
children: import("react").ReactNode;
|
|
4
|
+
color?: import("./components/Text").TextColor | undefined;
|
|
5
|
+
fontWeight?: import("./components/Text").FontWeight | undefined;
|
|
6
|
+
fontStyle?: import("./components/Text").FontStyle | undefined;
|
|
7
|
+
twClassName?: string | undefined;
|
|
8
|
+
} & import("react-native").TextProps & import("react").RefAttributes<any>, "ref"> & import("react").RefAttributes<any>>;
|
|
9
|
+
export { TextVariant, TextColor, FontWeight, FontStyle, } from './components/Text';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,IAAI;;;;;;;uHAAmC,CAAC;AACrD,OAAO,EACL,WAAW,EACX,SAAS,EACT,UAAU,EACV,SAAS,GACV,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
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.FontStyle = exports.FontWeight = exports.TextColor = exports.TextVariant = exports.Text = void 0;
|
|
7
|
+
const design_system_twrnc_preset_1 = require("@metamask-previews/design-system-twrnc-preset");
|
|
8
|
+
const Text_1 = __importDefault(require("./components/Text"));
|
|
9
|
+
exports.Text = (0, design_system_twrnc_preset_1.withThemeProvider)(Text_1.default);
|
|
10
|
+
var Text_2 = require("./components/Text");
|
|
11
|
+
Object.defineProperty(exports, "TextVariant", { enumerable: true, get: function () { return Text_2.TextVariant; } });
|
|
12
|
+
Object.defineProperty(exports, "TextColor", { enumerable: true, get: function () { return Text_2.TextColor; } });
|
|
13
|
+
Object.defineProperty(exports, "FontWeight", { enumerable: true, get: function () { return Text_2.FontWeight; } });
|
|
14
|
+
Object.defineProperty(exports, "FontStyle", { enumerable: true, get: function () { return Text_2.FontStyle; } });
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,8FAAkF;AAElF,6DAA8C;AAEjC,QAAA,IAAI,GAAG,IAAA,8CAAiB,EAAC,cAAa,CAAC,CAAC;AACrD,0CAK2B;AAJzB,mGAAA,WAAW,OAAA;AACX,iGAAA,SAAS,OAAA;AACT,kGAAA,UAAU,OAAA;AACV,iGAAA,SAAS,OAAA","sourcesContent":["import { withThemeProvider } from '@metamask-previews/design-system-twrnc-preset';\n\nimport TextComponent from './components/Text';\n\nexport const Text = withThemeProvider(TextComponent);\nexport {\n TextVariant,\n TextColor,\n FontWeight,\n FontStyle,\n} from './components/Text';\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@metamask-previews/design-system-react-native",
|
|
3
|
+
"version": "0.0.0-preview.019292f",
|
|
4
|
+
"description": "Design System React Native",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"MetaMask",
|
|
7
|
+
"Ethereum"
|
|
8
|
+
],
|
|
9
|
+
"homepage": "https://github.com/MetaMask/metamask-design-system/tree/main/packages/design-system-react-native#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.ts",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"files": [
|
|
31
|
+
"dist/"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "rm -rf tsconfig.build.tsbuildinfo dist && tsc --project tsconfig.build.json",
|
|
35
|
+
"changelog:update": "../../scripts/update-changelog.sh @metamask/design-system-react-native",
|
|
36
|
+
"changelog:validate": "../../scripts/validate-changelog.sh @metamask/design-system-react-native",
|
|
37
|
+
"publish:preview": "yarn npm publish --tag preview",
|
|
38
|
+
"since-latest-release": "../../scripts/since-latest-release.sh",
|
|
39
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter",
|
|
40
|
+
"test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache",
|
|
41
|
+
"test:verbose": "NODE_OPTIONS=--experimental-vm-modules jest --verbose",
|
|
42
|
+
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@metamask-previews/design-system-twrnc-preset": "0.0.0-preview.019292f",
|
|
46
|
+
"react": "^18.2.0",
|
|
47
|
+
"react-native": "^0.72.15"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@babel/core": "^7.23.5",
|
|
51
|
+
"@babel/preset-env": "^7.26.0",
|
|
52
|
+
"@babel/preset-react": "^7.25.9",
|
|
53
|
+
"@babel/preset-typescript": "^7.23.3",
|
|
54
|
+
"@metamask/auto-changelog": "^3.4.4",
|
|
55
|
+
"@storybook/react-native": "6.5",
|
|
56
|
+
"@testing-library/react-native": "^12.8.1",
|
|
57
|
+
"@types/babel__preset-env": "^7",
|
|
58
|
+
"@types/jest": "^27.4.1",
|
|
59
|
+
"@types/react": "^18.2.0",
|
|
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
|
+
"engines": {
|
|
70
|
+
"node": "^18.18 || >=20"
|
|
71
|
+
},
|
|
72
|
+
"publishConfig": {
|
|
73
|
+
"access": "public",
|
|
74
|
+
"registry": "https://registry.npmjs.org/"
|
|
75
|
+
}
|
|
76
|
+
}
|