react-native-varia 0.0.1

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 (44) hide show
  1. package/README.md +53 -0
  2. package/bin/cli.js +200 -0
  3. package/lib/components/Badge.tsx +96 -0
  4. package/lib/components/Button.tsx +131 -0
  5. package/lib/components/CircleProgress.tsx +180 -0
  6. package/lib/components/Divider.tsx +43 -0
  7. package/lib/components/GradientBackground.tsx +68 -0
  8. package/lib/components/GradientText.tsx +121 -0
  9. package/lib/components/Icon.tsx +13 -0
  10. package/lib/components/IconWrapper.tsx +109 -0
  11. package/lib/components/Input.tsx +120 -0
  12. package/lib/components/Link.tsx +87 -0
  13. package/lib/components/Modal.tsx +157 -0
  14. package/lib/components/ReText.tsx +124 -0
  15. package/lib/components/Slider.tsx +334 -0
  16. package/lib/components/Slideshow.tsx +317 -0
  17. package/lib/components/SlidingDrawer.tsx +307 -0
  18. package/lib/components/Spinner.tsx +44 -0
  19. package/lib/components/Switch.tsx +224 -0
  20. package/lib/components/Text.tsx +107 -0
  21. package/lib/components/index.tsx +83 -0
  22. package/lib/mixins.ts +180 -0
  23. package/lib/patterns/index.tsx +426 -0
  24. package/lib/theme/Badge.recipe.tsx +68 -0
  25. package/lib/theme/Button.recipe-old.tsx +67 -0
  26. package/lib/theme/Button.recipe.tsx +83 -0
  27. package/lib/theme/CircleProgress.recipe.tsx +42 -0
  28. package/lib/theme/GradientBackground.recipe.tsx +38 -0
  29. package/lib/theme/GradientText.recipe.tsx +49 -0
  30. package/lib/theme/Icon.recipe.tsx +122 -0
  31. package/lib/theme/IconWrapper.recipe.tsx +121 -0
  32. package/lib/theme/Input.recipe.tsx +110 -0
  33. package/lib/theme/Link.recipe.tsx +51 -0
  34. package/lib/theme/Modal.recipe.tsx +34 -0
  35. package/lib/theme/ReText.recipe.tsx +7 -0
  36. package/lib/theme/Slider.recipe.tsx +226 -0
  37. package/lib/theme/Slideshow.recipe.tsx +142 -0
  38. package/lib/theme/SlidingDrawer.recipe.tsx +91 -0
  39. package/lib/theme/Spinner.recipe.tsx +8 -0
  40. package/lib/theme/Switch.recipe.tsx +70 -0
  41. package/lib/theme/Text.recipe.tsx +10 -0
  42. package/lib/types.ts +70 -0
  43. package/lib/utils.ts +80 -0
  44. package/package.json +18 -0
@@ -0,0 +1,49 @@
1
+ import {StyleSheet} from 'react-native-unistyles'
2
+ import {createGradientTokens} from '../style/types'
3
+
4
+ const gradientTextTokens = createGradientTokens({
5
+ defaultProps: {
6
+ colorPalette: 'primary',
7
+ direction: 'to top left',
8
+ },
9
+ variants: {
10
+ direction: {
11
+ 'to top': {x1: 0, y1: 0, x2: 0, y2: 1},
12
+ 'to bottom': {x1: 0, y1: 1, x2: 0, y2: 0},
13
+ 'to left': {x1: 0, y1: 0, x2: 1, y2: 0},
14
+ 'to right': {x1: 1, y1: 0, x2: 0, y2: 0},
15
+ 'to top left': {x1: 0, y1: 0, x2: 1, y2: 1},
16
+ 'to top right': {x1: 1, y1: 0, x2: 0, y2: 1},
17
+ 'to bottom left': {x1: 0, y1: 1, x2: 1, y2: 0},
18
+ 'to bottom right': {x1: 1, y1: 1, x2: 0, y2: 0},
19
+ },
20
+ colorPalette: {
21
+ primary: {
22
+ startColor: 'blue',
23
+ endColor: 'accentLines',
24
+ },
25
+ secondary: {
26
+ startColor: 'white',
27
+ endColor: 'black',
28
+ },
29
+ tertiary: {
30
+ startColor: 'active',
31
+ endColor: 'violet',
32
+ },
33
+ },
34
+ },
35
+ } as const)
36
+
37
+ export {gradientTextTokens}
38
+
39
+ const GradientTextStyles = StyleSheet.create(theme => ({
40
+ container: {
41
+ variants: {
42
+ colorPalette: {
43
+ primary: {},
44
+ },
45
+ },
46
+ },
47
+ }))
48
+
49
+ export default GradientTextStyles
@@ -0,0 +1,122 @@
1
+ import { StyleSheet } from "react-native-unistyles"
2
+ import { wpx, hpx } from "../style/utils"
3
+ import { createIconTokens } from "../style/types"
4
+
5
+ export const IconTokens = createIconTokens({
6
+ // width: wpx(28),
7
+ // height: hpx(28),
8
+ // viewBoxWidth: wpx(28),
9
+ // viewBoxHeight: hpx(28),
10
+ // defaultScale: 1,
11
+ // defaultColor: '#000000',
12
+ defaultProps: {
13
+ colorPalette: 'primary',
14
+ size: 'md',
15
+ scale: 1,
16
+ },
17
+ variants: {
18
+ colorPalette: {
19
+ primary: {
20
+ color: 'foreground',
21
+ },
22
+ secondary: {
23
+ color: 'background',
24
+ },
25
+ tertiary: {
26
+ color: 'active',
27
+ }
28
+ },
29
+ size: {
30
+ sm: {
31
+ width: wpx(24),
32
+ height: hpx(24),
33
+ viewBoxWidth: wpx(24),
34
+ viewBoxHeight: hpx(24),
35
+ },
36
+ md: {
37
+ width: wpx(28),
38
+ height: hpx(28),
39
+ viewBoxWidth: wpx(28),
40
+ viewBoxHeight: hpx(28),
41
+ },
42
+ lg: {
43
+ width: wpx(42),
44
+ height: hpx(42),
45
+ viewBoxWidth: wpx(42),
46
+ viewBoxHeight: hpx(42),
47
+ },
48
+ xl: {
49
+ width: wpx(100),
50
+ height: hpx(100),
51
+ viewBoxWidth: wpx(100),
52
+ viewBoxHeight: hpx(100),
53
+ }
54
+ }
55
+ }
56
+ } as const)
57
+
58
+ // const IconStyles = StyleSheet.create(theme => ({
59
+ // container: {
60
+ // variants: {
61
+ // colorPalette: {
62
+ // primary: {
63
+ // backgroundColor: 'tomato',
64
+ // },
65
+ // secondary: {
66
+ // backgroundColor: theme.colors.foreground,
67
+ // }
68
+ // },
69
+ // size: {
70
+ // sm: {
71
+ // height: 32,
72
+ // maxHeight: 32,
73
+ // padding: 6,
74
+ // },
75
+ // md: {
76
+ // maxHeight: 48,
77
+ // height: 48,
78
+ // padding: 8,
79
+ // },
80
+ // lg: {
81
+ // maxHeight: 64,
82
+ // height: 64,
83
+ // padding: 12,
84
+ // },
85
+ // xl: {
86
+ // maxHeight: 80,
87
+ // height: 80,
88
+ // padding: 16,
89
+ // }
90
+ // }
91
+ // },
92
+ // },
93
+ // text: {
94
+ // variants: {
95
+ // colorPalette: {
96
+ // primary: {
97
+ // color: 'white',
98
+ // },
99
+ // secondary: {
100
+ // color: theme.colors.categoryAquamarine,
101
+ // }
102
+ // },
103
+ // size: {
104
+ // sm: {
105
+ // fontSize: 24,
106
+ // },
107
+ // md: {
108
+ // fontSize: 28,
109
+ // },
110
+ // lg: {
111
+ // fontSize: 32,
112
+ // },
113
+ // xl: {
114
+ // fontSize: 36,
115
+ // }
116
+ // }
117
+ // }
118
+ // }
119
+ // }))
120
+
121
+
122
+ // export default IconStyles
@@ -0,0 +1,121 @@
1
+ import {StyleSheet} from 'react-native-unistyles'
2
+ import {wpx, hpx} from '../style/utils'
3
+ import {createIconTokens} from '../style/types'
4
+
5
+ export const IconTokens = createIconTokens({
6
+ // width: wpx(28),
7
+ // height: hpx(28),
8
+ // viewBoxWidth: wpx(28),
9
+ // viewBoxHeight: hpx(28),
10
+ // defaultScale: 1,
11
+ // defaultColor: '#000000',
12
+ defaultProps: {
13
+ colorPalette: 'primary',
14
+ size: 'md',
15
+ scale: 1,
16
+ },
17
+ variants: {
18
+ colorPalette: {
19
+ primary: {
20
+ color: 'foreground',
21
+ },
22
+ secondary: {
23
+ color: 'background',
24
+ },
25
+ tertiary: {
26
+ color: 'active',
27
+ },
28
+ },
29
+ size: {
30
+ sm: {
31
+ width: wpx(24),
32
+ height: hpx(24),
33
+ viewBoxWidth: wpx(24),
34
+ viewBoxHeight: hpx(24),
35
+ },
36
+ md: {
37
+ width: wpx(28),
38
+ height: hpx(28),
39
+ viewBoxWidth: wpx(28),
40
+ viewBoxHeight: hpx(28),
41
+ },
42
+ lg: {
43
+ width: wpx(42),
44
+ height: hpx(42),
45
+ viewBoxWidth: wpx(42),
46
+ viewBoxHeight: hpx(42),
47
+ },
48
+ xl: {
49
+ width: wpx(100),
50
+ height: hpx(100),
51
+ viewBoxWidth: wpx(100),
52
+ viewBoxHeight: hpx(100),
53
+ },
54
+ },
55
+ },
56
+ } as const)
57
+
58
+ // const IconStyles = StyleSheet.create(theme => ({
59
+ // container: {
60
+ // variants: {
61
+ // colorPalette: {
62
+ // primary: {
63
+ // backgroundColor: 'tomato',
64
+ // },
65
+ // secondary: {
66
+ // backgroundColor: theme.colors.foreground,
67
+ // }
68
+ // },
69
+ // size: {
70
+ // sm: {
71
+ // height: 32,
72
+ // maxHeight: 32,
73
+ // padding: 6,
74
+ // },
75
+ // md: {
76
+ // maxHeight: 48,
77
+ // height: 48,
78
+ // padding: 8,
79
+ // },
80
+ // lg: {
81
+ // maxHeight: 64,
82
+ // height: 64,
83
+ // padding: 12,
84
+ // },
85
+ // xl: {
86
+ // maxHeight: 80,
87
+ // height: 80,
88
+ // padding: 16,
89
+ // }
90
+ // }
91
+ // },
92
+ // },
93
+ // text: {
94
+ // variants: {
95
+ // colorPalette: {
96
+ // primary: {
97
+ // color: 'white',
98
+ // },
99
+ // secondary: {
100
+ // color: theme.colors.categoryAquamarine,
101
+ // }
102
+ // },
103
+ // size: {
104
+ // sm: {
105
+ // fontSize: 24,
106
+ // },
107
+ // md: {
108
+ // fontSize: 28,
109
+ // },
110
+ // lg: {
111
+ // fontSize: 32,
112
+ // },
113
+ // xl: {
114
+ // fontSize: 36,
115
+ // }
116
+ // }
117
+ // }
118
+ // }
119
+ // }))
120
+
121
+ // export default IconStyles
@@ -0,0 +1,110 @@
1
+ import {StyleSheet} from 'react-native-unistyles'
2
+
3
+ export const InputTokens = {
4
+ defaultProps: {
5
+ colorPalette: 'primary',
6
+ size: 'md',
7
+ spacing: 'md',
8
+ placeholderColor: 'white',
9
+ marginHorizontal: 30,
10
+ },
11
+ } as const
12
+
13
+ export const InputStyles = StyleSheet.create(theme => ({
14
+ // defaultProps: {
15
+ // variantType: 'primary',
16
+ // variantSize: 'xl',
17
+ // variantSpacing: 'md',
18
+ // color: () => "white",
19
+ // placeholderColor: () => "white",
20
+ // marginHorizontal: 30,
21
+ // },
22
+ label: {
23
+ variants: {
24
+ colorPalette: {
25
+ primary: {
26
+ color: theme.colors.foreground,
27
+ },
28
+ secondary: {
29
+ color: 'pink',
30
+ },
31
+ tertiary: {
32
+ color: 'blue',
33
+ },
34
+ another: {
35
+ color: 'green',
36
+ },
37
+ },
38
+ size: {
39
+ sm: {
40
+ fontSize: 16,
41
+ },
42
+ md: {
43
+ fontSize: 18,
44
+ },
45
+ lg: {
46
+ fontSize: 20,
47
+ },
48
+ xl: {
49
+ fontSize: 22,
50
+ },
51
+ },
52
+ spacing: {
53
+ sm: {
54
+ marginHorizontal: 10,
55
+ },
56
+ md: {
57
+ marginHorizontal: 10,
58
+ },
59
+ xl: {
60
+ marginHorizontal: 30,
61
+ },
62
+ },
63
+ },
64
+ },
65
+ input: {
66
+ variants: {
67
+ colorPalette: {
68
+ primary: {
69
+ backgroundColor: {
70
+ xs: theme.colors.background,
71
+ sm: 'white',
72
+ lg: 'white',
73
+ },
74
+ },
75
+ secondary: {
76
+ backgroundColor: 'transparent',
77
+ borderBottomWidth: 1,
78
+ borderColor: theme.colors.foreground,
79
+ },
80
+ tertiary: {backgroundColor: 'white'},
81
+ another: {backgroundColor: 'red'},
82
+ },
83
+ size: {
84
+ sm: {
85
+ // width: 100,
86
+ height: 50,
87
+ },
88
+ md: {
89
+ // width: 100,
90
+ height: 50,
91
+ },
92
+ xl: {
93
+ // width: 200,
94
+ height: 80,
95
+ },
96
+ },
97
+ spacing: {
98
+ sm: {
99
+ marginHorizontal: 10,
100
+ },
101
+ md: {
102
+ marginHorizontal: 10,
103
+ },
104
+ xl: {
105
+ marginHorizontal: 30,
106
+ },
107
+ },
108
+ },
109
+ },
110
+ }))
@@ -0,0 +1,51 @@
1
+ import {StyleSheet} from 'react-native-unistyles'
2
+
3
+ const LinkStyles = StyleSheet.create(theme => ({
4
+ // return {
5
+ // defaultProps: {
6
+ // as: 'h1',
7
+ // color: () => "white",
8
+ // underline: false,
9
+ // colorScheme: 'primary',
10
+ // },
11
+ link: {
12
+ // customVariants: {
13
+ // elevation: {
14
+ // sm: { backgroundColor: 'red' },
15
+ // md: { backgroundColor: 'green' },
16
+ // xl: { backgroundColor: 'blue' },
17
+ // },
18
+ // shape: {
19
+ // roundBorder: { borderRadius: 10 },
20
+ // square: { borderRadius: 0 },
21
+ // },
22
+ // },
23
+ variants: {
24
+ colorPalette: {
25
+ primary: {
26
+ color: theme.colors.foreground,
27
+ },
28
+ secondary: {
29
+ color: theme.colors.categoryAquamarine,
30
+ },
31
+ },
32
+ size: {
33
+ sm: {
34
+ fontSize: 14,
35
+ },
36
+ md: {
37
+ fontSize: 16,
38
+ },
39
+ lg: {
40
+ fontSize: 18,
41
+ },
42
+ },
43
+ // type: () => ({
44
+ // underline: { textDecorationLine: 'underline' },
45
+ // bold: { fontWeight: 'bold' },
46
+ // }),
47
+ },
48
+ },
49
+ }))
50
+
51
+ export default LinkStyles
@@ -0,0 +1,34 @@
1
+ import {StyleSheet} from 'react-native-unistyles'
2
+
3
+ export const ModalTokens = {
4
+ defaultProps: {
5
+ colorPalette: 'primary',
6
+ },
7
+ baseStyles: {
8
+ backgroundColor: 'blue',
9
+ },
10
+ } as const
11
+
12
+ export const ModalStyles = StyleSheet.create(theme => ({
13
+ container: {
14
+ variants: {
15
+ colorPalette: {
16
+ primary: {
17
+ backgroundColor: 'aquamarine',
18
+ boxShadow: '0px 0px 50px rgba(250, 250, 250, 0.6)',
19
+ },
20
+ secondary: {
21
+ backgroundColor: 'aliceblue',
22
+ boxShadow: '0px 0px 50px rgba(250, 250, 250, 0.6)',
23
+ },
24
+ tertiary: {
25
+ backgroundColor: {
26
+ md: theme.colors.categoryGreen,
27
+ xl: theme.colors.accentBackground,
28
+ },
29
+ boxShadow: '0px 0px 50px rgba(250, 250, 250, 0.6)',
30
+ },
31
+ },
32
+ },
33
+ },
34
+ }))
@@ -0,0 +1,7 @@
1
+ const reTextTokens = {
2
+ defaultProps: {
3
+ color: 'black',
4
+ },
5
+ };
6
+
7
+ export default reTextTokens;
@@ -0,0 +1,226 @@
1
+ import {StyleSheet} from 'react-native-unistyles'
2
+ import {hexToRgba} from '../style/utils'
3
+
4
+ const SliderTokens = {
5
+ defaultProps: {
6
+ size: 'normal',
7
+ colorPalette: 'primary',
8
+ },
9
+ maximumTrack: {
10
+ variants: {
11
+ size: {
12
+ material: {
13
+ height: 8,
14
+ },
15
+ normal: {
16
+ height: 40,
17
+ },
18
+ big: {
19
+ height: 80,
20
+ },
21
+ fader: {
22
+ height: 80,
23
+ },
24
+ },
25
+ },
26
+ },
27
+ minimumTrack: {
28
+ variants: {
29
+ size: {
30
+ material: {
31
+ height: 40,
32
+ },
33
+ normal: {
34
+ height: 40,
35
+ },
36
+ big: {
37
+ height: 80,
38
+ },
39
+ fader: {
40
+ height: 80,
41
+ },
42
+ },
43
+ },
44
+ },
45
+ thumb: {
46
+ variants: {
47
+ size: {
48
+ material: {
49
+ width: 40,
50
+ height: 40,
51
+ },
52
+ normal: {
53
+ width: 40,
54
+ height: 40,
55
+ },
56
+ big: {
57
+ width: 20,
58
+ height: 150,
59
+ },
60
+ fader: {
61
+ width: 20,
62
+ height: 80,
63
+ },
64
+ },
65
+ },
66
+ },
67
+ } as const
68
+ const SliderStyles = StyleSheet.create(theme => ({
69
+ container: {
70
+ variants: {
71
+ colorPalette: {
72
+ primary: {
73
+ backgroundColor: theme.colors.primary50,
74
+ },
75
+ secondary: {
76
+ backgroundColor: 'white',
77
+ },
78
+ tertiary: {
79
+ backgroundColor: 'black',
80
+ },
81
+ },
82
+ // size: {
83
+ // material: {
84
+ // height: 8,
85
+ // },
86
+ // normal: {
87
+ // height: 40,
88
+ // },
89
+ // big: {
90
+ // height: 80,
91
+ // },
92
+ // fader: {
93
+ // height: 80,
94
+ // },
95
+ // },
96
+ },
97
+ },
98
+ maximumTrack: {
99
+ variants: {
100
+ colorPalette: {
101
+ primary: {
102
+ backgroundColor: theme.colors.primary50,
103
+ },
104
+ secondary: {
105
+ backgroundColor: 'white',
106
+ },
107
+ tertiary: {
108
+ backgroundColor: 'black',
109
+ },
110
+ },
111
+ size: {
112
+ material: {
113
+ height: 8,
114
+ },
115
+ normal: {
116
+ height: 40,
117
+ },
118
+ big: {
119
+ height: 80,
120
+ },
121
+ fader: {
122
+ height: 80,
123
+ },
124
+ },
125
+ },
126
+ },
127
+ minimumTrack: (opacityTrack: boolean) => ({
128
+ variants: {
129
+ colorPalette: {
130
+ primary: {
131
+ backgroundColor: opacityTrack
132
+ ? hexToRgba(theme.colors.primary500, 0.5)
133
+ : theme.colors.primary500,
134
+ },
135
+ secondary: {
136
+ backgroundColor: opacityTrack
137
+ ? hexToRgba(theme.colors.primary100, 0.5)
138
+ : 'white',
139
+ },
140
+ tertiary: {
141
+ backgroundColor: opacityTrack
142
+ ? hexToRgba(theme.colors.primary100, 0.5)
143
+ : '#51e2be',
144
+ },
145
+ },
146
+ size: {
147
+ material: {
148
+ height: 40,
149
+ },
150
+ normal: {
151
+ height: 40,
152
+ },
153
+ big: {
154
+ height: 80,
155
+ },
156
+ fader: {
157
+ height: 80,
158
+ },
159
+ },
160
+ },
161
+ }),
162
+ thumb: {
163
+ variants: {
164
+ colorPalette: {
165
+ primary: {
166
+ backgroundColor: theme.colors.primary100,
167
+ },
168
+ secondary: {
169
+ backgroundColor: 'white',
170
+ },
171
+ tertiary: {
172
+ backgroundColor: '#51e2be',
173
+ },
174
+ },
175
+ // type: {
176
+ // material: {
177
+ // height: 40,
178
+ // },
179
+ // normal: {
180
+ // height: 40,
181
+ // },
182
+ // big: {
183
+ // height: 80,
184
+ // },
185
+ // fader: {
186
+ // height: 80,
187
+ // },
188
+ // },
189
+ size: {
190
+ material: {
191
+ width: 40,
192
+ height: 40,
193
+ },
194
+ normal: {
195
+ width: 40,
196
+ height: 40,
197
+ },
198
+ big: {
199
+ width: 20,
200
+ height: 150,
201
+ },
202
+ fader: {
203
+ width: 20,
204
+ height: 80,
205
+ },
206
+ },
207
+ },
208
+ },
209
+ step: {
210
+ variants: {
211
+ colorPalette: {
212
+ primary: {
213
+ backgroundColor: 'violet',
214
+ },
215
+ secondary: {
216
+ backgroundColor: 'white',
217
+ },
218
+ tertiary: {
219
+ backgroundColor: '#51e2be',
220
+ },
221
+ },
222
+ },
223
+ },
224
+ }))
225
+
226
+ export {SliderTokens, SliderStyles}