react-native-varia 0.0.1 → 0.2.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 (86) hide show
  1. package/bin/cli.js +35 -18
  2. package/lib/components/Badge.tsx +31 -32
  3. package/lib/components/Button.tsx +20 -20
  4. package/lib/components/Checkbox.tsx +95 -0
  5. package/lib/components/CircleProgress.tsx +56 -66
  6. package/lib/components/Field.tsx +137 -0
  7. package/lib/components/GradientBackground.tsx +17 -18
  8. package/lib/components/GradientText.tsx +25 -64
  9. package/lib/components/IconWrapper.tsx +32 -25
  10. package/lib/components/Input.tsx +66 -68
  11. package/lib/components/Link.tsx +14 -28
  12. package/lib/components/Modal.tsx +197 -97
  13. package/lib/components/NewSelect.tsx +202 -0
  14. package/lib/components/NumberInput.tsx +226 -0
  15. package/lib/components/RadioGroup.tsx +195 -0
  16. package/lib/components/ReText.tsx +53 -87
  17. package/lib/components/Select.tsx +272 -0
  18. package/lib/components/SelectOld.tsx +153 -0
  19. package/lib/components/Slider.tsx +32 -40
  20. package/lib/components/Slideshow.tsx +174 -261
  21. package/lib/components/SlidingDrawer.tsx +216 -265
  22. package/lib/components/Spinner.tsx +21 -12
  23. package/lib/components/Switch.tsx +133 -180
  24. package/lib/components/Switchold.tsx +174 -0
  25. package/lib/components/Text.tsx +36 -83
  26. package/lib/components/layoutTest.tsx +74 -0
  27. package/lib/patterns/index.tsx +143 -202
  28. package/lib/theme/Badge.recipe.tsx +44 -39
  29. package/lib/theme/Button.recipe.tsx +139 -48
  30. package/lib/theme/Checkbox.recipe.tsx +121 -0
  31. package/lib/theme/CircleProgress.recipe.tsx +16 -22
  32. package/lib/theme/Field.recipe.tsx +66 -0
  33. package/lib/theme/GradientBackground.recipe.tsx +7 -20
  34. package/lib/theme/GradientText.recipe.tsx +42 -28
  35. package/lib/theme/IconWrapper.recipe.tsx +10 -85
  36. package/lib/theme/Input.recipe.tsx +76 -83
  37. package/lib/theme/Link.recipe.tsx +16 -43
  38. package/lib/theme/Modal.recipe.tsx +59 -21
  39. package/lib/theme/NumberInput.recipe.tsx +191 -0
  40. package/lib/theme/RadioGroup.recipe.tsx +163 -0
  41. package/lib/theme/ReText.recipe.tsx +4 -7
  42. package/lib/theme/Select.recipe.tsx +121 -0
  43. package/lib/theme/Slider.recipe.tsx +97 -181
  44. package/lib/theme/Slideshow.recipe.tsx +24 -102
  45. package/lib/theme/SlidingDrawer.recipe.tsx +21 -59
  46. package/lib/theme/Spinner.recipe.tsx +28 -3
  47. package/lib/theme/Switch.recipe.tsx +75 -54
  48. package/lib/theme/Text.recipe.tsx +66 -8
  49. package/lib/theme/animations.tsx +13 -0
  50. package/lib/varia/colorPalettes/amber.ts +54 -0
  51. package/lib/varia/colorPalettes/blue.ts +54 -0
  52. package/lib/varia/colorPalettes/bronze.ts +54 -0
  53. package/lib/varia/colorPalettes/brown.ts +54 -0
  54. package/lib/varia/colorPalettes/crimson.ts +55 -0
  55. package/lib/varia/colorPalettes/cyan.ts +54 -0
  56. package/lib/varia/colorPalettes/gold.ts +54 -0
  57. package/lib/varia/colorPalettes/grass.ts +54 -0
  58. package/lib/varia/colorPalettes/green.ts +54 -0
  59. package/lib/varia/colorPalettes/indigo.ts +54 -0
  60. package/lib/varia/colorPalettes/iris.ts +54 -0
  61. package/lib/varia/colorPalettes/jade.ts +54 -0
  62. package/lib/varia/colorPalettes/lime.ts +55 -0
  63. package/lib/varia/colorPalettes/mauve.ts +54 -0
  64. package/lib/varia/colorPalettes/mint.ts +54 -0
  65. package/lib/varia/colorPalettes/neutral.ts +54 -0
  66. package/lib/varia/colorPalettes/olive.ts +54 -0
  67. package/lib/varia/colorPalettes/orange.ts +54 -0
  68. package/lib/varia/colorPalettes/pink.ts +54 -0
  69. package/lib/varia/colorPalettes/plum.ts +54 -0
  70. package/lib/varia/colorPalettes/purple.ts +56 -0
  71. package/lib/varia/colorPalettes/red.ts +55 -0
  72. package/lib/varia/colorPalettes/ruby.ts +56 -0
  73. package/lib/varia/colorPalettes/sage.ts +56 -0
  74. package/lib/varia/colorPalettes/sand.ts +56 -0
  75. package/lib/varia/colorPalettes/sky.ts +56 -0
  76. package/lib/varia/colorPalettes/slate.ts +56 -0
  77. package/lib/varia/colorPalettes/teal.ts +56 -0
  78. package/lib/varia/colorPalettes/tomato.ts +56 -0
  79. package/lib/varia/colorPalettes/violet.ts +56 -0
  80. package/lib/varia/colorPalettes/yellow.ts +56 -0
  81. package/lib/varia/defaultTheme.ts +174 -0
  82. package/lib/varia/mixins.ts +223 -0
  83. package/lib/varia/textStyles.ts +48 -0
  84. package/lib/varia/types.ts +277 -0
  85. package/lib/varia/utils.ts +283 -0
  86. package/package.json +1 -1
@@ -1,226 +1,142 @@
1
1
  import {StyleSheet} from 'react-native-unistyles'
2
- import {hexToRgba} from '../style/utils'
2
+ import {hexToRgba} from '../style/varia/utils'
3
+ import {PalettesWithNestedKeys} from '../style/varia/types'
3
4
 
4
- const SliderTokens = {
5
- defaultProps: {
6
- size: 'normal',
7
- colorPalette: 'primary',
8
- },
9
- maximumTrack: {
5
+ export const SliderDefaultVariants = {
6
+ size: 'md',
7
+ variant: 'solid',
8
+ } as const
9
+ export const SliderStyles = StyleSheet.create(theme => ({
10
+ container: (colorPalette: PalettesWithNestedKeys) => ({
11
+ backgroundColor: theme.colors.bg.emphasized,
12
+ borderRadius: theme.radii.full,
10
13
  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
- },
14
+ variant: {
15
+ solid: {},
24
16
  },
25
- },
26
- },
27
- minimumTrack: {
28
- variants: {
29
17
  size: {
30
- material: {
31
- height: 40,
18
+ xs: {
19
+ height: theme.sizes[2],
32
20
  },
33
- normal: {
34
- height: 40,
21
+ sm: {
22
+ height: theme.sizes[4],
35
23
  },
36
- big: {
37
- height: 80,
24
+ md: {
25
+ height: theme.sizes[5],
38
26
  },
39
- fader: {
40
- height: 80,
27
+ lg: {
28
+ height: theme.sizes[8],
29
+ },
30
+ xl: {
31
+ height: theme.sizes[10],
41
32
  },
42
33
  },
43
34
  },
44
- },
45
- thumb: {
35
+ }),
36
+ maximumTrack: (colorPalette: PalettesWithNestedKeys) => ({
37
+ backgroundColor: theme.colors.bg.emphasized,
38
+ borderRadius: theme.radii.full,
46
39
  variants: {
40
+ variant: {
41
+ solid: {},
42
+ },
47
43
  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,
44
+ xs: {
45
+ height: theme.sizes[2],
59
46
  },
60
- fader: {
61
- width: 20,
62
- height: 80,
47
+ sm: {
48
+ height: theme.sizes[4],
63
49
  },
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,
50
+ md: {
51
+ height: theme.sizes[5],
74
52
  },
75
- secondary: {
76
- backgroundColor: 'white',
53
+ lg: {
54
+ height: theme.sizes[8],
77
55
  },
78
- tertiary: {
79
- backgroundColor: 'black',
56
+ xl: {
57
+ height: theme.sizes[10],
80
58
  },
81
59
  },
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
60
  },
97
- },
98
- maximumTrack: {
61
+ }),
62
+ minimumTrack: (
63
+ colorPalette: PalettesWithNestedKeys,
64
+ opacityTrack: boolean,
65
+ ) => ({
66
+ backgroundColor: opacityTrack
67
+ ? hexToRgba(theme.colors[colorPalette].default, 0.5)
68
+ : theme.colors[colorPalette].default,
99
69
  variants: {
100
- colorPalette: {
101
- primary: {
102
- backgroundColor: theme.colors.primary50,
103
- },
104
- secondary: {
105
- backgroundColor: 'white',
106
- },
107
- tertiary: {
108
- backgroundColor: 'black',
109
- },
70
+ variant: {
71
+ solid: {},
110
72
  },
111
73
  size: {
112
- material: {
113
- height: 8,
74
+ xs: {
75
+ height: theme.sizes[2],
76
+ },
77
+ sm: {
78
+ height: theme.sizes[4],
114
79
  },
115
- normal: {
116
- height: 40,
80
+ md: {
81
+ height: theme.sizes[5],
117
82
  },
118
- big: {
119
- height: 80,
83
+ lg: {
84
+ height: theme.sizes[8],
120
85
  },
121
- fader: {
122
- height: 80,
86
+ xl: {
87
+ height: theme.sizes[10],
123
88
  },
124
89
  },
125
90
  },
126
- },
127
- minimumTrack: (opacityTrack: boolean) => ({
91
+ }),
92
+ thumb: (colorPalette: PalettesWithNestedKeys) => ({
93
+ backgroundColor: theme.colors.bg.default,
94
+ borderColor: theme.colors[colorPalette].default,
95
+ borderRadius: theme.radii.full,
96
+ borderWidth: 2,
128
97
  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
- },
98
+ variant: {
99
+ solid: {},
145
100
  },
146
101
  size: {
147
- material: {
148
- height: 40,
102
+ xs: {
103
+ width: theme.sizes[4],
104
+ height: theme.sizes[4],
105
+ },
106
+ sm: {
107
+ width: theme.sizes[6],
108
+ height: theme.sizes[6],
149
109
  },
150
- normal: {
151
- height: 40,
110
+ md: {
111
+ width: theme.sizes[7],
112
+ height: theme.sizes[7],
152
113
  },
153
- big: {
154
- height: 80,
114
+ lg: {
115
+ width: theme.sizes[8],
116
+ height: theme.sizes[8],
155
117
  },
156
- fader: {
157
- height: 80,
118
+ xl: {
119
+ width: theme.sizes[11],
120
+ height: theme.sizes[11],
158
121
  },
159
122
  },
160
123
  },
161
124
  }),
162
- thumb: {
125
+ step: (colorPalette: PalettesWithNestedKeys) => ({
126
+ // TODO: type correctly theme.colors
127
+ // @ts-ignore
128
+ backgroundColor: theme.colors.white['0'],
163
129
  variants: {
164
- colorPalette: {
165
- primary: {
166
- backgroundColor: theme.colors.primary100,
167
- },
168
- secondary: {
169
- backgroundColor: 'white',
170
- },
171
- tertiary: {
172
- backgroundColor: '#51e2be',
173
- },
130
+ variant: {
131
+ solid: {},
174
132
  },
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
133
  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
- },
134
+ xs: {},
135
+ sm: {},
136
+ md: {},
137
+ lg: {},
138
+ xl: {},
221
139
  },
222
140
  },
223
- },
141
+ }),
224
142
  }))
225
-
226
- export {SliderTokens, SliderStyles}
@@ -1,8 +1,9 @@
1
- import { StyleSheet } from 'react-native-unistyles';
1
+ import {StyleSheet} from 'react-native-unistyles'
2
+ import {PalettesWithNestedKeys} from '../style/varia/types'
2
3
 
3
4
  export const SlideshowTokens = {
4
5
  defaultProps: {
5
- colorScheme: 'primary',
6
+ variant: 'solid',
6
7
  spacing: 'default',
7
8
  animation: 'defaultSpring',
8
9
  },
@@ -32,111 +33,32 @@ export const SlideshowTokens = {
32
33
  duration: 300,
33
34
  },
34
35
  },
35
- }
36
- }
36
+ },
37
+ },
37
38
  } as const
38
39
 
39
- export const SlideshowStyles = StyleSheet.create((theme) => ({
40
- container: {
40
+ export const SlideshowStyles = StyleSheet.create(theme => ({
41
+ container: (colorPalette: PalettesWithNestedKeys) => ({
42
+ backgroundColor: theme.colors.bg.default,
41
43
  variants: {
42
- colorPalette: {
43
- primary: {
44
- backgroundColor: theme.colors.background,
45
- borderColor: theme.colors.foreground,
46
- borderWidth: 0,
47
- borderRadius: 0,
48
- },
49
- secondary: {
50
- backgroundColor: theme.colors.background,
51
- borderColor: 'blue',
52
- borderWidth: 5,
53
- borderRadius: 20,
54
- },
55
- tertiary: {
56
- backgroundColor: theme.colors.foreground,
57
- borderColor: theme.colors.foreground,
58
- borderWidth: 0,
59
- borderRadius: 0,
60
- },
61
- },
62
- spacing: {
63
- // default: {
64
- // margin: 10,
65
- // },
66
- // large: {
67
- // margin: 20,
68
- // },
69
- // small: {
70
- // margin: 5,
71
- // },
72
- // none: {
73
- // margin: 0,
74
- // },
44
+ variant: {
45
+ solid: {},
46
+ outline: {},
75
47
  },
76
- }
77
- },
78
- // animation: {
79
- // defaultSpring: {
80
- // type: 'withSpring',
81
- // props: {
82
- // damping: 20,
83
- // stiffness: 200,
84
- // mass: 1,
85
- // overshootClamping: true,
86
- // },
87
- // },
88
- // slowSpring: {
89
- // type: 'withSpring',
90
- // props: {
91
- // damping: 200,
92
- // stiffness: 20,
93
- // mass: 10,
94
- // overshootClamping: true,
95
- // },
96
- // },
97
- // defaultTiming: {
98
- // type: 'withTiming',
99
- // props: {
100
- // duration: 300,
101
- // },
102
- // },
103
- // },
104
- slideContainer: {
48
+ },
49
+ }),
50
+ slideContainer: (colorPalette: PalettesWithNestedKeys) => ({
51
+ backgroundColor: 'transparent',
105
52
  variants: {
106
- colorPalette: {
107
- primary: {
108
- backgroundColor: 'transparent',
109
- borderWidth: 0,
110
- borderRadius: 0,
111
- borderColor: 'transparent',
112
- },
113
- secondary: {
114
- backgroundColor: 'transparent',
115
- borderWidth: 0,
116
- borderRadius: 20,
117
- borderColor: 'transparent',
118
- },
119
- tertiary: {
120
- backgroundColor: "transparent",
121
- borderWidth: 5,
122
- borderRadius: 20,
123
- borderColor: 'black',
124
- },
125
- },
126
- spacing: {
127
- default: {
128
- margin: 10,
129
- },
130
- large: {
131
- margin: 20,
132
- },
133
- small: {
134
- margin: 5,
135
- },
136
- none: {
137
- margin: 0,
53
+ variant: {
54
+ solid: {},
55
+ outline: {
56
+ borderColor: theme.colors.border.default,
57
+ borderWidth: 1,
58
+ borderRadius: theme.radii['3xl'],
59
+ margin: theme.spacing[2],
138
60
  },
139
61
  },
140
62
  },
141
- },
142
- }));
63
+ }),
64
+ }))
@@ -1,12 +1,10 @@
1
- import { StyleSheet } from 'react-native-unistyles';
1
+ import {StyleSheet} from 'react-native-unistyles'
2
+ import {PalettesWithNestedKeys} from '../style/varia/types'
2
3
 
3
4
  export const SlidingDrawerTokens = {
4
5
  defaultProps: {
5
- colorScheme: 'primary',
6
- animation: "defaultSpring",
7
- backgroundColor: "white",
8
- borderRadius: 16,
9
- boxShadow: '0px -10px 20px rgba(100, 0, 250, 0.6)',
6
+ variant: 'solid',
7
+ animation: 'defaultSpring',
10
8
  },
11
9
  variants: {
12
10
  animation: {
@@ -33,59 +31,23 @@ export const SlidingDrawerTokens = {
33
31
  props: {
34
32
  duration: 1000,
35
33
  },
36
- }
34
+ },
37
35
  },
38
- }
39
- }
40
- export const SlidingDrawerStyles = StyleSheet.create((theme) => ({
41
- // defaultProps: {
42
- // colorScheme: 'primary',
43
- // animation: "defaultSpring",
44
- // backgroundColor: "white",
45
- // borderRadius: 16,
46
- // boxShadow: '0px -10px 20px rgba(100, 0, 250, 0.6)',
47
- // },
48
- container: {
36
+ },
37
+ } as const
38
+ export const SlidingDrawerStyles = StyleSheet.create(theme => ({
39
+ container: (colorPalette: PalettesWithNestedKeys) => ({
40
+ boxShadow: `0px -10px 20px black`,
41
+ borderRadius: theme.radii.lg,
42
+ backgroundColor: theme.colors.bg.default,
43
+ padding: theme.spacing[3],
49
44
  variants: {
50
- colorPalette: {
51
- primary: {
52
- backgroundColor: theme.colors.accentBackground,
53
- // boxShadow: '0px -10px 20px #000000',
54
- },
55
- secondary: {
56
- backgroundColor: "white",
57
- // boxShadow: `0px -10px 20px lime`,
58
- },
59
- tertiary: {
60
- backgroundColor: 'lime',
61
- },
45
+ variant: {
46
+ solid: {},
62
47
  },
63
- // animation: {
64
- // defaultSpring: {
65
- // type: 'withSpring' as const,
66
- // props: {
67
- // damping: 20,
68
- // stiffness: 200,
69
- // mass: 1,
70
- // overshootClamping: true,
71
- // },
72
- // },
73
- // slowSpring: {
74
- // type: 'withSpring' as const,
75
- // props: {
76
- // damping: 200,
77
- // stiffness: 20,
78
- // mass: 10,
79
- // overshootClamping: true,
80
- // },
81
- // },
82
- // defaultTiming: {
83
- // type: 'withTiming' as const,
84
- // props: {
85
- // duration: 1000,
86
- // },
87
- // },
88
- // },
89
- }
90
- }
91
- }));
48
+ },
49
+ }),
50
+ backdrop: (colorPalette: PalettesWithNestedKeys) => ({
51
+ backgroundColor: theme.colors.backdrop,
52
+ }),
53
+ }))
@@ -1,8 +1,33 @@
1
- import {SliderTokensType} from '../style/types'
1
+ import {StyleSheet} from 'react-native-unistyles'
2
+ import {SliderTokensType} from '../style/varia/types'
2
3
 
3
4
  export const SpinnerTokens = {
4
5
  defaultProps: {
5
- size: 24,
6
- color: 'categoryOrange',
6
+ size: 'xl',
7
+ color: 'colorPalette.9',
7
8
  },
8
9
  } as SliderTokensType
10
+
11
+ export const SpinnerStyles = StyleSheet.create(theme => ({
12
+ base: {
13
+ variants: {
14
+ size: {
15
+ xs: {
16
+ width: theme.sizes[3],
17
+ },
18
+ sm: {
19
+ width: theme.sizes[4],
20
+ },
21
+ md: {
22
+ width: theme.sizes[6],
23
+ },
24
+ lg: {
25
+ width: theme.sizes[8],
26
+ },
27
+ xl: {
28
+ width: theme.sizes[12],
29
+ },
30
+ },
31
+ },
32
+ },
33
+ }))