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,68 +1,73 @@
1
1
  import {StyleSheet} from 'react-native-unistyles'
2
+ import {PalettesWithNestedKeys} from '../style/varia/types'
3
+ import {textStyle} from '../style/varia/textStyles'
2
4
 
3
- const BadgeStyles = StyleSheet.create(theme => ({
4
- container: {
5
+ export const BadgeDefaultVariants = {
6
+ variant: 'solid',
7
+ size: 'sm',
8
+ } as const
9
+
10
+ export const BadgeStyles = StyleSheet.create(theme => ({
11
+ container: (colorPalette: PalettesWithNestedKeys) => ({
5
12
  variants: {
6
- colorPalette: {
7
- primary: {
8
- backgroundColor: 'tomato',
9
- borderColor: 'tomato',
13
+ variant: {
14
+ solid: {
15
+ backgroundColor: theme.colors[colorPalette].default,
16
+ borderColor: theme.colors[colorPalette].fg,
17
+ },
18
+ subtle: {
19
+ backgroundColor: theme.colors.bg.subtle,
20
+ borderColor: theme.colors.border.subtle,
21
+ borderWidth: 1,
10
22
  },
11
- secondary: {
12
- backgroundColor: theme.colors.foreground,
13
- borderColor: theme.colors.categoryAquamarine,
23
+ outline: {
24
+ borderWidth: 2,
25
+ borderColor: theme.colors.border.default,
14
26
  },
15
27
  },
16
28
  size: {
17
29
  sm: {
18
- height: 32,
19
- maxHeight: 32,
20
- padding: 6,
30
+ height: theme.sizes[5],
31
+ maxHeight: theme.sizes[5],
32
+ minWidth: theme.sizes[5],
21
33
  },
22
34
  md: {
23
- maxHeight: 48,
24
- height: 48,
25
- padding: 8,
35
+ maxHeight: theme.sizes[6],
36
+ height: theme.sizes[6],
37
+ minWidth: theme.sizes[6],
26
38
  },
27
39
  lg: {
28
- maxHeight: 64,
29
- height: 64,
30
- padding: 12,
31
- },
32
- xl: {
33
- maxHeight: 80,
34
- height: 80,
35
- padding: 16,
40
+ maxHeight: theme.sizes[7],
41
+ height: theme.sizes[7],
42
+ minWidth: theme.sizes[7],
36
43
  },
37
44
  },
38
45
  },
39
- },
40
- text: {
46
+ }),
47
+ text: (colorPalette: PalettesWithNestedKeys) => ({
41
48
  variants: {
42
- colorPalette: {
43
- primary: {
44
- color: 'white',
49
+ variant: {
50
+ solid: {
51
+ color: theme.colors[colorPalette].fg,
45
52
  },
46
- secondary: {
47
- color: theme.colors.categoryAquamarine,
53
+ subtle: {
54
+ color: theme.colors.fg.default,
55
+ },
56
+ outline: {
57
+ color: theme.colors.fg.default,
48
58
  },
49
59
  },
50
60
  size: {
51
61
  sm: {
52
- fontSize: 24,
62
+ ...textStyle.xs,
53
63
  },
54
64
  md: {
55
- fontSize: 28,
65
+ ...textStyle.xs,
56
66
  },
57
67
  lg: {
58
- fontSize: 32,
59
- },
60
- xl: {
61
- fontSize: 36,
68
+ ...textStyle.sm,
62
69
  },
63
70
  },
64
71
  },
65
- },
72
+ }),
66
73
  }))
67
-
68
- export default BadgeStyles
@@ -1,83 +1,174 @@
1
1
  import {StyleSheet} from 'react-native-unistyles'
2
+ import {PalettesWithNestedKeys} from '../style/varia/types'
3
+ import {textStyle} from '../style/varia/textStyles'
2
4
 
3
- export const ButtonTokens = {
4
- defaultProps: {
5
- colorPalette: 'primary',
6
- size: 'md',
7
- },
5
+ export const ButtonDefaultVariants = {
6
+ variant: 'solid',
7
+ size: 'md',
8
8
  } as const
9
9
  export const ButtonStyles = StyleSheet.create(theme => ({
10
- container: {
10
+ container: (colorPalette: PalettesWithNestedKeys) => ({
11
+ borderRadius: 12,
11
12
  variants: {
12
- colorPalette: {
13
- primary: {
14
- backgroundColor: theme.colors.primary500,
15
- borderColor: theme.colors.accentBackground,
13
+ variant: {
14
+ solid: {
15
+ backgroundColor: theme.colors[colorPalette].default,
16
16
  },
17
- secondary: {
18
- backgroundColor: theme.colors.foreground,
17
+ outline: {
18
+ borderWidth: 1,
19
+ borderColor: theme.colors[colorPalette].a7,
20
+ },
21
+ ghost: {
22
+ backgroundColor: 'transparent',
23
+ },
24
+ subtle: {
25
+ backgroundColor: theme.colors[colorPalette]['a3'],
19
26
  },
20
27
  },
21
28
  size: {
29
+ xs: {
30
+ minHeight: theme.sizes[8],
31
+ paddingHorizontal: theme.sizes[3],
32
+ paddingVertical: theme.sizes['1.5'],
33
+ gap: theme.spacing[2],
34
+ },
22
35
  sm: {
23
- // height: 32,
24
- // maxHeight: 32,
25
- padding: 6,
26
- borderRadius: theme.radii.sm,
27
- borderWidth: 1,
36
+ minHeight: theme.sizes[9],
37
+ paddingHorizontal: theme.sizes['3.5'],
38
+ paddingVertical: theme.sizes[2],
39
+ gap: theme.spacing[2],
28
40
  },
29
41
  md: {
30
- // maxHeight: 48,
31
- // height: 48,
32
- padding: 8,
33
- borderRadius: theme.radii.md,
34
- borderWidth: 1,
42
+ minHeight: theme.sizes[10],
43
+ paddingHorizontal: theme.sizes[4],
44
+ paddingVertical: theme.sizes[2],
45
+ gap: theme.spacing[2],
35
46
  },
36
47
  lg: {
37
- // maxHeight: 64,
38
- // height: 64,
39
- padding: 12,
40
- borderRadius: theme.radii.lg,
41
- borderWidth: 1,
48
+ minHeight: theme.sizes[11],
49
+ paddingHorizontal: theme.sizes['4.5'],
50
+ paddingVertical: theme.sizes[2],
51
+ gap: theme.spacing[2],
42
52
  },
43
53
  xl: {
44
- // maxHeight: 80,
45
- // height: 80,
46
- padding: 16,
47
- borderRadius: theme.radii.xl,
48
- borderWidth: 5,
54
+ minHeight: theme.sizes[12],
55
+ paddingHorizontal: theme.sizes[5],
56
+ paddingVertical: theme.sizes[2],
57
+ gap: theme.spacing['2.5'],
58
+ },
59
+ '2xl': {
60
+ minHeight: theme.sizes[16],
61
+ paddingHorizontal: theme.sizes[7],
62
+ paddingVertical: theme.sizes[3],
63
+ gap: theme.spacing[3],
49
64
  },
50
65
  },
66
+ disabled: {
67
+ true: {},
68
+ false: {},
69
+ },
51
70
  },
52
- },
53
- text: {
71
+ compoundVariants: [
72
+ {
73
+ variant: 'solid',
74
+ disabled: true,
75
+ styles: {
76
+ backgroundColor: theme.colors.bg.disabled,
77
+ },
78
+ },
79
+ {
80
+ variant: 'outline',
81
+ disabled: true,
82
+ styles: {
83
+ borderColor: theme.colors.border.disabled,
84
+ },
85
+ },
86
+ {
87
+ variant: 'ghost',
88
+ disabled: true,
89
+ styles: {
90
+ backgroundColor: 'transparent',
91
+ },
92
+ },
93
+ {
94
+ variant: 'subtle',
95
+ disabled: true,
96
+ styles: {
97
+ backgroundColor: theme.colors.bg.disabled,
98
+ },
99
+ },
100
+ ],
101
+ }),
102
+ text: (colorPalette: PalettesWithNestedKeys) => ({
54
103
  variants: {
55
- colorPalette: {
56
- primary: {
57
- color: 'white',
104
+ variant: {
105
+ solid: {
106
+ color: theme.colors[colorPalette].fg,
107
+ },
108
+ outline: {
109
+ color: theme.colors[colorPalette].text,
110
+ },
111
+ ghost: {
112
+ color: theme.colors.gray.text,
58
113
  },
59
- secondary: {
60
- color: theme.colors.categoryAquamarine,
114
+ subtle: {
115
+ color: theme.colors[colorPalette].text,
61
116
  },
62
117
  },
118
+ disabled: {
119
+ true: {},
120
+ false: {},
121
+ },
63
122
  size: {
123
+ xs: {
124
+ ...textStyle.xs,
125
+ },
64
126
  sm: {
65
- fontSize: 24,
66
- fontWeight: '400',
127
+ ...textStyle.sm,
67
128
  },
68
129
  md: {
69
- fontSize: 28,
70
- fontWeight: '400',
130
+ ...textStyle.sm,
71
131
  },
72
132
  lg: {
73
- fontSize: 32,
74
- fontWeight: '600',
133
+ ...textStyle.md,
75
134
  },
76
135
  xl: {
77
- fontSize: 36,
78
- fontWeight: '800',
136
+ ...textStyle.md,
137
+ },
138
+ '2xl': {
139
+ ...textStyle.lg,
79
140
  },
80
141
  },
81
142
  },
82
- },
143
+ compoundVariants: [
144
+ {
145
+ variant: 'solid',
146
+ disabled: true,
147
+ styles: {
148
+ color: theme.colors[colorPalette].fg,
149
+ },
150
+ },
151
+ {
152
+ variant: 'outline',
153
+ disabled: true,
154
+ styles: {
155
+ color: theme.colors.fg.disabled,
156
+ },
157
+ },
158
+ {
159
+ variant: 'ghost',
160
+ disabled: true,
161
+ styles: {
162
+ color: theme.colors.fg.disabled,
163
+ },
164
+ },
165
+ {
166
+ variant: 'subtle',
167
+ disabled: true,
168
+ styles: {
169
+ color: theme.colors.fg.disabled,
170
+ },
171
+ },
172
+ ],
173
+ }),
83
174
  }))
@@ -0,0 +1,121 @@
1
+ import {StyleSheet} from 'react-native-unistyles'
2
+ import {PalettesWithNestedKeys} from '../style/varia/types'
3
+
4
+ export const CheckboxDefaultVariants = {
5
+ variant: 'solid',
6
+ size: 'md',
7
+ checked: false,
8
+ } as const
9
+
10
+ export const CheckboxStyles = StyleSheet.create(theme => ({
11
+ container: (colorPalette: PalettesWithNestedKeys) => ({
12
+ variants: {
13
+ variant: {
14
+ solid: {},
15
+ },
16
+ checked: {
17
+ true: {},
18
+ false: {},
19
+ },
20
+ size: {
21
+ sm: {
22
+ gap: theme.sizes[2],
23
+ },
24
+ md: {
25
+ gap: theme.sizes[3],
26
+ },
27
+ lg: {
28
+ gap: theme.sizes[4],
29
+ },
30
+ },
31
+ },
32
+ }),
33
+ checkContainer: (colorPalette: PalettesWithNestedKeys) => ({
34
+ borderRadius: theme.radii['xs'],
35
+ borderWidth: 1,
36
+ borderColor: theme.colors.border.default,
37
+ variants: {
38
+ variant: {
39
+ solid: {
40
+ backgroundColor: 'transparent',
41
+ },
42
+ },
43
+ checked: {
44
+ true: {},
45
+ false: {},
46
+ },
47
+ size: {
48
+ sm: {
49
+ width: theme.sizes[4],
50
+ height: theme.sizes[4],
51
+ },
52
+ md: {
53
+ width: theme.sizes[5],
54
+ height: theme.sizes[5],
55
+ },
56
+ lg: {
57
+ width: theme.sizes[6],
58
+ height: theme.sizes[6],
59
+ },
60
+ },
61
+ },
62
+ compoundVariants: [
63
+ {
64
+ variant: 'solid',
65
+ checked: true,
66
+ styles: {
67
+ backgroundColor: theme.colors[colorPalette].default,
68
+ borderColor: theme.colors[colorPalette].default,
69
+ },
70
+ },
71
+ ],
72
+ }),
73
+ check: (colorPalette: PalettesWithNestedKeys) => ({
74
+ variants: {
75
+ variant: {
76
+ solid: {
77
+ color: theme.colors[colorPalette].fg,
78
+ },
79
+ },
80
+ checked: {
81
+ true: {},
82
+ false: {},
83
+ },
84
+ size: {
85
+ sm: {
86
+ width: theme.sizes[3],
87
+ },
88
+ md: {
89
+ width: theme.sizes['3.5'],
90
+ },
91
+ lg: {
92
+ width: theme.sizes[4],
93
+ },
94
+ },
95
+ },
96
+ }),
97
+ label: (colorPalette: PalettesWithNestedKeys) => ({
98
+ color: theme.colors.fg.default,
99
+ fontWeight: '500',
100
+ variants: {
101
+ variant: {
102
+ solid: {},
103
+ },
104
+ checked: {
105
+ true: {},
106
+ false: {},
107
+ },
108
+ size: {
109
+ sm: {
110
+ fontSize: 14,
111
+ },
112
+ md: {
113
+ fontSize: 16,
114
+ },
115
+ lg: {
116
+ fontSize: 18,
117
+ },
118
+ },
119
+ },
120
+ }),
121
+ }))
@@ -1,42 +1,36 @@
1
- const circleProgressTokens = {
1
+ import {createCircleProgressTokens} from '../style/varia/types'
2
+
3
+ const circleProgressTokens = createCircleProgressTokens({
2
4
  defaultProps: {
3
- type: 'primary',
5
+ variant: 'solid',
4
6
  size: 'lg',
5
- // circleSize: 'md',
6
7
  },
7
8
  variants: {
8
9
  size: {
9
10
  sm: {
10
11
  trackStrokeWidth: 10,
11
12
  progressStrokeWidth: 8,
12
- size: 80,
13
13
  },
14
14
  md: {
15
- trackStrokeWidth: 16,
16
- progressStrokeWidth: 14,
17
- size: 100,
15
+ trackStrokeWidth: 20,
16
+ progressStrokeWidth: 30,
18
17
  },
19
18
  lg: {
20
- trackStrokeWidth: 20,
21
- progressStrokeWidth: 6,
22
- size: 100,
19
+ trackStrokeWidth: 40,
20
+ progressStrokeWidth: 32,
23
21
  },
24
22
  },
25
- type: {
26
- primary: {
27
- trackColor: 'accentLines',
28
- progressColor: 'categoryAquamarine',
29
- },
30
- secondary: {
31
- trackColor: 'background',
32
- progressColor: 'foreground',
23
+ variant: {
24
+ solid: {
25
+ trackColor: 'transparent',
26
+ progressColor: 'colorPalette.9',
33
27
  },
34
- tertiary: {
35
- trackColor: 'background',
36
- progressColor: 'foreground',
28
+ outline: {
29
+ trackColor: 'accent.9',
30
+ progressColor: 'accent.fg',
37
31
  },
38
32
  },
39
33
  },
40
- } as const
34
+ })
41
35
 
42
36
  export {circleProgressTokens}
@@ -0,0 +1,66 @@
1
+ import {StyleSheet} from 'react-native-unistyles'
2
+ import {PalettesWithNestedKeys} from '../style/varia/types'
3
+
4
+ export const DefaultFieldVariants = {
5
+ size: 'md',
6
+ variant: 'solid',
7
+ } as const
8
+ export const FieldStyles = StyleSheet.create(theme => ({
9
+ root: (colorPalette: PalettesWithNestedKeys) => ({
10
+ variants: {
11
+ variant: {
12
+ solid: {},
13
+ },
14
+ size: {
15
+ xs: {gap: theme.spacing['0.5']},
16
+ sm: {gap: theme.spacing['1']},
17
+ md: {gap: theme.spacing['2']},
18
+ lg: {gap: theme.spacing['3']},
19
+ },
20
+ },
21
+ }),
22
+ label: (colorPalette: PalettesWithNestedKeys) => ({
23
+ color: theme.colors.fg.default,
24
+ variants: {
25
+ variant: {
26
+ solid: {},
27
+ },
28
+ size: {
29
+ xs: {
30
+ fontSize: theme.fontSizes.xs,
31
+ },
32
+ sm: {
33
+ fontSize: theme.fontSizes.sm,
34
+ },
35
+ md: {
36
+ fontSize: theme.fontSizes.md,
37
+ },
38
+ lg: {
39
+ fontSize: theme.fontSizes.lg,
40
+ },
41
+ },
42
+ },
43
+ }),
44
+ error: (colorPalette: PalettesWithNestedKeys) => ({
45
+ color: theme.colors.fg.error,
46
+ variants: {
47
+ variant: {
48
+ solid: {},
49
+ },
50
+ size: {
51
+ xs: {
52
+ fontSize: theme.fontSizes.xs,
53
+ },
54
+ sm: {
55
+ fontSize: theme.fontSizes.sm,
56
+ },
57
+ md: {
58
+ fontSize: theme.fontSizes.md,
59
+ },
60
+ lg: {
61
+ fontSize: theme.fontSizes.lg,
62
+ },
63
+ },
64
+ },
65
+ }),
66
+ }))
@@ -1,8 +1,7 @@
1
- import {StyleSheet} from 'react-native-unistyles'
2
- import {createGradientTokens} from '../style/types'
1
+ import {createGradientTokens} from '../style/varia/types'
3
2
 
4
3
  const gradientBackgroundTokens = createGradientTokens({
5
- defaultProps: {colorPalette: 'primary', direction: 'to top left'},
4
+ defaultProps: {variant: 'solid', direction: 'to top left'},
6
5
  variants: {
7
6
  direction: {
8
7
  'to top': {x1: 0, y1: 0, x2: 0, y2: 1},
@@ -14,25 +13,13 @@ const gradientBackgroundTokens = createGradientTokens({
14
13
  'to bottom left': {x1: 0, y1: 1, x2: 1, y2: 0},
15
14
  'to bottom right': {x1: 1, y1: 1, x2: 0, y2: 0},
16
15
  },
17
- colorPalette: {
18
- primary: {startColor: 'blue', endColor: 'background2'},
19
- secondary: {startColor: 'white', endColor: 'black'},
20
- tertiary: {startColor: 'lime', endColor: 'violet'},
21
- quaternary: {startColor: 'lime', endColor: 'tomato'},
16
+ variant: {
17
+ solid: {
18
+ startColor: 'colorPalette.6',
19
+ endColor: 'colorPalette.9',
20
+ },
22
21
  },
23
22
  },
24
23
  } as const)
25
24
 
26
25
  export {gradientBackgroundTokens}
27
-
28
- const GradientBackgroundStyles = StyleSheet.create(theme => ({
29
- container: {
30
- variants: {
31
- colorPalette: {
32
- primary: {},
33
- },
34
- },
35
- },
36
- }))
37
-
38
- export default GradientBackgroundStyles