@metamask-previews/design-system-react-native 0.0.0-preview.31cc4ac → 0.0.0-preview.3ab3ce4

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 (77) hide show
  1. package/dist/components/Icon/Icon.assets.d.ts +6 -0
  2. package/dist/components/Icon/Icon.assets.d.ts.map +1 -0
  3. package/dist/components/Icon/Icon.assets.js +324 -0
  4. package/dist/components/Icon/Icon.assets.js.map +1 -0
  5. package/dist/components/Icon/Icon.constants.d.ts +8 -0
  6. package/dist/components/Icon/Icon.constants.d.ts.map +1 -0
  7. package/dist/components/Icon/Icon.constants.js +22 -0
  8. package/dist/components/Icon/Icon.constants.js.map +1 -0
  9. package/dist/components/Icon/Icon.d.ts +5 -0
  10. package/dist/components/Icon/Icon.d.ts.map +1 -0
  11. package/dist/components/Icon/Icon.js +45 -0
  12. package/dist/components/Icon/Icon.js.map +1 -0
  13. package/dist/components/Icon/Icon.types.d.ts +254 -0
  14. package/dist/components/Icon/Icon.types.d.ts.map +1 -0
  15. package/dist/components/Icon/Icon.types.js +229 -0
  16. package/dist/components/Icon/Icon.types.js.map +1 -0
  17. package/dist/components/Icon/Icon.utilities.d.ts +22 -0
  18. package/dist/components/Icon/Icon.utilities.d.ts.map +1 -0
  19. package/dist/components/Icon/Icon.utilities.js +31 -0
  20. package/dist/components/Icon/Icon.utilities.js.map +1 -0
  21. package/dist/components/Icon/index.d.ts +4 -0
  22. package/dist/components/Icon/index.d.ts.map +1 -0
  23. package/dist/components/Icon/index.js +13 -0
  24. package/dist/components/Icon/index.js.map +1 -0
  25. package/dist/components/Text/Text.d.ts +3 -10
  26. package/dist/components/Text/Text.d.ts.map +1 -1
  27. package/dist/components/Text/Text.js +1 -1
  28. package/dist/components/Text/Text.js.map +1 -1
  29. package/dist/components/Text/Text.types.d.ts +39 -29
  30. package/dist/components/Text/Text.types.d.ts.map +1 -1
  31. package/dist/components/Text/Text.types.js +39 -29
  32. package/dist/components/Text/Text.types.js.map +1 -1
  33. package/dist/components/Text/Text.utilities.d.ts +1 -1
  34. package/dist/components/Text/Text.utilities.js +2 -2
  35. package/dist/components/Text/Text.utilities.js.map +1 -1
  36. package/dist/components/Text/index.d.ts +1 -0
  37. package/dist/components/Text/index.d.ts.map +1 -1
  38. package/dist/components/Text/index.js.map +1 -1
  39. package/dist/index.d.ts +2 -2
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/primitives/ButtonAnimated/ButtonAnimated.d.ts +5 -0
  42. package/dist/primitives/ButtonAnimated/ButtonAnimated.d.ts.map +1 -0
  43. package/dist/primitives/ButtonAnimated/ButtonAnimated.js +58 -0
  44. package/dist/primitives/ButtonAnimated/ButtonAnimated.js.map +1 -0
  45. package/dist/primitives/ButtonAnimated/ButtonAnimated.types.d.ts +6 -0
  46. package/dist/primitives/ButtonAnimated/ButtonAnimated.types.d.ts.map +1 -0
  47. package/dist/primitives/ButtonAnimated/ButtonAnimated.types.js +3 -0
  48. package/dist/primitives/ButtonAnimated/ButtonAnimated.types.js.map +1 -0
  49. package/dist/primitives/ButtonAnimated/index.d.ts +2 -0
  50. package/dist/primitives/ButtonAnimated/index.d.ts.map +1 -0
  51. package/dist/primitives/ButtonAnimated/index.js +9 -0
  52. package/dist/primitives/ButtonAnimated/index.js.map +1 -0
  53. package/dist/primitives/TextOrChildren/TextOrChildren.d.ts +5 -0
  54. package/dist/primitives/TextOrChildren/TextOrChildren.d.ts.map +1 -0
  55. package/dist/primitives/TextOrChildren/TextOrChildren.js +15 -0
  56. package/dist/primitives/TextOrChildren/TextOrChildren.js.map +1 -0
  57. package/dist/primitives/TextOrChildren/TextOrChildren.types.d.ts +15 -0
  58. package/dist/primitives/TextOrChildren/TextOrChildren.types.d.ts.map +1 -0
  59. package/dist/primitives/TextOrChildren/TextOrChildren.types.js +3 -0
  60. package/dist/primitives/TextOrChildren/TextOrChildren.types.js.map +1 -0
  61. package/dist/temp-components/Spinner/Spinner.constants.d.ts +3 -0
  62. package/dist/temp-components/Spinner/Spinner.constants.d.ts.map +1 -0
  63. package/dist/temp-components/Spinner/Spinner.constants.js +21 -0
  64. package/dist/temp-components/Spinner/Spinner.constants.js.map +1 -0
  65. package/dist/temp-components/Spinner/Spinner.d.ts +5 -0
  66. package/dist/temp-components/Spinner/Spinner.d.ts.map +1 -0
  67. package/dist/temp-components/Spinner/Spinner.js +68 -0
  68. package/dist/temp-components/Spinner/Spinner.js.map +1 -0
  69. package/dist/temp-components/Spinner/Spinner.types.d.ts +30 -0
  70. package/dist/temp-components/Spinner/Spinner.types.d.ts.map +1 -0
  71. package/dist/temp-components/Spinner/Spinner.types.js +3 -0
  72. package/dist/temp-components/Spinner/Spinner.types.js.map +1 -0
  73. package/dist/temp-components/Spinner/index.d.ts +3 -0
  74. package/dist/temp-components/Spinner/index.d.ts.map +1 -0
  75. package/dist/temp-components/Spinner/index.js +9 -0
  76. package/dist/temp-components/Spinner/index.js.map +1 -0
  77. package/package.json +11 -5
@@ -0,0 +1,68 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const design_system_twrnc_preset_1 = require("@metamask-previews/design-system-twrnc-preset");
30
+ const react_1 = __importStar(require("react"));
31
+ const react_native_1 = require("react-native");
32
+ const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
33
+ const Icon_1 = __importStar(require("../../components/Icon"));
34
+ const Text_1 = __importDefault(require("../../components/Text"));
35
+ const Spinner_constants_1 = require("./Spinner.constants");
36
+ const Spinner = ({ color = Spinner_constants_1.DEFAULT_SPINNER_PROPS.color, spinnerIconProps, loadingText, loadingTextProps, twClassName = '', ...props }) => {
37
+ const tw = (0, design_system_twrnc_preset_1.useTailwind)();
38
+ // Create a shared value for rotation
39
+ const rotation = (0, react_native_reanimated_1.useSharedValue)(0);
40
+ // Start the animation when the component mounts
41
+ (0, react_1.useEffect)(() => {
42
+ rotation.value = (0, react_native_reanimated_1.withRepeat)((0, react_native_reanimated_1.withTiming)(360, { duration: 1000, easing: react_native_reanimated_1.Easing.linear }), // Complete a full spin in 1 second
43
+ -1, // Infinite repetitions
44
+ false);
45
+ }, []);
46
+ // Define the animated style
47
+ const animatedStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
48
+ transform: [{ rotate: `${rotation.value % 360}deg` }],
49
+ }));
50
+ const finalSpinnerIconProps = {
51
+ ...Spinner_constants_1.DEFAULT_SPINNER_PROPS.spinnerIconProps,
52
+ name: Icon_1.IconName.Loading,
53
+ color,
54
+ ...spinnerIconProps,
55
+ };
56
+ const finalLoadingTextProps = {
57
+ ...Spinner_constants_1.DEFAULT_SPINNER_PROPS.loadingTextProps,
58
+ ...loadingTextProps,
59
+ };
60
+ return (<react_native_1.View style={tw `flex-row gap-x-2 items-center ${twClassName}`} testID="spinner" {...props}>
61
+ <react_native_reanimated_1.default.View style={[animatedStyle]} testID="spinner-animated-view">
62
+ <Icon_1.default {...finalSpinnerIconProps}/>
63
+ </react_native_reanimated_1.default.View>
64
+ {loadingText && <Text_1.default {...finalLoadingTextProps}>{loadingText}</Text_1.default>}
65
+ </react_native_1.View>);
66
+ };
67
+ exports.default = Spinner;
68
+ //# sourceMappingURL=Spinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../../../src/temp-components/Spinner/Spinner.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAA4E;AAC5E,+CAAyC;AACzC,+CAAoC;AACpC,mFAMiC;AAGjC,8DAAuD;AAEvD,iEAAyC;AACzC,2DAA4D;AAG5D,MAAM,OAAO,GAAG,CAAC,EACf,KAAK,GAAG,yCAAqB,CAAC,KAAK,EACnC,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,WAAW,GAAG,EAAE,EAChB,GAAG,KAAK,EACK,EAAE,EAAE;IACjB,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IAEzB,qCAAqC;IACrC,MAAM,QAAQ,GAAG,IAAA,wCAAc,EAAC,CAAC,CAAC,CAAC;IAEnC,gDAAgD;IAChD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,QAAQ,CAAC,KAAK,GAAG,IAAA,oCAAU,EACzB,IAAA,oCAAU,EAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,gCAAM,CAAC,MAAM,EAAE,CAAC,EAAE,mCAAmC;QAC/F,CAAC,CAAC,EAAE,uBAAuB;QAC3B,KAAK,CACN,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,4BAA4B;IAC5B,MAAM,aAAa,GAAG,IAAA,0CAAgB,EAAC,GAAG,EAAE,CAAC,CAAC;QAC5C,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,KAAK,GAAG,GAAG,KAAK,EAAE,CAAC;KACtD,CAAC,CAAC,CAAC;IAEJ,MAAM,qBAAqB,GAAc;QACvC,GAAG,yCAAqB,CAAC,gBAAgB;QACzC,IAAI,EAAE,eAAQ,CAAC,OAAO;QACtB,KAAK;QACL,GAAG,gBAAgB;KACpB,CAAC;IAEF,MAAM,qBAAqB,GAAuB;QAChD,GAAG,yCAAqB,CAAC,gBAAgB;QACzC,GAAG,gBAAgB;KACpB,CAAC;IAEF,OAAO,CACL,CAAC,mBAAI,CACH,KAAK,CAAC,CAAC,EAAE,CAAA,iCAAiC,WAAW,EAAE,CAAC,CACxD,MAAM,CAAC,SAAS,CAChB,IAAI,KAAK,CAAC,CAEV;MAAA,CAAC,iCAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,uBAAuB,CACnE;QAAA,CAAC,cAAI,CAAC,IAAI,qBAAqB,CAAC,EAClC;MAAA,EAAE,iCAAQ,CAAC,IAAI,CACf;MAAA,CAAC,WAAW,IAAI,CAAC,cAAI,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,cAAI,CAAC,CACvE;IAAA,EAAE,mBAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,OAAO,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, { useEffect } from 'react';\nimport { View } from 'react-native';\nimport Animated, {\n useSharedValue,\n useAnimatedStyle,\n withRepeat,\n withTiming,\n Easing,\n} from 'react-native-reanimated';\n\nimport type { IconProps } from '../../components/Icon';\nimport Icon, { IconName } from '../../components/Icon';\nimport type { TextProps } from '../../components/Text';\nimport Text from '../../components/Text';\nimport { DEFAULT_SPINNER_PROPS } from './Spinner.constants';\nimport type { SpinnerProps } from './Spinner.types';\n\nconst Spinner = ({\n color = DEFAULT_SPINNER_PROPS.color,\n spinnerIconProps,\n loadingText,\n loadingTextProps,\n twClassName = '',\n ...props\n}: SpinnerProps) => {\n const tw = useTailwind();\n\n // Create a shared value for rotation\n const rotation = useSharedValue(0);\n\n // Start the animation when the component mounts\n useEffect(() => {\n rotation.value = withRepeat(\n withTiming(360, { duration: 1000, easing: Easing.linear }), // Complete a full spin in 1 second\n -1, // Infinite repetitions\n false, // Do not reverse the animation\n );\n }, []);\n\n // Define the animated style\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ rotate: `${rotation.value % 360}deg` }],\n }));\n\n const finalSpinnerIconProps: IconProps = {\n ...DEFAULT_SPINNER_PROPS.spinnerIconProps,\n name: IconName.Loading,\n color,\n ...spinnerIconProps,\n };\n\n const finalLoadingTextProps: Partial<TextProps> = {\n ...DEFAULT_SPINNER_PROPS.loadingTextProps,\n ...loadingTextProps,\n };\n\n return (\n <View\n style={tw`flex-row gap-x-2 items-center ${twClassName}`}\n testID=\"spinner\"\n {...props}\n >\n <Animated.View style={[animatedStyle]} testID=\"spinner-animated-view\">\n <Icon {...finalSpinnerIconProps} />\n </Animated.View>\n {loadingText && <Text {...finalLoadingTextProps}>{loadingText}</Text>}\n </View>\n );\n};\n\nexport default Spinner;\n"]}
@@ -0,0 +1,30 @@
1
+ import type { ViewProps } from 'react-native';
2
+ import type { IconProps, IconColor } from '../../components/Icon';
3
+ import type { TextProps } from '../../components/Text/Text.types';
4
+ /**
5
+ * Spinner component props.
6
+ */
7
+ export type SpinnerProps = {
8
+ /**
9
+ * Optional prop that sets the color of the spinner icon using predefined theme colors
10
+ * @default IconColor.IconDefault
11
+ */
12
+ color?: IconColor;
13
+ /**
14
+ * Optional props to be passed to the loadingText element
15
+ */
16
+ spinnerIconProps?: Partial<IconProps>;
17
+ /**
18
+ * Optional text to display on the right of the spinner, providing additional context or information about the loading state.
19
+ */
20
+ loadingText?: string;
21
+ /**
22
+ * Optional props to be passed to the loadingText element
23
+ */
24
+ loadingTextProps?: Omit<Partial<TextProps>, 'children'>;
25
+ /**
26
+ * Optional prop to add twrnc overriding classNames.
27
+ */
28
+ twClassName?: string;
29
+ } & ViewProps;
30
+ //# sourceMappingURL=Spinner.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spinner.types.d.ts","sourceRoot":"","sources":["../../../src/temp-components/Spinner/Spinner.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IACtC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,gBAAgB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC,CAAC;IACxD;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=Spinner.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spinner.types.js","sourceRoot":"","sources":["../../../src/temp-components/Spinner/Spinner.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ViewProps } from 'react-native';\n\nimport type { IconProps, IconColor } from '../../components/Icon';\nimport type { TextProps } from '../../components/Text/Text.types';\n\n/**\n * Spinner component props.\n */\nexport type SpinnerProps = {\n /**\n * Optional prop that sets the color of the spinner icon using predefined theme colors\n * @default IconColor.IconDefault\n */\n color?: IconColor;\n /**\n * Optional props to be passed to the loadingText element\n */\n spinnerIconProps?: Partial<IconProps>;\n /**\n * Optional text to display on the right of the spinner, providing additional context or information about the loading state.\n */\n loadingText?: string;\n /**\n * Optional props to be passed to the loadingText element\n */\n loadingTextProps?: Omit<Partial<TextProps>, 'children'>;\n /**\n * Optional prop to add twrnc overriding classNames.\n */\n twClassName?: string;\n} & ViewProps;\n"]}
@@ -0,0 +1,3 @@
1
+ export { default } from './Spinner';
2
+ export type { SpinnerProps } from './Spinner.types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/temp-components/Spinner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,9 @@
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.default = void 0;
7
+ var Spinner_1 = require("./Spinner");
8
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(Spinner_1).default; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/temp-components/Spinner/index.ts"],"names":[],"mappings":";;;;;;AAAA,qCAAoC;AAA3B,mHAAA,OAAO,OAAA","sourcesContent":["export { default } from './Spinner';\nexport type { SpinnerProps } from './Spinner.types';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/design-system-react-native",
3
- "version": "0.0.0-preview.31cc4ac",
3
+ "version": "0.0.0-preview.3ab3ce4",
4
4
  "description": "Design System React Native",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -31,9 +31,10 @@
31
31
  "dist/"
32
32
  ],
33
33
  "scripts": {
34
- "build": "rm -rf tsconfig.build.tsbuildinfo dist && tsc --project tsconfig.build.json",
34
+ "build": "node scripts/build.js",
35
35
  "changelog:update": "../../scripts/update-changelog.sh @metamask/design-system-react-native",
36
36
  "changelog:validate": "../../scripts/validate-changelog.sh @metamask/design-system-react-native",
37
+ "generate-icons": "ts-node scripts/generate-icons.ts",
37
38
  "publish:preview": "yarn npm publish --tag preview",
38
39
  "since-latest-release": "../../scripts/since-latest-release.sh",
39
40
  "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter",
@@ -42,10 +43,10 @@
42
43
  "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
43
44
  },
44
45
  "dependencies": {
45
- "@metamask-previews/design-system-twrnc-preset": "0.0.0-preview.31cc4ac",
46
- "@types/react": "^18.2.0",
46
+ "@metamask-previews/design-system-twrnc-preset": "0.0.0-preview.3ab3ce4",
47
47
  "react": "^18.2.0",
48
- "react-native": "^0.72.15"
48
+ "react-native": "^0.72.15",
49
+ "react-native-reanimated": "3.3.0"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@babel/core": "^7.23.5",
@@ -57,13 +58,18 @@
57
58
  "@testing-library/react-native": "^12.8.1",
58
59
  "@types/babel__preset-env": "^7",
59
60
  "@types/jest": "^27.4.1",
61
+ "@types/node": "^16.18.54",
62
+ "@types/react": "^18.2.0",
60
63
  "@types/react-test-renderer": "^18",
61
64
  "babel-jest": "^29.7.0",
62
65
  "deepmerge": "^4.2.2",
63
66
  "jest": "^29.7.0",
64
67
  "metro-react-native-babel-preset": "^0.77.0",
68
+ "react-native-svg": "^15.10.1",
69
+ "react-native-svg-transformer": "^1.5.0",
65
70
  "react-test-renderer": "^18.3.1",
66
71
  "ts-jest": "^29.2.5",
72
+ "ts-node": "^10.9.1",
67
73
  "typescript": "~5.2.2"
68
74
  },
69
75
  "engines": {