@bigbinary/neetoui-rn 0.0.8 → 0.0.9

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.
@@ -1,19 +1,20 @@
1
- import React from "react";
2
- import { TouchableOpacity, Text, StyleSheet } from "react-native";
1
+ import * as React from "react";
2
+ import { flexbox, space, border, buttonStyle } from "styled-system";
3
+ import styled from "styled-components/native";
3
4
 
4
- export const Button = ({ onPress, text }) => {
5
- return (
6
- <TouchableOpacity style={styles.container} onPress={onPress}>
7
- <Text style={styles.text}>{text}</Text>
8
- </TouchableOpacity>
9
- );
5
+ export const TouchableOpacity = styled.TouchableOpacity`
6
+ ${flexbox}
7
+ ${space}
8
+ ${border}
9
+ ${buttonStyle}
10
+ `;
11
+
12
+ export const Button = ({ children, ...rest }) => {
13
+ return <TouchableOpacity {...rest}>{children}</TouchableOpacity>;
10
14
  };
11
15
 
12
- const styles = StyleSheet.create({
13
- container: {
14
- paddingHorizontal: 16,
15
- paddingVertical: 8,
16
- backgroundColor: "violet",
17
- },
18
- text: { color: "black" },
19
- });
16
+ Button.defaultProps = {
17
+ variant: "primary",
18
+ p: 15,
19
+ alignItems: "center",
20
+ };
@@ -0,0 +1,14 @@
1
+ import { flexbox, space, border, color, layout } from "styled-system";
2
+ import styled from "styled-components/native";
3
+
4
+ export const Container = styled.View`
5
+ ${flexbox}
6
+ ${space}
7
+ ${border}
8
+ ${color}
9
+ ${layout}
10
+ `;
11
+
12
+ Container.defaultProps = {
13
+ color: "background.default",
14
+ };
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { Typography } from "./Typography";
3
+
4
+ // @component-group Typography Components
5
+
6
+ /**
7
+ * Body component is a build on top of typography component with some default fontFamilty and fontSize.
8
+ *
9
+ * ## Usage
10
+ * ```js
11
+ * import * as React from 'react';
12
+ * import { Body, Container } from '@bigbinary/neetoui-rn';
13
+ *
14
+ * export default function Main() {
15
+ * return (
16
+ * <Container>
17
+ * <Body>
18
+ * This is basic example of Body
19
+ * </Body>
20
+ * </Container>
21
+ * );
22
+ * }
23
+ *
24
+ * ```
25
+ *
26
+ * @extends StyledSystems props /styled-system
27
+ */
28
+
29
+ export const Body = ({ children, rest }) => {
30
+ return (
31
+ <Typography fontSize="body" fontFamily="regular" {...rest}>
32
+ {children}
33
+ </Typography>
34
+ );
35
+ };
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { Typography } from "./Typography";
3
+
4
+ // @component-group Typography Components
5
+
6
+ /**
7
+ * Callout component is a build on top of typography component with some default fontFamilty and fontSize.
8
+ *
9
+ * ## Usage
10
+ * ```js
11
+ * import * as React from 'react';
12
+ * import { Callout, Container } from '@bigbinary/neetoui-rn';
13
+ *
14
+ * export default function Main() {
15
+ * return (
16
+ * <Container>
17
+ * <Callout>
18
+ * This is basic example of Callout
19
+ * </Callout>
20
+ * </Container>
21
+ * );
22
+ * }
23
+ *
24
+ * ```
25
+ *
26
+ * @extends StyledSystems props /styled-system
27
+ */
28
+
29
+ export const Callout = ({ children, rest }) => {
30
+ return (
31
+ <Typography fontSize="callout" fontFamily="bold" {...rest}>
32
+ {children}
33
+ </Typography>
34
+ );
35
+ };
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { Typography } from "./Typography";
3
+
4
+ // @component-group Typography Components
5
+
6
+ /**
7
+ * Caption1 component is a build on top of typography component with some default fontFamilty and fontSize.
8
+ *
9
+ * ## Usage
10
+ * ```js
11
+ * import * as React from 'react';
12
+ * import { Caption1, Container } from '@bigbinary/neetoui-rn';
13
+ *
14
+ * export default function Main() {
15
+ * return (
16
+ * <Container>
17
+ * <Caption1>
18
+ * This is basic example of Caption1
19
+ * </Caption1>
20
+ * </Container>
21
+ * );
22
+ * }
23
+ *
24
+ * ```
25
+ *
26
+ * @extends StyledSystems props /styled-system
27
+ */
28
+
29
+ export const Caption1 = ({ children, rest }) => {
30
+ return (
31
+ <Typography fontSize="caption1" fontFamily="regular" {...rest}>
32
+ {children}
33
+ </Typography>
34
+ );
35
+ };
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { Typography } from "./Typography";
3
+
4
+ // @component-group Typography Components
5
+
6
+ /**
7
+ * Caption2 component is a build on top of typography component with some default fontFamilty and fontSize.
8
+ *
9
+ * ## Usage
10
+ * ```js
11
+ * import * as React from 'react';
12
+ * import { Caption2, Container } from '@bigbinary/neetoui-rn';
13
+ *
14
+ * export default function Main() {
15
+ * return (
16
+ * <Container>
17
+ * <Caption2>
18
+ * This is basic example of Caption2
19
+ * </Caption2>
20
+ * </Container>
21
+ * );
22
+ * }
23
+ *
24
+ * ```
25
+ *
26
+ * @extends StyledSystems props /styled-system
27
+ */
28
+
29
+ export const Caption2 = ({ children, ...rest }) => {
30
+ return (
31
+ <Typography fontSize="caption2" fontFamily="regular" {...rest}>
32
+ {children}
33
+ </Typography>
34
+ );
35
+ };
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { Typography } from "./Typography";
3
+
4
+ // @component-group Typography Components
5
+
6
+ /**
7
+ * Headline component is a build on top of typography component with some default fontFamilty and fontSize.
8
+ *
9
+ * ## Usage
10
+ * ```js
11
+ * import * as React from 'react';
12
+ * import { Headline, Container } from '@bigbinary/neetoui-rn';
13
+ *
14
+ * export default function Main() {
15
+ * return (
16
+ * <Container>
17
+ * <Headline>
18
+ * This is basic example of Headline
19
+ * </Headline>
20
+ * </Container>
21
+ * );
22
+ * }
23
+ *
24
+ * ```
25
+ *
26
+ * @extends StyledSystems props /styled-system
27
+ */
28
+
29
+ export const Headline = ({ children, rest }) => {
30
+ return (
31
+ <Typography fontSize="headline" fontFamily="bold" {...rest}>
32
+ {children}
33
+ </Typography>
34
+ );
35
+ };
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { Typography } from "./Typography";
3
+
4
+ // @component-group Typography Components
5
+
6
+ /**
7
+ * LargeTitle component is a build on top of typography component with some default fontFamilty and fontSize.
8
+ *
9
+ * ## Usage
10
+ * ```js
11
+ * import * as React from 'react';
12
+ * import { LargeTitle, Container } from '@bigbinary/neetoui-rn';
13
+ *
14
+ * export default function Main() {
15
+ * return (
16
+ * <Container>
17
+ * <LargeTitle>
18
+ * This is basic example of LargeTitle
19
+ * </LargeTitle>
20
+ * </Container>
21
+ * );
22
+ * }
23
+ *
24
+ * ```
25
+ *
26
+ * @extends StyledSystems props /styled-system
27
+ */
28
+
29
+ export const LargeTitle = ({ children, ...rest }) => {
30
+ return (
31
+ <Typography fontSize="largeTitle" fontFamily="bold" {...rest}>
32
+ {children}
33
+ </Typography>
34
+ );
35
+ };
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { Typography } from "./Typography";
3
+
4
+ // @component-group Typography Components
5
+
6
+ /**
7
+ * Title1 component is a build on top of typography component with some default fontFamilty and fontSize.
8
+ *
9
+ * ## Usage
10
+ * ```js
11
+ * import * as React from 'react';
12
+ * import { Title1, Container } from '@bigbinary/neetoui-rn';
13
+ *
14
+ * export default function Main() {
15
+ * return (
16
+ * <Container>
17
+ * <Title1>
18
+ * This is basic example of Title1
19
+ * </Title1>
20
+ * </Container>
21
+ * );
22
+ * }
23
+ *
24
+ * ```
25
+ *
26
+ * @extends StyledSystems props /styled-system
27
+ */
28
+
29
+ export const Title1 = ({ children, rest }) => {
30
+ return (
31
+ <Typography fontSize="title1" fontFamily="bold" {...rest}>
32
+ {children}
33
+ </Typography>
34
+ );
35
+ };
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { Typography } from "./Typography";
3
+
4
+ // @component-group Typography Components
5
+
6
+ /**
7
+ * Title2 component is a build on top of typography component with some default fontFamilty and fontSize.
8
+ *
9
+ * ## Usage
10
+ * ```js
11
+ * import * as React from 'react';
12
+ * import { Title2, Container } from '@bigbinary/neetoui-rn';
13
+ *
14
+ * export default function Main() {
15
+ * return (
16
+ * <Container>
17
+ * <Title2>
18
+ * This is basic example of Title2
19
+ * </Title2>
20
+ * </Container>
21
+ * );
22
+ * }
23
+ *
24
+ * ```
25
+ *
26
+ * @extends StyledSystems props /styled-system
27
+ */
28
+
29
+ export const Title2 = ({ children, rest }) => {
30
+ return (
31
+ <Typography fontSize="title2" fontFamily="bold" {...rest}>
32
+ {children}
33
+ </Typography>
34
+ );
35
+ };
@@ -0,0 +1,35 @@
1
+ import * as React from "react";
2
+ import { Typography } from "./Typography";
3
+
4
+ // @component-group Typography Components
5
+
6
+ /**
7
+ * Title3 component is a build on top of typography component with some default fontFamilty and fontSize.
8
+ *
9
+ * ## Usage
10
+ * ```js
11
+ * import * as React from 'react';
12
+ * import { Title3, Container } from '@bigbinary/neetoui-rn';
13
+ *
14
+ * export default function Main() {
15
+ * return (
16
+ * <Container>
17
+ * <Title3>
18
+ * This is basic example of Title3
19
+ * </Title3>
20
+ * </Container>
21
+ * );
22
+ * }
23
+ *
24
+ * ```
25
+ *
26
+ * @extends StyledSystems props /styled-system
27
+ */
28
+
29
+ export const Title3 = ({ children, rest }) => {
30
+ return (
31
+ <Typography fontSize="title3" fontFamily="regular" {...rest}>
32
+ {children}
33
+ </Typography>
34
+ );
35
+ };
@@ -0,0 +1,55 @@
1
+ import * as React from "react";
2
+ import styled from "styled-components/native";
3
+ import { space, layout, typography, color, textStyle } from "styled-system";
4
+
5
+ export const Text = styled.Text`
6
+ ${space}
7
+ ${layout}
8
+ ${typography}
9
+ ${color}
10
+ ${textStyle}
11
+ `;
12
+
13
+ // @component-group Typography Components
14
+
15
+ /**
16
+ * Typography component is a primitive text component built on top of styled-system.
17
+ *
18
+ * This component supports below props categories from [styled-system ](/styled-system)
19
+ *
20
+ * <ul>
21
+ * <li>space</li>
22
+ * <li>layout</li>
23
+ * <li>typography</li>
24
+ * <li>color</li>
25
+ * <li>textStyle</li>
26
+ * </ul>
27
+ *
28
+ * <div class="screenshots">
29
+ * <img src="screenshots/typography-all.png" />
30
+ * <img src="screenshots/typography-colors.png" />
31
+ * <img src="screenshots/typography-fonts.png" />
32
+ * </div>
33
+ *
34
+ * ## Usage
35
+ * ```js
36
+ * import * as React from 'react';
37
+ * import { Typography, Container } from '@bigbinary/neetoui-rn';
38
+ *
39
+ * export default function Main() {
40
+ * return (
41
+ * <Container>
42
+ * <Typography>
43
+ * This is basic example of Typography
44
+ * </Typography>
45
+ * </Container>
46
+ * );
47
+ * }
48
+ * ```
49
+ *
50
+ * @extends StyledSystems props /styled-system
51
+ */
52
+
53
+ export const Typography = ({ children, ...rest }) => {
54
+ return <Text {...rest}>{children}</Text>;
55
+ };
@@ -0,0 +1,13 @@
1
+ export { Button } from "./Button";
2
+ export { Container } from "./Container";
3
+
4
+ export { Typography } from "./Typography/Typography";
5
+ export { LargeTitle } from "./Typography/LargeTitle";
6
+ export { Title1 } from "./Typography/Title1";
7
+ export { Title2 } from "./Typography/Title2";
8
+ export { Title3 } from "./Typography/Title3";
9
+ export { Headline } from "./Typography/Headline";
10
+ export { Body } from "./Typography/Body";
11
+ export { Callout } from "./Typography/Callout";
12
+ export { Caption1 } from "./Typography/Caption1";
13
+ export { Caption2 } from "./Typography/Caption2";
@@ -0,0 +1,75 @@
1
+ import { moderateScale } from "react-native-size-matters";
2
+
3
+ const baseTheme = {
4
+ colors: {
5
+ font: {
6
+ default: "#FFFFFF",
7
+ base: "#2F3941",
8
+ primary: "#1B1F23",
9
+ secondary: "#676767",
10
+ danger: "#FE295C",
11
+ },
12
+ background: {
13
+ default: "#FFFFFF",
14
+ base: "#2F3941",
15
+ primary: "#E4E4E7",
16
+ secondary: "#E9EBED",
17
+ },
18
+ card: {
19
+ default: "#FFFFFF",
20
+ base: "#2F3941",
21
+ primary: "#F8F9F9",
22
+ secondary: "#E9EBED",
23
+ },
24
+ border: {
25
+ default: "#FFFFFF",
26
+ base: "#2F3941",
27
+ primary: "#E4E4E7",
28
+ danger: "#FE295C",
29
+ },
30
+ },
31
+ fonts: {
32
+ // We can add below commented fonts later as follows. Also add font faces in index.web.js for the web.
33
+ // https://www.bigbinary.com/learn-react-native/adding-custom-fonats
34
+
35
+ // thin: "Inter-Thin",
36
+ // extraLight: "Inter-ExtraLight",
37
+ // light: "Inter-Light",
38
+ // medium: "Inter-Medium",
39
+ // semiBold: "Inter-SemiBold",
40
+ // extraBold: "Inter-ExtraBold",
41
+ // black: "Inter-Black",
42
+
43
+ regular: "Inter-Regular",
44
+ bold: "Inter-Bold",
45
+ },
46
+ fontSizes: {
47
+ largeTitle: moderateScale(32),
48
+ title1: moderateScale(24),
49
+ title2: moderateScale(18),
50
+ title3: moderateScale(18),
51
+ headline: moderateScale(14),
52
+ body: moderateScale(14),
53
+ callout: moderateScale(12),
54
+ caption1: moderateScale(12),
55
+ caption2: moderateScale(10),
56
+ },
57
+ };
58
+
59
+ export const theme = {
60
+ ...baseTheme,
61
+ buttons: {
62
+ primary: {
63
+ color: baseTheme.colors.white,
64
+ backgroundColor: baseTheme.colors.grey800,
65
+ },
66
+ secondary: {
67
+ color: baseTheme.colors.grey800,
68
+ backgroundColor: baseTheme.colors.white,
69
+ },
70
+ disabled: {
71
+ color: baseTheme.colors.white,
72
+ backgroundColor: baseTheme.colors.grey,
73
+ },
74
+ },
75
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neetoui-rn",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "main": "lib/index.js",
5
5
  "author": "BigBinary",
6
6
  "license": "MIT",
@@ -11,6 +11,7 @@
11
11
  "test": "jest",
12
12
  "lint": "eslint .",
13
13
  "format": "prettier --write .",
14
+ "flow": "flow",
14
15
  "precommit": "lint-staged",
15
16
  "prestart": "sb-rn-get-stories",
16
17
  "storybook-watcher": "sb-rn-watcher",
@@ -58,6 +59,7 @@
58
59
  "@storybook/addon-ondevice-controls": "^6.0.1-alpha.6",
59
60
  "@storybook/addon-ondevice-knobs": "^5.3.25",
60
61
  "@storybook/addon-ondevice-notes": "^6.0.1-alpha.6",
62
+ "@storybook/addon-storyshots": "^6.3.12",
61
63
  "@storybook/addons": "^6.3.1",
62
64
  "@storybook/cli": "^6.3.12",
63
65
  "@storybook/react": "^6.3.12",
@@ -68,6 +70,7 @@
68
70
  "babel-loader": "^8.2.3",
69
71
  "babel-plugin-module-resolver": "^4.1.0",
70
72
  "babel-plugin-react-native-web": "^0.17.5",
73
+ "babel-plugin-transform-remove-console": "^6.9.4",
71
74
  "eslint": "7.14.0",
72
75
  "eslint-config-prettier": "^8.3.0",
73
76
  "eslint-import-resolver-babel-module": "^5.3.1",
@@ -81,29 +84,33 @@
81
84
  "html-webpack-plugin": "^5.5.0",
82
85
  "husky": "^7.0.4",
83
86
  "jest": "^26.6.3",
87
+ "lint-staged": "^12.0.3",
84
88
  "metro-react-native-babel-preset": "^0.66.2",
85
89
  "prettier": "^2.3.1",
86
90
  "react": "17.0.2",
87
91
  "react-dom": "17.0.2",
88
92
  "react-native": "0.66.2",
93
+ "react-native-size-matters": "^0.4.0",
89
94
  "react-native-storybook-loader": "^2.0.4",
90
95
  "react-native-web": "^0.17.5",
91
96
  "react-test-renderer": "17.0.2",
92
97
  "serve": "^13.0.2",
93
98
  "styled-components": "^5.3.3",
99
+ "styled-system": "^5.1.5",
94
100
  "url-loader": "^4.1.1",
95
101
  "webpack": "^5.61.0",
96
102
  "webpack-cli": "^4.9.1",
97
103
  "webpack-dev-server": "^4.4.0"
98
104
  },
99
105
  "jest": {
100
- "preset": "jest-expo",
106
+ "preset": "react-native",
107
+ "moduleDirectories": [
108
+ "node_modules"
109
+ ],
101
110
  "transformIgnorePatterns": [
102
- "node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base)"
111
+ "node_modules/(?!react-native)/"
103
112
  ],
104
- "setupFilesAfterEnv": [
105
- "<rootDir>/__mocks__/globalMock.js"
106
- ]
113
+ "testEnvironment": "jsdom"
107
114
  },
108
115
  "repository": {
109
116
  "type": "git",
@@ -124,5 +131,8 @@
124
131
  "pattern": "**/*.stories.js",
125
132
  "outputFile": "./storybook/storyLoader.js"
126
133
  }
134
+ },
135
+ "resolutions": {
136
+ "styled-components": "^5"
127
137
  }
128
138
  }
@@ -1,23 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
- import { Text } from "react-native";
4
-
5
- // const STYLES = {
6
- // h1: "h1",
7
- // h2: "h2",
8
- // h3: "h3",
9
- // h4: "h4",
10
- // h5: "h5",
11
- // h6: "h6",
12
- // body1: "body1",
13
- // body2: "body2",
14
- // body3: "body3",
15
- // };
16
-
17
- export const Typography = ({ label }) => {
18
- return <Text>{label}</Text>;
19
- };
20
-
21
- Typography.propTypes = {
22
- label: PropTypes.string,
23
- };
package/lib/index.js DELETED
@@ -1,2 +0,0 @@
1
- export { Typography } from "./components/Typography";
2
- export { Button } from "./components/Button";