@bigbinary/neetoui-rn 0.0.10 → 0.0.14

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/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  [![Netlify Status](https://api.netlify.com/api/v1/badges/1772e21c-61b9-4100-9b2e-9b0d1ce6a210/deploy-status)](https://app.netlify.com/sites/neetoui-rn/deploys)
2
+ [![Netlify Status](https://api.netlify.com/api/v1/badges/717761ba-353e-4417-9860-86e49b78ac36/deploy-status)](https://app.netlify.com/sites/neetoui-rn-docs/deploys)
2
3
 
3
4
  **NeetoUI-RN** is the library that drives the experience in all Neeto React
4
5
  Native products built at [BigBinary](https://www.bigbinary.com).
@@ -9,6 +10,18 @@ Native products built at [BigBinary](https://www.bigbinary.com).
9
10
  yarn add @bigbinary/neetoui-rn
10
11
  ```
11
12
 
13
+ To link the library, run:
14
+
15
+ ```sh
16
+ react-native link
17
+ ```
18
+
19
+ or
20
+
21
+ ```sh
22
+ npx react-native link
23
+ ```
24
+
12
25
  ## Development
13
26
 
14
27
  Install all the dependencies by executing following command.
@@ -28,15 +41,24 @@ You can use below commands for running storybook in different platforms:
28
41
  | iOS: | `yarn ios` |
29
42
  | Web | `yarn storybook-web` |
30
43
 
31
- ## Building
44
+ ## Auto Publish to NPM
32
45
 
33
46
  NeetoUI-RN version gets patched, auto-incremented and auto-published to npm on
34
47
  new commit to master. You can checkout the `publish` workflow in git actions to
35
48
  get a live update.
36
49
 
37
- Run `build-storybook-web` to build locally, this would create `storybook-static`
50
+ ## Building Storybook
51
+
52
+ Run `yarn build-react` to build storybook locally, this would create `dist`
38
53
  folder with static files.
39
54
 
55
+ Run `yarn serve` to serve storybook locally.
56
+
57
+ ## Building Component Documentation
58
+
59
+ Run `cd docs`, `yarn build` to build component documentation locally, this would
60
+ create `dist` folder with static files in `docs` folder.
61
+
40
62
  ## Documentation
41
63
 
42
64
  Read the docs here.
Binary file
Binary file
@@ -1,6 +1,8 @@
1
1
  import * as React from "react";
2
2
  import { flexbox, space, border, buttonStyle } from "styled-system";
3
3
  import styled from "styled-components/native";
4
+ import propTypes from "@styled-system/prop-types";
5
+ import PropTypes from "prop-types";
4
6
 
5
7
  export const TouchableOpacity = styled.TouchableOpacity`
6
8
  ${flexbox}
@@ -18,3 +20,11 @@ Button.defaultProps = {
18
20
  p: 15,
19
21
  alignItems: "center",
20
22
  };
23
+
24
+ Button.propTypes = {
25
+ ...propTypes.flexbox,
26
+ ...propTypes.space,
27
+ ...propTypes.border,
28
+ ...propTypes.buttonStyle,
29
+ children: PropTypes.node.isRequired,
30
+ };
@@ -1,7 +1,10 @@
1
+ import * as React from "react";
1
2
  import { flexbox, space, border, color, layout } from "styled-system";
2
3
  import styled from "styled-components/native";
4
+ import propTypes from "@styled-system/prop-types";
5
+ import PropTypes from "prop-types";
3
6
 
4
- export const Container = styled.View`
7
+ const View = styled.View`
5
8
  ${flexbox}
6
9
  ${space}
7
10
  ${border}
@@ -9,6 +12,19 @@ export const Container = styled.View`
9
12
  ${layout}
10
13
  `;
11
14
 
15
+ export const Container = ({ children, ...rest }) => {
16
+ return <View {...rest}>{children}</View>;
17
+ };
18
+
12
19
  Container.defaultProps = {
13
- color: "background.default",
20
+ color: "background.primary",
21
+ };
22
+
23
+ Container.propTypes = {
24
+ ...propTypes.flexbox,
25
+ ...propTypes.space,
26
+ ...propTypes.border,
27
+ ...propTypes.color,
28
+ ...propTypes.layout,
29
+ children: PropTypes.node.isRequired,
14
30
  };
@@ -1,10 +1,12 @@
1
1
  import * as React from "react";
2
+ import PropTypes from "prop-types";
3
+
2
4
  import { Typography } from "./Typography";
3
5
 
4
6
  // @component-group Typography Components
5
7
 
6
8
  /**
7
- * Body component is a build on top of typography component with some default fontFamilty and fontSize.
9
+ * Body component is built on top of typography component with default font family and font size.
8
10
  *
9
11
  * ## Usage
10
12
  * ```js
@@ -26,10 +28,15 @@ import { Typography } from "./Typography";
26
28
  * @extends StyledSystems props /styled-system
27
29
  */
28
30
 
29
- export const Body = ({ children, rest }) => {
31
+ export const Body = ({ children, ...rest }) => {
30
32
  return (
31
- <Typography fontSize="body" fontFamily="regular" {...rest}>
33
+ <Typography fontSize="body" {...rest}>
32
34
  {children}
33
35
  </Typography>
34
36
  );
35
37
  };
38
+
39
+ Body.propTypes = {
40
+ ...Typography.propTypes,
41
+ children: PropTypes.node.isRequired,
42
+ };
@@ -1,10 +1,12 @@
1
1
  import * as React from "react";
2
+ import PropTypes from "prop-types";
3
+
2
4
  import { Typography } from "./Typography";
3
5
 
4
6
  // @component-group Typography Components
5
7
 
6
8
  /**
7
- * Caption1 component is a build on top of typography component with some default fontFamilty and fontSize.
9
+ * Caption1 component is built on top of typography component with default font family and font size.
8
10
  *
9
11
  * ## Usage
10
12
  * ```js
@@ -26,10 +28,15 @@ import { Typography } from "./Typography";
26
28
  * @extends StyledSystems props /styled-system
27
29
  */
28
30
 
29
- export const Caption1 = ({ children, rest }) => {
31
+ export const Caption1 = ({ children, ...rest }) => {
30
32
  return (
31
- <Typography fontSize="caption1" fontFamily="regular" {...rest}>
33
+ <Typography fontSize="caption1" {...rest}>
32
34
  {children}
33
35
  </Typography>
34
36
  );
35
37
  };
38
+
39
+ Caption1.propTypes = {
40
+ ...Typography.propTypes,
41
+ children: PropTypes.node.isRequired,
42
+ };
@@ -1,10 +1,12 @@
1
1
  import * as React from "react";
2
+ import PropTypes from "prop-types";
3
+
2
4
  import { Typography } from "./Typography";
3
5
 
4
6
  // @component-group Typography Components
5
7
 
6
8
  /**
7
- * Caption2 component is a build on top of typography component with some default fontFamilty and fontSize.
9
+ * Caption2 component is built on top of typography component with default font family and font size.
8
10
  *
9
11
  * ## Usage
10
12
  * ```js
@@ -28,8 +30,13 @@ import { Typography } from "./Typography";
28
30
 
29
31
  export const Caption2 = ({ children, ...rest }) => {
30
32
  return (
31
- <Typography fontSize="caption2" fontFamily="regular" {...rest}>
33
+ <Typography fontSize="caption2" {...rest}>
32
34
  {children}
33
35
  </Typography>
34
36
  );
35
37
  };
38
+
39
+ Caption2.propTypes = {
40
+ ...Typography.propTypes,
41
+ children: PropTypes.node.isRequired,
42
+ };
@@ -1,10 +1,12 @@
1
1
  import * as React from "react";
2
+ import PropTypes from "prop-types";
3
+
2
4
  import { Typography } from "./Typography";
3
5
 
4
6
  // @component-group Typography Components
5
7
 
6
8
  /**
7
- * LargeTitle component is a build on top of typography component with some default fontFamilty and fontSize.
9
+ * LargeTitle component is built on top of typography component with default font family and font size.
8
10
  *
9
11
  * ## Usage
10
12
  * ```js
@@ -28,8 +30,13 @@ import { Typography } from "./Typography";
28
30
 
29
31
  export const LargeTitle = ({ children, ...rest }) => {
30
32
  return (
31
- <Typography fontSize="largeTitle" fontFamily="bold" {...rest}>
33
+ <Typography fontSize="largeTitle" {...rest}>
32
34
  {children}
33
35
  </Typography>
34
36
  );
35
37
  };
38
+
39
+ LargeTitle.propTypes = {
40
+ ...Typography.propTypes,
41
+ children: PropTypes.node.isRequired,
42
+ };
@@ -1,10 +1,12 @@
1
1
  import * as React from "react";
2
+ import PropTypes from "prop-types";
3
+
2
4
  import { Typography } from "./Typography";
3
5
 
4
6
  // @component-group Typography Components
5
7
 
6
8
  /**
7
- * Title1 component is a build on top of typography component with some default fontFamilty and fontSize.
9
+ * Title1 component is built on top of typography component with default font family and font size.
8
10
  *
9
11
  * ## Usage
10
12
  * ```js
@@ -26,10 +28,15 @@ import { Typography } from "./Typography";
26
28
  * @extends StyledSystems props /styled-system
27
29
  */
28
30
 
29
- export const Title1 = ({ children, rest }) => {
31
+ export const Title1 = ({ children, ...rest }) => {
30
32
  return (
31
- <Typography fontSize="title1" fontFamily="bold" {...rest}>
33
+ <Typography fontSize="title1" {...rest}>
32
34
  {children}
33
35
  </Typography>
34
36
  );
35
37
  };
38
+
39
+ Title1.propTypes = {
40
+ ...Typography.propTypes,
41
+ children: PropTypes.node.isRequired,
42
+ };
@@ -1,10 +1,12 @@
1
1
  import * as React from "react";
2
+ import PropTypes from "prop-types";
3
+
2
4
  import { Typography } from "./Typography";
3
5
 
4
6
  // @component-group Typography Components
5
7
 
6
8
  /**
7
- * Title2 component is a build on top of typography component with some default fontFamilty and fontSize.
9
+ * Title2 component is built on top of typography component with default font family and font size.
8
10
  *
9
11
  * ## Usage
10
12
  * ```js
@@ -26,10 +28,15 @@ import { Typography } from "./Typography";
26
28
  * @extends StyledSystems props /styled-system
27
29
  */
28
30
 
29
- export const Title2 = ({ children, rest }) => {
31
+ export const Title2 = ({ children, ...rest }) => {
30
32
  return (
31
- <Typography fontSize="title2" fontFamily="bold" {...rest}>
33
+ <Typography fontSize="title2" {...rest}>
32
34
  {children}
33
35
  </Typography>
34
36
  );
35
37
  };
38
+
39
+ Title2.propTypes = {
40
+ ...Typography.propTypes,
41
+ children: PropTypes.node.isRequired,
42
+ };
@@ -1,10 +1,20 @@
1
1
  import * as React from "react";
2
2
  import styled from "styled-components/native";
3
- import { space, layout, typography, color, textStyle } from "styled-system";
3
+ import {
4
+ space,
5
+ layout,
6
+ flexbox,
7
+ typography,
8
+ color,
9
+ textStyle,
10
+ } from "styled-system";
11
+ import propTypes from "@styled-system/prop-types";
12
+ import PropTypes from "prop-types";
4
13
 
5
14
  export const Text = styled.Text`
6
15
  ${space}
7
16
  ${layout}
17
+ ${flexbox}
8
18
  ${typography}
9
19
  ${color}
10
20
  ${textStyle}
@@ -13,13 +23,14 @@ export const Text = styled.Text`
13
23
  // @component-group Typography Components
14
24
 
15
25
  /**
16
- * Typography component is a primitive text component built on top of styled-system.
26
+ * Typography component is a primitive text component which is built on top of styled-system.
17
27
  *
18
- * This component supports below props categories from [styled-system ](/styled-system)
28
+ * This component supports below props categories from [styled-system ](/styled-system).
19
29
  *
20
30
  * <ul>
21
31
  * <li>space</li>
22
32
  * <li>layout</li>
33
+ * <li>flexbox</li>
23
34
  * <li>typography</li>
24
35
  * <li>color</li>
25
36
  * <li>textStyle</li>
@@ -53,3 +64,17 @@ export const Text = styled.Text`
53
64
  export const Typography = ({ children, ...rest }) => {
54
65
  return <Text {...rest}>{children}</Text>;
55
66
  };
67
+
68
+ Typography.propTypes = {
69
+ ...propTypes.space,
70
+ ...propTypes.layout,
71
+ ...propTypes.flexbox,
72
+ ...propTypes.typography,
73
+ ...propTypes.color,
74
+ ...propTypes.textStyle,
75
+ children: PropTypes.node.isRequired,
76
+ };
77
+
78
+ Typography.defaultProps = {
79
+ color: "font.primary",
80
+ };
@@ -5,9 +5,6 @@ export { Typography } from "./Typography/Typography";
5
5
  export { LargeTitle } from "./Typography/LargeTitle";
6
6
  export { Title1 } from "./Typography/Title1";
7
7
  export { Title2 } from "./Typography/Title2";
8
- export { Title3 } from "./Typography/Title3";
9
- export { Headline } from "./Typography/Headline";
10
8
  export { Body } from "./Typography/Body";
11
- export { Callout } from "./Typography/Callout";
12
9
  export { Caption1 } from "./Typography/Caption1";
13
10
  export { Caption2 } from "./Typography/Caption2";
package/lib/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./components/index";
2
+ export * from "./theme/index";
@@ -1,61 +1,75 @@
1
- import { moderateScale } from "react-native-size-matters";
1
+ const defaultColors = {
2
+ white: "#ffffff",
3
+ black: "#000000",
4
+ base: "#2f3941",
5
+ danger: "#ff6969",
6
+ };
2
7
 
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
- },
8
+ const greyVarients = {
9
+ grey: "#828282",
10
+ grey100: "#f8f9f9",
11
+ grey200: "#e9ebed",
12
+ grey300: "#d8dcde",
13
+ grey400: "#c2c8cc",
14
+ grey500: "#87929d",
15
+ grey600: "#68737d",
16
+ grey800: "#2f3941",
17
+ };
18
+
19
+ const colors = {
20
+ font: {
21
+ primary: "#1b1f23",
22
+ secondary: "#828282",
23
+ ...defaultColors,
24
+ ...greyVarients,
25
+ },
26
+ background: {
27
+ primary: "#ffffff",
28
+ secondary: "#e4e4e7",
29
+ ...defaultColors,
30
+ ...greyVarients,
30
31
  },
32
+ border: {
33
+ primary: "#e4e4e7",
34
+ ...greyVarients,
35
+ ...defaultColors,
36
+ },
37
+ };
38
+
39
+ const baseTheme = {
40
+ colors,
31
41
  fonts: {
32
42
  // We can add below commented fonts later as follows. Also add font faces in index.web.js for the web.
33
43
  // https://www.bigbinary.com/learn-react-native/adding-custom-fonats
34
44
 
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",
45
+ // inter100: "Inter-Thin",
46
+ // inter200: "Inter-ExtraLight",
47
+ // inter300: "Inter-Light",
48
+ // inter500: "Inter-Medium",
49
+ // inter600: "Inter-SemiBold",
50
+ // inter800: "Inter-ExtraBold",
51
+ // inter900: "Inter-Black",
42
52
 
43
- regular: "Inter-Regular",
44
- bold: "Inter-Bold",
53
+ inter400: "Inter-Regular",
54
+ inter700: "Inter-Bold",
45
55
  },
56
+ lineHeights: [24],
46
57
  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),
58
+ largeTitle: 32,
59
+ title1: 24,
60
+ title2: 18,
61
+ title3: 18,
62
+ headline: 14,
63
+ body: 14,
64
+ callout: 12,
65
+ caption1: 12,
66
+ caption2: 10,
56
67
  },
57
68
  };
58
69
 
70
+ //aliases
71
+ baseTheme.lineHeights.note = baseTheme.lineHeights[0] + "px";
72
+
59
73
  export const theme = {
60
74
  ...baseTheme,
61
75
  buttons: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neetoui-rn",
3
- "version": "0.0.10",
3
+ "version": "0.0.14",
4
4
  "main": "lib/index.js",
5
5
  "author": "BigBinary",
6
6
  "license": "MIT",
@@ -26,7 +26,9 @@
26
26
  "web": "yarn prestart && webpack serve --mode=development --config webpack.config.js"
27
27
  },
28
28
  "files": [
29
- "lib"
29
+ "lib",
30
+ "react-native.config.js",
31
+ "assets"
30
32
  ],
31
33
  "husky": {
32
34
  "hooks": {
@@ -41,7 +43,11 @@
41
43
  ]
42
44
  },
43
45
  "peerDependencies": {},
44
- "dependencies": {},
46
+ "dependencies": {
47
+ "@styled-system/prop-types": "^5.1.5",
48
+ "styled-components": "^5.3.3",
49
+ "styled-system": "^5.1.5"
50
+ },
45
51
  "devDependencies": {
46
52
  "@babel/core": "^7.12.9",
47
53
  "@babel/runtime": "^7.12.5",
@@ -90,13 +96,10 @@
90
96
  "react": "17.0.2",
91
97
  "react-dom": "17.0.2",
92
98
  "react-native": "0.66.2",
93
- "react-native-size-matters": "^0.4.0",
94
99
  "react-native-storybook-loader": "^2.0.4",
95
100
  "react-native-web": "^0.17.5",
96
101
  "react-test-renderer": "17.0.2",
97
102
  "serve": "^13.0.2",
98
- "styled-components": "^5.3.3",
99
- "styled-system": "^5.1.5",
100
103
  "url-loader": "^4.1.1",
101
104
  "webpack": "^5.61.0",
102
105
  "webpack-cli": "^4.9.1",
@@ -0,0 +1,10 @@
1
+ module.exports = {
2
+ project: {
3
+ ios: {},
4
+ android: {},
5
+ },
6
+ assets: ["./assets/fonts/"],
7
+ dependency: {
8
+ assets: ["./assets/fonts/"],
9
+ },
10
+ };
@@ -1,35 +0,0 @@
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
- };
@@ -1,35 +0,0 @@
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
- };
@@ -1,35 +0,0 @@
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
- };