onecart-ui-components 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/dist/Button/Button.mobile.d.ts +4 -0
  2. package/dist/Button/Button.types.d.ts +43 -0
  3. package/dist/Button/Button.web.d.ts +4 -0
  4. package/dist/Button/buttonStyles.d.ts +12 -0
  5. package/dist/Button/index.d.ts +1 -0
  6. package/dist/Button/index.mobile.d.ts +1 -0
  7. package/dist/Typography/Body/index.d.ts +3 -0
  8. package/dist/Typography/Display/index.d.ts +3 -0
  9. package/dist/Typography/Heading/index.d.ts +3 -0
  10. package/dist/Typography/Utility/index.d.ts +3 -0
  11. package/dist/Typography/index.d.ts +4 -0
  12. package/dist/components/Button.d.ts +1 -0
  13. package/dist/components/Icon.d.ts +10 -0
  14. package/dist/components/index.d.ts +4 -0
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.js +2057 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/index.mobile.js +1803 -0
  19. package/dist/index.mobile.js.map +1 -0
  20. package/dist/mobile/index.d.ts +2 -0
  21. package/dist/src/Button/Button.mobile.d.ts +4 -0
  22. package/dist/src/Button/Button.types.d.ts +43 -0
  23. package/dist/src/Button/Button.web.d.ts +4 -0
  24. package/dist/src/Button/buttonStyles.d.ts +12 -0
  25. package/dist/src/Button/index.d.ts +2 -0
  26. package/dist/src/Button/index.mobile.d.ts +2 -0
  27. package/dist/src/Typography/Body/Body.mobile.d.ts +3 -0
  28. package/dist/src/Typography/Body/Body.web.d.ts +3 -0
  29. package/dist/src/Typography/Body/index.d.ts +1 -0
  30. package/dist/src/Typography/Body/index.mobile.d.ts +1 -0
  31. package/dist/src/Typography/Display/Display.mobile.d.ts +3 -0
  32. package/dist/src/Typography/Display/Display.web.d.ts +3 -0
  33. package/dist/src/Typography/Display/index.d.ts +1 -0
  34. package/dist/src/Typography/Display/index.mobile.d.ts +1 -0
  35. package/dist/src/Typography/Heading/Heading.mobile.d.ts +3 -0
  36. package/dist/src/Typography/Heading/Heading.web.d.ts +3 -0
  37. package/dist/src/Typography/Heading/index.d.ts +1 -0
  38. package/dist/src/Typography/Heading/index.mobile.d.ts +1 -0
  39. package/dist/src/Typography/Typography.types.d.ts +51 -0
  40. package/dist/src/Typography/Utility/Utility.mobile.d.ts +3 -0
  41. package/dist/src/Typography/Utility/Utility.web.d.ts +3 -0
  42. package/dist/src/Typography/Utility/index.d.ts +1 -0
  43. package/dist/src/Typography/Utility/index.mobile.d.ts +1 -0
  44. package/dist/src/Typography/index.d.ts +5 -0
  45. package/dist/src/Typography/index.mobile.d.ts +5 -0
  46. package/dist/src/components/Button.d.ts +1 -0
  47. package/dist/src/components/Icon.d.ts +10 -0
  48. package/dist/src/components/index.d.ts +4 -0
  49. package/dist/src/index.d.ts +2 -0
  50. package/dist/src/styles/tokens/typography.d.ts +138 -0
  51. package/dist/src/theme/ThemeProvider.d.ts +5 -0
  52. package/dist/src/tokens/design-tokens.d.ts +54 -0
  53. package/dist/styles/tokens/typography.d.ts +138 -0
  54. package/dist/theme/ThemeProvider.d.ts +5 -0
  55. package/dist/tokens/design-tokens.d.ts +54 -0
  56. package/dist/types/Button.d.ts +24 -0
  57. package/dist/types/Typography.d.ts +32 -0
  58. package/package.json +56 -0
@@ -0,0 +1,138 @@
1
+ export declare const typographyTokens: {
2
+ display2xl: {
3
+ fontFamily: string;
4
+ fontSize: number;
5
+ lineHeight: number;
6
+ fontWeight: string;
7
+ color: string;
8
+ letterSpacing: string;
9
+ textDecoration: string;
10
+ };
11
+ displayXl: {
12
+ fontFamily: string;
13
+ fontSize: number;
14
+ lineHeight: number;
15
+ fontWeight: string;
16
+ color: string;
17
+ letterSpacing: string;
18
+ textDecoration: string;
19
+ };
20
+ headingXl: {
21
+ fontFamily: string;
22
+ fontSize: number;
23
+ lineHeight: number;
24
+ fontWeight: string;
25
+ color: string;
26
+ letterSpacing: string;
27
+ textDecoration: string;
28
+ };
29
+ headingLg: {
30
+ fontFamily: string;
31
+ fontSize: number;
32
+ lineHeight: number;
33
+ fontWeight: string;
34
+ color: string;
35
+ letterSpacing: string;
36
+ textDecoration: string;
37
+ };
38
+ headingMd: {
39
+ fontFamily: string;
40
+ fontSize: number;
41
+ lineHeight: number;
42
+ fontWeight: string;
43
+ color: string;
44
+ letterSpacing: string;
45
+ textDecoration: string;
46
+ };
47
+ headingSm: {
48
+ fontFamily: string;
49
+ fontSize: number;
50
+ lineHeight: number;
51
+ fontWeight: string;
52
+ color: string;
53
+ letterSpacing: string;
54
+ textDecoration: string;
55
+ };
56
+ headingXs: {
57
+ fontFamily: string;
58
+ fontSize: number;
59
+ lineHeight: number;
60
+ fontWeight: string;
61
+ color: string;
62
+ letterSpacing: string;
63
+ textDecoration: string;
64
+ };
65
+ heading2xs: {
66
+ fontFamily: string;
67
+ fontSize: number;
68
+ lineHeight: number;
69
+ fontWeight: string;
70
+ color: string;
71
+ letterSpacing: string;
72
+ textDecoration: string;
73
+ };
74
+ bodyXl: {
75
+ fontFamily: string;
76
+ fontSize: number;
77
+ lineHeight: number;
78
+ fontWeight: string;
79
+ color: string;
80
+ letterSpacing: string;
81
+ textDecoration: string;
82
+ };
83
+ bodyLg: {
84
+ fontFamily: string;
85
+ fontSize: number;
86
+ lineHeight: number;
87
+ fontWeight: string;
88
+ color: string;
89
+ letterSpacing: string;
90
+ textDecoration: string;
91
+ };
92
+ bodyMd: {
93
+ fontFamily: string;
94
+ fontSize: number;
95
+ lineHeight: number;
96
+ fontWeight: string;
97
+ color: string;
98
+ letterSpacing: string;
99
+ textDecoration: string;
100
+ };
101
+ bodySm: {
102
+ fontFamily: string;
103
+ fontSize: number;
104
+ lineHeight: number;
105
+ fontWeight: string;
106
+ color: string;
107
+ letterSpacing: string;
108
+ textDecoration: string;
109
+ };
110
+ labelLg: {
111
+ fontFamily: string;
112
+ fontSize: number;
113
+ lineHeight: number;
114
+ fontWeight: string;
115
+ color: string;
116
+ letterSpacing: string;
117
+ textDecoration: string;
118
+ };
119
+ labelMd: {
120
+ fontFamily: string;
121
+ fontSize: number;
122
+ lineHeight: number;
123
+ fontWeight: string;
124
+ color: string;
125
+ letterSpacing: string;
126
+ textDecoration: string;
127
+ };
128
+ labelSm: {
129
+ fontFamily: string;
130
+ fontSize: number;
131
+ lineHeight: number;
132
+ fontWeight: string;
133
+ color: string;
134
+ letterSpacing: string;
135
+ textDecoration: string;
136
+ };
137
+ };
138
+ export type TypographyTokenMap = typeof typographyTokens;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ export declare const ThemeContext: React.Context<{}>;
3
+ export declare const ThemeProvider: React.FC<{
4
+ children: React.ReactNode;
5
+ }>;
@@ -0,0 +1,54 @@
1
+ export declare const buttonTokens: {
2
+ primary: {
3
+ default: string;
4
+ hover: string;
5
+ active: string;
6
+ disabled: string;
7
+ };
8
+ secondary: {
9
+ default: string;
10
+ hover: string;
11
+ active: string;
12
+ disabled: string;
13
+ };
14
+ outline: {
15
+ borderDefault: string;
16
+ borderHover: string;
17
+ borderActive: string;
18
+ text: {
19
+ default: string;
20
+ hover: string;
21
+ active: string;
22
+ disabled: string;
23
+ };
24
+ };
25
+ ghost: {
26
+ text: {
27
+ default: string;
28
+ hover: string;
29
+ active: string;
30
+ disabled: string;
31
+ };
32
+ };
33
+ destructive: {
34
+ text: {
35
+ default: string;
36
+ hover: string;
37
+ active: string;
38
+ disabled: string;
39
+ };
40
+ };
41
+ spacing: {
42
+ none: string | number;
43
+ cardSm: string;
44
+ gapMd: string;
45
+ gapXs: string;
46
+ };
47
+ radius: string;
48
+ typography: {
49
+ family: string;
50
+ weightMedium: string | number;
51
+ };
52
+ neutralText: string;
53
+ };
54
+ export type ButtonTokenMap = typeof buttonTokens;
@@ -0,0 +1,138 @@
1
+ export declare const typographyTokens: {
2
+ display2xl: {
3
+ fontFamily: string;
4
+ fontSize: number;
5
+ lineHeight: number;
6
+ fontWeight: string;
7
+ color: string;
8
+ letterSpacing: string;
9
+ textDecoration: string;
10
+ };
11
+ displayXl: {
12
+ fontFamily: string;
13
+ fontSize: number;
14
+ lineHeight: number;
15
+ fontWeight: string;
16
+ color: string;
17
+ letterSpacing: string;
18
+ textDecoration: string;
19
+ };
20
+ headingXl: {
21
+ fontFamily: string;
22
+ fontSize: number;
23
+ lineHeight: number;
24
+ fontWeight: string;
25
+ color: string;
26
+ letterSpacing: string;
27
+ textDecoration: string;
28
+ };
29
+ headingLg: {
30
+ fontFamily: string;
31
+ fontSize: number;
32
+ lineHeight: number;
33
+ fontWeight: string;
34
+ color: string;
35
+ letterSpacing: string;
36
+ textDecoration: string;
37
+ };
38
+ headingMd: {
39
+ fontFamily: string;
40
+ fontSize: number;
41
+ lineHeight: number;
42
+ fontWeight: string;
43
+ color: string;
44
+ letterSpacing: string;
45
+ textDecoration: string;
46
+ };
47
+ headingSm: {
48
+ fontFamily: string;
49
+ fontSize: number;
50
+ lineHeight: number;
51
+ fontWeight: string;
52
+ color: string;
53
+ letterSpacing: string;
54
+ textDecoration: string;
55
+ };
56
+ headingXs: {
57
+ fontFamily: string;
58
+ fontSize: number;
59
+ lineHeight: number;
60
+ fontWeight: string;
61
+ color: string;
62
+ letterSpacing: string;
63
+ textDecoration: string;
64
+ };
65
+ heading2xs: {
66
+ fontFamily: string;
67
+ fontSize: number;
68
+ lineHeight: number;
69
+ fontWeight: string;
70
+ color: string;
71
+ letterSpacing: string;
72
+ textDecoration: string;
73
+ };
74
+ bodyXl: {
75
+ fontFamily: string;
76
+ fontSize: number;
77
+ lineHeight: number;
78
+ fontWeight: string;
79
+ color: string;
80
+ letterSpacing: string;
81
+ textDecoration: string;
82
+ };
83
+ bodyLg: {
84
+ fontFamily: string;
85
+ fontSize: number;
86
+ lineHeight: number;
87
+ fontWeight: string;
88
+ color: string;
89
+ letterSpacing: string;
90
+ textDecoration: string;
91
+ };
92
+ bodyMd: {
93
+ fontFamily: string;
94
+ fontSize: number;
95
+ lineHeight: number;
96
+ fontWeight: string;
97
+ color: string;
98
+ letterSpacing: string;
99
+ textDecoration: string;
100
+ };
101
+ bodySm: {
102
+ fontFamily: string;
103
+ fontSize: number;
104
+ lineHeight: number;
105
+ fontWeight: string;
106
+ color: string;
107
+ letterSpacing: string;
108
+ textDecoration: string;
109
+ };
110
+ labelLg: {
111
+ fontFamily: string;
112
+ fontSize: number;
113
+ lineHeight: number;
114
+ fontWeight: string;
115
+ color: string;
116
+ letterSpacing: string;
117
+ textDecoration: string;
118
+ };
119
+ labelMd: {
120
+ fontFamily: string;
121
+ fontSize: number;
122
+ lineHeight: number;
123
+ fontWeight: string;
124
+ color: string;
125
+ letterSpacing: string;
126
+ textDecoration: string;
127
+ };
128
+ labelSm: {
129
+ fontFamily: string;
130
+ fontSize: number;
131
+ lineHeight: number;
132
+ fontWeight: string;
133
+ color: string;
134
+ letterSpacing: string;
135
+ textDecoration: string;
136
+ };
137
+ };
138
+ export type TypographyTokenMap = typeof typographyTokens;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ export declare const ThemeContext: React.Context<{}>;
3
+ export declare const ThemeProvider: React.FC<{
4
+ children: React.ReactNode;
5
+ }>;
@@ -0,0 +1,54 @@
1
+ export declare const buttonTokens: {
2
+ primary: {
3
+ default: string;
4
+ hover: string;
5
+ active: string;
6
+ disabled: string;
7
+ };
8
+ secondary: {
9
+ default: string;
10
+ hover: string;
11
+ active: string;
12
+ disabled: string;
13
+ };
14
+ outline: {
15
+ borderDefault: string;
16
+ borderHover: string;
17
+ borderActive: string;
18
+ text: {
19
+ default: string;
20
+ hover: string;
21
+ active: string;
22
+ disabled: string;
23
+ };
24
+ };
25
+ ghost: {
26
+ text: {
27
+ default: string;
28
+ hover: string;
29
+ active: string;
30
+ disabled: string;
31
+ };
32
+ };
33
+ destructive: {
34
+ text: {
35
+ default: string;
36
+ hover: string;
37
+ active: string;
38
+ disabled: string;
39
+ };
40
+ };
41
+ spacing: {
42
+ none: string | number;
43
+ cardSm: string;
44
+ gapMd: string;
45
+ gapXs: string;
46
+ };
47
+ radius: string;
48
+ typography: {
49
+ family: string;
50
+ weightMedium: string | number;
51
+ };
52
+ neutralText: string;
53
+ };
54
+ export type ButtonTokenMap = typeof buttonTokens;
@@ -0,0 +1,24 @@
1
+ export type ButtonType = "primary" | "outline" | "ghost" | "destructive";
2
+ export type ButtonSize = "large" | "small";
3
+ export type ButtonState = "default" | "hover" | "active" | "disabled";
4
+ export interface ButtonProps {
5
+ label: string;
6
+ type?: ButtonType;
7
+ size?: ButtonSize;
8
+ disabled?: boolean;
9
+ leftIcon?: string;
10
+ rightIcon?: string;
11
+ icon?: string;
12
+ fullWidth?: boolean;
13
+ ghostUnderline?: boolean;
14
+ accessibilityLabel?: string;
15
+ testID?: string;
16
+ className?: string;
17
+ style?: React.CSSProperties | Record<string, unknown>;
18
+ onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
19
+ onPress?: () => void;
20
+ onMouseEnter?: (e: React.MouseEvent<HTMLButtonElement>) => void;
21
+ onMouseLeave?: (e: React.MouseEvent<HTMLButtonElement>) => void;
22
+ onMouseDown?: (e: React.MouseEvent<HTMLButtonElement>) => void;
23
+ onMouseUp?: (e: React.MouseEvent<HTMLButtonElement>) => void;
24
+ }
@@ -0,0 +1,32 @@
1
+ import React from "react";
2
+ export type BodySize = "xl" | "lg" | "md" | "sm";
3
+ export interface BaseTypographyProps {
4
+ align?: "left" | "center" | "right";
5
+ color?: string;
6
+ truncate?: boolean;
7
+ lineClamp?: number;
8
+ className?: string;
9
+ style?: React.CSSProperties | Record<string, unknown>;
10
+ onClick?: (e: React.MouseEvent<HTMLElement>) => void;
11
+ testID?: string;
12
+ children?: React.ReactNode;
13
+ }
14
+ export interface BodyProps extends BaseTypographyProps {
15
+ size?: BodySize;
16
+ element?: keyof JSX.IntrinsicElements;
17
+ }
18
+ export type DisplaySize = "2xl" | "xl";
19
+ export interface DisplayProps extends BaseTypographyProps {
20
+ size?: DisplaySize;
21
+ element?: keyof JSX.IntrinsicElements;
22
+ }
23
+ export type HeadingSize = "xl" | "lg" | "md" | "sm" | "xs" | "2xs";
24
+ export interface HeadingProps extends BaseTypographyProps {
25
+ size?: HeadingSize;
26
+ element?: keyof JSX.IntrinsicElements;
27
+ }
28
+ export type UtilityVariant = "button" | "link" | "caption";
29
+ export interface UtilityProps extends BaseTypographyProps {
30
+ variant?: UtilityVariant;
31
+ element?: keyof JSX.IntrinsicElements;
32
+ }
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "onecart-ui-components",
3
+ "version": "0.1.0",
4
+ "description": "Cross-platform React + React Native component library for OneCart UI",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/src/index.d.ts",
8
+ "react-native": "dist/index.mobile.js",
9
+ "scripts": {
10
+ "build": "rollup -c && tsc -p tsconfig.json --emitDeclarationOnly",
11
+ "dev": "tsc -p tsconfig.json -w",
12
+ "lint": "eslint src --ext .ts,.tsx",
13
+ "test": "jest"
14
+ },
15
+ "dependencies": {
16
+ "onecart-ui-tokens": "*"
17
+ },
18
+ "peerDependencies": {
19
+ "react": "18.2.0",
20
+ "react-dom": "18.2.0",
21
+ "react-native": "^0.74.0"
22
+ },
23
+ "devDependencies": {
24
+ "@babel/preset-env": "^7.28.5",
25
+ "@babel/preset-react": "^7.28.5",
26
+ "@testing-library/jest-dom": "^6.1.5",
27
+ "@testing-library/react": "^14.0.0",
28
+ "@types/jest": "^29.5.5",
29
+ "@types/react": "^18.2.34",
30
+ "@types/react-dom": "^18.2.14",
31
+ "@typescript-eslint/eslint-plugin": "^6.7.0",
32
+ "@typescript-eslint/parser": "^6.7.0",
33
+ "babel-jest": "^29.7.0",
34
+ "eslint": "^8.57.0",
35
+ "jest": "^29.7.0",
36
+ "jest-environment-jsdom": "^29.7.0",
37
+ "ts-jest": "^29.1.1",
38
+ "typescript": "^5.4.0"
39
+ },
40
+ "files": [
41
+ "dist"
42
+ ],
43
+ "sideEffects": false,
44
+ "exports": {
45
+ ".": {
46
+ "import": "./dist/index.js",
47
+ "require": "./dist/index.js",
48
+ "types": "./dist/src/index.d.ts"
49
+ },
50
+ "./mobile": {
51
+ "react-native": "./dist/index.mobile.js",
52
+ "import": "./dist/index.mobile.js",
53
+ "types": "./dist/mobile/index.d.ts"
54
+ }
55
+ }
56
+ }