@sparrowengg/twigs-mobile 0.0.1 → 0.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparrowengg/twigs-mobile",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "main": "dist/commonjs/index.js",
5
5
  "module": "dist/module/index.js",
6
6
  "types": "dist/types/index.d.ts",
package/src/Box/box.tsx CHANGED
@@ -1,4 +1,82 @@
1
- import React from "react";
1
+ import React, { ReactNode } from "react";
2
+ import { ViewStyle, ViewProps } from "react-native";
2
3
  import styled from "styled-components/native";
3
4
 
4
- export const Box = styled.View``;
5
+ const DEFAULT_SPACING = 0;
6
+
7
+ const resolveMargin = ({
8
+ margin,
9
+ marginHorizontal,
10
+ marginVertical,
11
+ marginTop,
12
+ marginBottom,
13
+ marginLeft,
14
+ marginRight,
15
+ }: Partial<BoxProps>) => ({
16
+ top: marginTop ?? marginVertical ?? margin ?? DEFAULT_SPACING,
17
+ bottom: marginBottom ?? marginVertical ?? margin ?? DEFAULT_SPACING,
18
+ left: marginLeft ?? marginHorizontal ?? margin ?? DEFAULT_SPACING,
19
+ right: marginRight ?? marginHorizontal ?? margin ?? DEFAULT_SPACING,
20
+ });
21
+
22
+ const resolvePadding = ({
23
+ padding,
24
+ paddingHorizontal,
25
+ paddingVertical,
26
+ paddingTop,
27
+ paddingBottom,
28
+ paddingLeft,
29
+ paddingRight,
30
+ }: Partial<BoxProps>) => ({
31
+ top: paddingTop ?? paddingVertical ?? padding ?? DEFAULT_SPACING,
32
+ bottom: paddingBottom ?? paddingVertical ?? padding ?? DEFAULT_SPACING,
33
+ left: paddingLeft ?? paddingHorizontal ?? padding ?? DEFAULT_SPACING,
34
+ right: paddingRight ?? paddingHorizontal ?? padding ?? DEFAULT_SPACING,
35
+ });
36
+
37
+ type BoxProps = ViewProps & {
38
+ style?: ViewStyle;
39
+ children?: ReactNode;
40
+ padding?: number;
41
+ margin?: number;
42
+ paddingLeft?: number;
43
+ paddingRight?: number;
44
+ paddingTop?: number;
45
+ paddingBottom?: number;
46
+ paddingHorizontal?: number;
47
+ paddingVertical?: number;
48
+ marginLeft?: number;
49
+ marginRight?: number;
50
+ marginTop?: number;
51
+ marginBottom?: number;
52
+ marginHorizontal?: number;
53
+ marginVertical?: number;
54
+ };
55
+
56
+ const StyledBox = styled.View<BoxProps>`
57
+ ${({ margin = 0, ...rest }) => {
58
+ const resolvedMargin = resolveMargin({ margin, ...rest });
59
+ return `
60
+ margin-top: ${resolvedMargin.top}px;
61
+ margin-bottom: ${resolvedMargin.bottom}px;
62
+ margin-left: ${resolvedMargin.left}px;
63
+ margin-right: ${resolvedMargin.right}px;
64
+ `;
65
+ }}
66
+
67
+ ${({ padding = 0, ...rest }) => {
68
+ const resolvedPadding = resolvePadding({ padding, ...rest });
69
+ return `
70
+ padding-top: ${resolvedPadding.top}px;
71
+ padding-bottom: ${resolvedPadding.bottom}px;
72
+ padding-left: ${resolvedPadding.left}px;
73
+ padding-right: ${resolvedPadding.right}px;
74
+ `;
75
+ }}
76
+ `;
77
+
78
+ export const Box: React.FC<BoxProps> = ({ style, children, ...rest }) => (
79
+ <StyledBox style={style} {...rest}>
80
+ {children}
81
+ </StyledBox>
82
+ );
@@ -0,0 +1,13 @@
1
+ import React, { ReactNode } from "react";
2
+ import { ThemeProvider } from "styled-components/native";
3
+ import { defaultTheme } from "../config/theme";
4
+
5
+
6
+ type TwigsThemeProviderProps = {
7
+ children: ReactNode;
8
+ theme?: object;
9
+ };
10
+
11
+ export const TwigsThemeProvider: React.FC<TwigsThemeProviderProps> = ({ children, theme = defaultTheme }) => (
12
+ <ThemeProvider theme={theme}>{children}</ThemeProvider>
13
+ );
@@ -0,0 +1,195 @@
1
+ export const defaultTheme = {
2
+ colors: {
3
+ primary: "#2E666D",
4
+ secondary: "#363A43",
5
+ accent50: "#F3F3FF",
6
+ accent100: "#EAE9FE",
7
+ accent200: "#D7D6FE",
8
+ accent300: "#B9B5FD",
9
+ accent400: "#978CF9",
10
+ accent500: "#7158F5",
11
+ accent600: "#623BEC",
12
+ accent700: "#5329D8",
13
+ accent800: "#4622B5",
14
+ accent900: "#3B1E94",
15
+ primary50: "#F3F9FA",
16
+ primary100: "#E6F3F4",
17
+ primary200: "#CEE7EA",
18
+ primary300: "#9CCFD6",
19
+ primary400: "#56B0BB",
20
+ primary500: "#4A9CA6",
21
+ primary600: "#448E97",
22
+ primary700: "#3B8088",
23
+ primary800: "#36737A",
24
+ primary900: "#2E666D",
25
+ warning50: "#FFF6EF",
26
+ warning100: "#FEEAC7",
27
+ warning200: "#FDD28A",
28
+ warning300: "#FCBD4F",
29
+ warning400: "#FBAB24",
30
+ warning500: "#F59E0B",
31
+ warning600: "#DB8D06",
32
+ warning700: "#B47409",
33
+ warning800: "#92610E",
34
+ warning900: "#78510F",
35
+ highlight50: "#FFFCDA",
36
+ highlight100: "#FFF7AD",
37
+ highlight200: "#FFF27D",
38
+ highlight300: "#FFED4B",
39
+ highlight400: "#FFE81A",
40
+ highlight500: "#E6CF00",
41
+ highlight600: "#B3A100",
42
+ highlight700: "#807300",
43
+ highlight800: "#786B03",
44
+ highlight900: "#6A5F00",
45
+ positive50: "#F4FAF1",
46
+ positive100: "#E8F4E3",
47
+ positive200: "#D4E8CA",
48
+ positive300: "#A8D291",
49
+ positive400: "#67B034",
50
+ positive500: "#5EA130",
51
+ positive600: "#55932A",
52
+ positive700: "#4C8425",
53
+ positive800: "#437720",
54
+ positive900: "#3C691C",
55
+ secondary50: "#F4F6F7",
56
+ secondary100: "#E2E6EB",
57
+ secondary200: "#C9CFD8",
58
+ secondary300: "#A3AEBD",
59
+ secondary400: "#76859A",
60
+ secondary500: "#64748B",
61
+ secondary600: "#4E596C",
62
+ secondary700: "#444B5A",
63
+ secondary800: "#3D424D",
64
+ secondary900: "#363A43",
65
+ negative50: "#FFF6F3",
66
+ negative100: "#FDEDE8",
67
+ negative200: "#FFDAD0",
68
+ negative300: "#FFB4A1",
69
+ negative400: "#FA7659",
70
+ negative500: "#F65633",
71
+ negative600: "#E75030",
72
+ negative700: "#D14729",
73
+ negative800: "#BC4024",
74
+ negative900: "#A9371E",
75
+ neutral50: "#F8F8F8",
76
+ neutral100: "#F1F1F1",
77
+ neutral200: "#E2E2E2",
78
+ neutral300: "#C6C6C6",
79
+ neutral400: "#9E9E9E",
80
+ neutral500: "#919191",
81
+ neutral600: "#848484",
82
+ neutral700: "#767676",
83
+ neutral800: "#6A6A6A",
84
+ neutral900: "#2B2B2B",
85
+ black50: "#0000000A",
86
+ black100: "#00000014",
87
+ black200: "#0000001A",
88
+ black300: "#00000026",
89
+ black400: "#00000033",
90
+ black500: "#0000004D",
91
+ black600: "#00000080",
92
+ black700: "#000000B2",
93
+ black800: "#000000CC",
94
+ black900: "#000000",
95
+ white50: "#FFFFFF0D",
96
+ white100: "#FFFFFF14",
97
+ white200: "#FFFFFF1A",
98
+ white300: "#FFFFFF26",
99
+ white400: "#FFFFFF33",
100
+ white500: "#FFFFFF4D",
101
+ white600: "#FFFFFF80",
102
+ white700: "#FFFFFFB2",
103
+ white800: "#FFFFFFCC",
104
+ white900: "#FFFFFF",
105
+ },
106
+ space: {
107
+ $1: 2,
108
+ $2: 4,
109
+ $3: 6,
110
+ $4: 8,
111
+ $5: 10,
112
+ $6: 12,
113
+ $7: 14,
114
+ $8: 16,
115
+ $9: 18,
116
+ $10: 20,
117
+ $11: 22,
118
+ $12: 24,
119
+ $13: 26,
120
+ $14: 28,
121
+ $15: 30,
122
+ $16: 32,
123
+ $17: 34,
124
+ $18: 36,
125
+ $19: 38,
126
+ $20: 40,
127
+ $21: 42,
128
+ $22: 44,
129
+ $23: 46,
130
+ $24: 48,
131
+ $25: 50,
132
+ $26: 52,
133
+ $27: 54,
134
+ $28: 56,
135
+ $29: 58,
136
+ $30: 60,
137
+ $31: 62,
138
+ $32: 64,
139
+ $33: 66,
140
+ $34: 68,
141
+ $35: 70,
142
+ $36: 72,
143
+ $37: 74,
144
+ $38: 76,
145
+ $39: 78,
146
+ $40: 80,
147
+ $41: 82,
148
+ $42: 84,
149
+ $43: 86,
150
+ $44: 88,
151
+ $45: 90,
152
+ $46: 92,
153
+ $47: 94,
154
+ $48: 96,
155
+ $49: 98,
156
+ $50: 100,
157
+ },
158
+ sizes: {
159
+ $1: 4,
160
+ $2: 8,
161
+ $3: 12,
162
+ $4: 16,
163
+ $5: 20,
164
+ $6: 24,
165
+ $7: 28,
166
+ $8: 32,
167
+ $9: 36,
168
+ $10: 40,
169
+ $11: 44,
170
+ $12: 48,
171
+ $13: 52,
172
+ $14: 56,
173
+ $15: 60,
174
+ $16: 64,
175
+ $17: 68,
176
+ $18: 72,
177
+ $19: 76,
178
+ $20: 80,
179
+ $21: 84,
180
+ $22: 88,
181
+ $23: 92,
182
+ $24: 96,
183
+ $25: 100,
184
+ $26: 104,
185
+ $27: 108,
186
+ $28: 112,
187
+ $29: 116,
188
+ $30: 120,
189
+ $31: 124,
190
+ $32: 128,
191
+ $33: 132,
192
+ $34: 136,
193
+ },
194
+ };
195
+
File without changes