react-native-varia 0.0.1 → 0.2.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 (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
@@ -0,0 +1,191 @@
1
+ import {StyleSheet} from 'react-native-unistyles'
2
+ import {PalettesWithNestedKeys} from '../style/varia/types'
3
+
4
+ export const NumberInputDefaultVariants = {
5
+ variant: 'solid',
6
+ size: 'md',
7
+ distribution: 'horizontal',
8
+ } as const
9
+ export const NumberInputStyles = StyleSheet.create(theme => ({
10
+ container: (colorPalette: PalettesWithNestedKeys) => ({
11
+ variants: {
12
+ distribution: {
13
+ vertical: {
14
+ flexDirection: 'column',
15
+ },
16
+ horizontal: {
17
+ flexDirection: 'row',
18
+ },
19
+ },
20
+ variant: {
21
+ solid: {},
22
+ outline: {
23
+ gap: 5,
24
+ },
25
+ },
26
+ size: {
27
+ md: {},
28
+ lg: {},
29
+ xl: {},
30
+ },
31
+ },
32
+ }),
33
+ buttons: (colorPalette: PalettesWithNestedKeys) => ({
34
+ variants: {
35
+ distribution: {
36
+ vertical: {},
37
+ horizontal: {},
38
+ },
39
+ variant: {
40
+ solid: {
41
+ color: theme.colors[colorPalette]['1'],
42
+ borderColor: theme.colors.border.default,
43
+ borderWidth: 1,
44
+ borderRadius: theme.radii.sm,
45
+ },
46
+ outline: {
47
+ color: theme.colors[colorPalette]['1'],
48
+ borderColor: theme.colors.border.default,
49
+ borderWidth: 1,
50
+ borderRadius: theme.radii.sm,
51
+ },
52
+ },
53
+ size: {
54
+ md: {
55
+ minWidth: theme.sizes[10],
56
+ height: theme.sizes[10],
57
+ },
58
+ lg: {
59
+ minWidth: theme.sizes[11],
60
+ height: theme.sizes[11],
61
+ },
62
+ xl: {
63
+ minWidth: theme.sizes[12],
64
+ height: theme.sizes[12],
65
+ },
66
+ },
67
+ },
68
+ }),
69
+ decreaseTrigger: (colorPalette: PalettesWithNestedKeys) => ({
70
+ variants: {
71
+ distribution: {
72
+ vertical: {},
73
+ horizontal: {},
74
+ },
75
+ variant: {
76
+ solid: {},
77
+ outline: {},
78
+ ghost: {},
79
+ subtle: {},
80
+ },
81
+ size: {
82
+ md: {},
83
+ lg: {},
84
+ xl: {},
85
+ },
86
+ },
87
+ compoundVariants: [
88
+ {
89
+ variant: 'solid',
90
+ distribution: 'horizontal',
91
+ styles: {
92
+ borderRightWidth: 0,
93
+ borderTopRightRadius: 0,
94
+ borderBottomRightRadius: 0,
95
+ },
96
+ },
97
+ {
98
+ variant: 'solid',
99
+ distribution: 'vertical',
100
+ styles: {
101
+ borderTopWidth: 0,
102
+ borderTopLeftRadius: 0,
103
+ borderTopRightRadius: 0,
104
+ },
105
+ },
106
+ ],
107
+ }),
108
+ increaseTrigger: (colorPalette: PalettesWithNestedKeys) => ({
109
+ variants: {
110
+ distribution: {
111
+ vertical: {},
112
+ horizontal: {},
113
+ },
114
+ variant: {
115
+ solid: {},
116
+ outline: {},
117
+ ghost: {},
118
+ subtle: {},
119
+ },
120
+ size: {
121
+ md: {},
122
+ lg: {},
123
+ xl: {},
124
+ },
125
+ },
126
+ compoundVariants: [
127
+ {
128
+ variant: 'solid',
129
+ distribution: 'horizontal',
130
+ styles: {
131
+ borderLeftWidth: 0,
132
+ borderTopLeftRadius: 0,
133
+ borderBottomLeftRadius: 0,
134
+ },
135
+ },
136
+ {
137
+ variant: 'solid',
138
+ distribution: 'vertical',
139
+ styles: {
140
+ borderBottomWidth: 0,
141
+ borderBottomLeftRadius: 0,
142
+ borderBottomRightRadius: 0,
143
+ },
144
+ },
145
+ ],
146
+ }),
147
+ input: (colorPalette: PalettesWithNestedKeys) => ({
148
+ color: 'white',
149
+ alignSelf: 'stretch',
150
+ variants: {
151
+ distribution: {
152
+ vertical: {},
153
+ horizontal: {
154
+ flex: 1,
155
+ },
156
+ },
157
+ variant: {
158
+ solid: {
159
+ color: theme.colors.fg.default,
160
+ borderColor: theme.colors.border.default,
161
+ borderWidth: 1,
162
+ textAlign: 'center',
163
+ },
164
+ outline: {
165
+ color: theme.colors.fg.default,
166
+ borderRadius: theme.radii.sm,
167
+ borderColor: theme.colors.border.default,
168
+ borderWidth: 1,
169
+ textAlign: 'center',
170
+ },
171
+ },
172
+ size: {
173
+ md: {
174
+ fontSize: theme.fontSizes.md,
175
+ minHeight: theme.sizes[10],
176
+ maxHeight: theme.sizes[10],
177
+ },
178
+ lg: {
179
+ fontSize: theme.fontSizes.md,
180
+ minHeight: theme.sizes[11],
181
+ maxHeight: theme.sizes[11],
182
+ },
183
+ xl: {
184
+ fontSize: theme.fontSizes.lg,
185
+ minHeight: theme.sizes[12],
186
+ maxHeight: theme.sizes[12],
187
+ },
188
+ },
189
+ },
190
+ }),
191
+ }))
@@ -0,0 +1,163 @@
1
+ import {StyleSheet} from 'react-native-unistyles'
2
+ import {PalettesWithNestedKeys} from '../style/varia/types'
3
+ import {textStyle} from '../style/varia/textStyles'
4
+
5
+ export const RadioGroupDefaultVariants = {
6
+ variant: 'outline',
7
+ size: 'md',
8
+ checked: false,
9
+ } as const
10
+
11
+ export const RadioGroupStyles = StyleSheet.create(theme => ({
12
+ container: (colorPalette: PalettesWithNestedKeys) => ({
13
+ variants: {
14
+ variant: {
15
+ solid: {},
16
+ outline: {},
17
+ subtle: {},
18
+ },
19
+ checked: {
20
+ true: {},
21
+ false: {},
22
+ },
23
+ size: {
24
+ sm: {
25
+ gap: theme.sizes[2],
26
+ },
27
+ md: {
28
+ gap: theme.sizes[3],
29
+ },
30
+ lg: {
31
+ gap: theme.sizes[4],
32
+ },
33
+ },
34
+ },
35
+ }),
36
+
37
+ item: (colorPalette: PalettesWithNestedKeys) => ({
38
+ variants: {
39
+ variant: {
40
+ solid: {},
41
+ outline: {},
42
+ subtle: {},
43
+ },
44
+ checked: {
45
+ true: {},
46
+ false: {},
47
+ },
48
+ size: {
49
+ sm: {
50
+ gap: theme.sizes[2],
51
+ },
52
+ md: {
53
+ gap: theme.sizes[3],
54
+ },
55
+ lg: {
56
+ gap: theme.sizes[4],
57
+ },
58
+ },
59
+ },
60
+ compoundVariants: [
61
+ {
62
+ variant: 'solid',
63
+ checked: true,
64
+ styles: {},
65
+ },
66
+ {
67
+ variant: 'outline',
68
+ checked: true,
69
+ styles: {},
70
+ },
71
+ {
72
+ variant: 'subtle',
73
+ checked: true,
74
+ styles: {},
75
+ },
76
+ ],
77
+ }),
78
+
79
+ control: (colorPalette: PalettesWithNestedKeys) => ({
80
+ backgroundColor: 'transparent',
81
+ borderColor: theme.colors.border.default,
82
+ borderWidth: 1,
83
+ borderRadius: theme.radii.full,
84
+ alignItems: 'center',
85
+ justifyContent: 'center',
86
+ variants: {
87
+ variant: {
88
+ solid: {borderColor: theme.colors[colorPalette]['7']},
89
+ outline: {borderColor: theme.colors[colorPalette]['7']},
90
+ subtle: {borderColor: theme.colors[colorPalette]['5']},
91
+ },
92
+ size: {
93
+ sm: {width: theme.sizes[4], height: theme.sizes[4]},
94
+ md: {width: theme.sizes[5], height: theme.sizes[5]},
95
+ lg: {width: theme.sizes[6], height: theme.sizes[6]},
96
+ },
97
+ checked: {
98
+ true: {},
99
+ false: {},
100
+ },
101
+ },
102
+ compoundVariants: [
103
+ {
104
+ variant: 'outline',
105
+ checked: true,
106
+ styles: {borderColor: theme.colors[colorPalette].default},
107
+ },
108
+ {
109
+ variant: 'solid',
110
+ checked: true,
111
+ styles: {borderColor: theme.colors[colorPalette].default},
112
+ },
113
+ ],
114
+ }),
115
+
116
+ indicator: (colorPalette: PalettesWithNestedKeys) => ({
117
+ borderRadius: theme.radii.full,
118
+ variants: {
119
+ variant: {
120
+ solid: {backgroundColor: theme.colors[colorPalette].fg},
121
+ outline: {backgroundColor: theme.colors[colorPalette].default},
122
+ subtle: {backgroundColor: theme.colors[colorPalette].fg},
123
+ },
124
+ size: {
125
+ sm: {width: theme.sizes[2], height: theme.sizes[2]},
126
+ md: {width: theme.sizes[3], height: theme.sizes[3]},
127
+ lg: {width: theme.sizes['3.5'], height: theme.sizes['3.5']},
128
+ },
129
+ checked: {
130
+ true: {},
131
+ false: {display: 'none'},
132
+ },
133
+ },
134
+ }),
135
+
136
+ itemText: (colorPalette: PalettesWithNestedKeys) => ({
137
+ color: theme.colors.fg.default,
138
+ variants: {
139
+ variant: {
140
+ solid: {},
141
+ outline: {},
142
+ subtle: {},
143
+ },
144
+ size: {
145
+ sm: {
146
+ ...textStyle.sm,
147
+ },
148
+ md: {
149
+ ...textStyle.md,
150
+ },
151
+ lg: {
152
+ ...textStyle.lg,
153
+ },
154
+ },
155
+ checked: {
156
+ true: {
157
+ fontWeight: theme.fontWeights.semibold,
158
+ },
159
+ false: {},
160
+ },
161
+ },
162
+ }),
163
+ }))
@@ -1,7 +1,4 @@
1
- const reTextTokens = {
2
- defaultProps: {
3
- color: 'black',
4
- },
5
- };
6
-
7
- export default reTextTokens;
1
+ export {TextStyles as ReTextStyles} from './Text.recipe'
2
+ export const DefaultTextVariants = {
3
+ size: 'md',
4
+ } as const
@@ -0,0 +1,121 @@
1
+ import {StyleSheet} from 'react-native-unistyles'
2
+ import {PalettesWithNestedKeys} from '../style/varia/types'
3
+ import {textStyle} from '../style/varia/textStyles'
4
+
5
+ export const SelectDefaultVariants = {
6
+ variant: 'outline',
7
+ size: 'md',
8
+ } as const
9
+
10
+ export const SelectStyles = StyleSheet.create((theme, rt) => ({
11
+ trigger: (colorPalette: PalettesWithNestedKeys) => ({
12
+ variants: {
13
+ variant: {
14
+ outline: {
15
+ borderColor: theme.colors.border.default,
16
+ borderWidth: 1,
17
+ borderRadius: theme.radii.sm,
18
+ },
19
+ ghost: {
20
+ backgroundColor: 'transparent',
21
+ },
22
+ },
23
+ size: {
24
+ sm: {
25
+ height: theme.sizes[9],
26
+ },
27
+ md: {
28
+ height: theme.sizes[10],
29
+ },
30
+ lg: {
31
+ height: theme.sizes[11],
32
+ },
33
+ },
34
+ },
35
+ }),
36
+
37
+ overlay: (colorPalette: PalettesWithNestedKeys) => ({
38
+ backgroundColor: 'transparent',
39
+ variants: {
40
+ variant: {
41
+ outline: {},
42
+ ghost: {},
43
+ },
44
+ size: {
45
+ sm: {},
46
+ md: {},
47
+ lg: {},
48
+ },
49
+ },
50
+ }),
51
+
52
+ content: (colorPalette: PalettesWithNestedKeys) => ({
53
+ backgroundColor: theme.colors.bg.default,
54
+ maxHeight: '60%',
55
+ borderRadius: theme.radii.md,
56
+ marginHorizontal: 20,
57
+ variants: {
58
+ variant: {
59
+ outline: {
60
+ backgroundColor: 'blue',
61
+ },
62
+ ghost: {
63
+ backgroundColor: 'pink',
64
+ },
65
+ },
66
+ size: {
67
+ sm: {
68
+ padding: theme.spacing['0.5'],
69
+ },
70
+ md: {
71
+ padding: theme.spacing[1],
72
+ },
73
+ lg: {
74
+ padding: theme.spacing['1.5'],
75
+ },
76
+ },
77
+ },
78
+ }),
79
+
80
+ item: (colorPalette: PalettesWithNestedKeys, selected: boolean) => ({
81
+ paddingHorizontal: 8,
82
+ backgroundColor: selected ? theme.colors.gray.a3 : 'transparent',
83
+ variants: {
84
+ variant: {
85
+ outline: {},
86
+ ghost: {},
87
+ },
88
+ size: {
89
+ sm: {
90
+ height: theme.sizes[9],
91
+ },
92
+ md: {
93
+ height: theme.sizes[10],
94
+ },
95
+ lg: {
96
+ height: theme.sizes[11],
97
+ },
98
+ },
99
+ },
100
+ }),
101
+ itemText: (colorPalette: PalettesWithNestedKeys, selected: boolean) => ({
102
+ color: theme.colors.fg.default,
103
+ variants: {
104
+ variant: {
105
+ outline: {},
106
+ ghost: {},
107
+ },
108
+ size: {
109
+ sm: {
110
+ ...textStyle.sm,
111
+ },
112
+ md: {
113
+ ...textStyle.md,
114
+ },
115
+ lg: {
116
+ ...textStyle.md,
117
+ },
118
+ },
119
+ },
120
+ }),
121
+ }))