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
@@ -1,9 +1,10 @@
1
- import {StyleSheet} from 'react-native-unistyles'
2
- import {createGradientTokens} from '../style/types'
1
+ import {textStyle} from '../style/varia/textStyles'
2
+ import {createGradientTextTokens} from '../style/varia/types'
3
3
 
4
- const gradientTextTokens = createGradientTokens({
4
+ export const gradientTextTokens = createGradientTextTokens({
5
5
  defaultProps: {
6
- colorPalette: 'primary',
6
+ variant: 'solid',
7
+ size: 'md',
7
8
  direction: 'to top left',
8
9
  },
9
10
  variants: {
@@ -17,33 +18,46 @@ const gradientTextTokens = createGradientTokens({
17
18
  'to bottom left': {x1: 0, y1: 1, x2: 1, y2: 0},
18
19
  'to bottom right': {x1: 1, y1: 1, x2: 0, y2: 0},
19
20
  },
20
- colorPalette: {
21
- primary: {
22
- startColor: 'blue',
23
- endColor: 'accentLines',
21
+ variant: {
22
+ solid: {
23
+ startColor: 'colorPalette.6',
24
+ endColor: 'colorPalette.9',
24
25
  },
25
- secondary: {
26
- startColor: 'white',
27
- endColor: 'black',
26
+ },
27
+ size: {
28
+ xs: {
29
+ ...textStyle.xs,
28
30
  },
29
- tertiary: {
30
- startColor: 'active',
31
- endColor: 'violet',
31
+ sm: {
32
+ ...textStyle.sm,
32
33
  },
33
- },
34
- },
35
- } as const)
36
-
37
- export {gradientTextTokens}
38
-
39
- const GradientTextStyles = StyleSheet.create(theme => ({
40
- container: {
41
- variants: {
42
- colorPalette: {
43
- primary: {},
34
+ md: {
35
+ ...textStyle.md,
36
+ },
37
+ lg: {
38
+ ...textStyle.lg,
39
+ },
40
+ xl: {
41
+ ...textStyle.xl,
42
+ },
43
+ '2xl': {
44
+ ...textStyle['2xl'],
45
+ },
46
+ '3xl': {
47
+ ...textStyle['3xl'],
48
+ },
49
+ '4xl': {
50
+ ...textStyle['4xl'],
51
+ },
52
+ '5xl': {
53
+ ...textStyle['5xl'],
54
+ },
55
+ '6xl': {
56
+ ...textStyle['6xl'],
57
+ },
58
+ '7xl': {
59
+ ...textStyle['7xl'],
44
60
  },
45
61
  },
46
62
  },
47
- }))
48
-
49
- export default GradientTextStyles
63
+ } as const)
@@ -1,32 +1,22 @@
1
- import {StyleSheet} from 'react-native-unistyles'
2
- import {wpx, hpx} from '../style/utils'
3
- import {createIconTokens} from '../style/types'
1
+ import {wpx, hpx} from '../style/varia/utils'
2
+ import {createIconTokens} from '../style/varia/types'
4
3
 
5
4
  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
5
  defaultProps: {
13
- colorPalette: 'primary',
14
- size: 'md',
6
+ variant: 'solid',
7
+ sizeVariant: 'md',
15
8
  scale: 1,
16
9
  },
17
10
  variants: {
18
- colorPalette: {
19
- primary: {
20
- color: 'foreground',
11
+ variant: {
12
+ solid: {
13
+ color: 'fg.default',
21
14
  },
22
- secondary: {
23
- color: 'background',
24
- },
25
- tertiary: {
26
- color: 'active',
15
+ subtle: {
16
+ color: 'accent.a3',
27
17
  },
28
18
  },
29
- size: {
19
+ sizeVariant: {
30
20
  sm: {
31
21
  width: wpx(24),
32
22
  height: hpx(24),
@@ -54,68 +44,3 @@ export const IconTokens = createIconTokens({
54
44
  },
55
45
  },
56
46
  } 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
@@ -1,110 +1,103 @@
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 InputTokens = {
4
- defaultProps: {
5
- colorPalette: 'primary',
6
- size: 'md',
7
- spacing: 'md',
8
- placeholderColor: 'white',
9
- marginHorizontal: 30,
10
- },
5
+ export const InputDefaultVariants = {
6
+ variant: 'solid',
7
+ size: 'md',
8
+ spacing: 'md',
11
9
  } as const
12
10
 
13
11
  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: {
12
+ placeholder: (colorPalette: PalettesWithNestedKeys) => ({
23
13
  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',
14
+ invalid: {
15
+ true: {
16
+ color: theme.colors.fg.error,
36
17
  },
18
+ false: {},
37
19
  },
38
20
  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
- },
21
+ xs: {},
22
+ sm: {},
23
+ md: {},
24
+ lg: {},
25
+ xl: {},
62
26
  },
63
27
  },
64
- },
65
- input: {
28
+ }),
29
+ input: (colorPalette: PalettesWithNestedKeys) => ({
30
+ borderColor: theme.colors.border.default,
31
+ borderWidth: 1,
32
+ borderRadius: 4,
33
+ color: theme.colors.fg.default,
34
+ lineHeight: 10,
66
35
  variants: {
67
- colorPalette: {
68
- primary: {
69
- backgroundColor: {
70
- xs: theme.colors.background,
71
- sm: 'white',
72
- lg: 'white',
73
- },
36
+ focused: {
37
+ true: {
38
+ borderColor: theme.colors[colorPalette].default,
74
39
  },
75
- secondary: {
76
- backgroundColor: 'transparent',
77
- borderBottomWidth: 1,
78
- borderColor: theme.colors.foreground,
40
+ false: {
41
+ borderColor: theme.colors.border.default,
79
42
  },
80
- tertiary: {backgroundColor: 'white'},
81
- another: {backgroundColor: 'red'},
82
43
  },
83
- size: {
84
- sm: {
85
- // width: 100,
86
- height: 50,
87
- },
88
- md: {
89
- // width: 100,
90
- height: 50,
44
+ disabled: {
45
+ true: {
46
+ opacity: 0.4,
91
47
  },
92
- xl: {
93
- // width: 200,
94
- height: 80,
48
+ false: {},
49
+ },
50
+ invalid: {
51
+ true: {
52
+ borderColor: theme.colors.fg.error,
95
53
  },
54
+ false: {},
96
55
  },
97
- spacing: {
56
+ size: {
57
+ xs: {
58
+ paddingHorizontal: theme.sizes[2],
59
+ minHeight: theme.sizes[8],
60
+ maxHeight: theme.sizes[8],
61
+ minWidth: theme.sizes[8],
62
+ fontSize: theme.fontSizes.xs,
63
+ },
98
64
  sm: {
99
- marginHorizontal: 10,
65
+ paddingHorizontal: theme.sizes['2.5'],
66
+ minHeight: theme.sizes[9],
67
+ maxHeight: theme.sizes[9],
68
+ minWidth: theme.sizes[9],
69
+ fontSize: theme.fontSizes.sm,
100
70
  },
101
71
  md: {
102
- marginHorizontal: 10,
72
+ paddingHorizontal: theme.sizes[3],
73
+ minHeight: theme.sizes[10],
74
+ maxHeight: theme.sizes[10],
75
+ minWidth: theme.sizes[10],
76
+ fontSize: theme.fontSizes.md,
77
+ },
78
+ lg: {
79
+ paddingHorizontal: theme.sizes['3.5'],
80
+ minHeight: theme.sizes[11],
81
+ maxHeight: theme.sizes[11],
82
+ minWidth: theme.sizes[11],
83
+ fontSize: theme.fontSizes.md,
84
+ lineHeight: 18,
103
85
  },
104
86
  xl: {
105
- marginHorizontal: 30,
87
+ paddingHorizontal: theme.sizes[4],
88
+ minHeight: theme.sizes[12],
89
+ maxHeight: theme.sizes[12],
90
+ minWidth: theme.sizes[12],
91
+ fontSize: theme.fontSizes.lg,
92
+ },
93
+ '2xl': {
94
+ paddingHorizontal: theme.sizes['4.5'],
95
+ minHeight: theme.sizes[16],
96
+ maxHeight: theme.sizes[16],
97
+ minWidth: theme.sizes[16],
98
+ ...textStyle['3xl'],
106
99
  },
107
100
  },
108
101
  },
109
- },
102
+ }),
110
103
  }))
@@ -1,51 +1,24 @@
1
1
  import {StyleSheet} from 'react-native-unistyles'
2
+ import {PalettesWithNestedKeys} from '../style/varia/types'
2
3
 
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
- // },
4
+ export const LinkTokens = {
5
+ defaultProps: {
6
+ variant: 'solid',
7
+ size: 'md',
8
+ },
9
+ } as const
10
+
11
+ export const LinkStyles = StyleSheet.create(theme => ({
12
+ link: (colorPalette: PalettesWithNestedKeys) => ({
23
13
  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,
14
+ variant: {
15
+ solid: {
16
+ color: theme.colors[colorPalette].default,
38
17
  },
39
- lg: {
40
- fontSize: 18,
18
+ outline: {
19
+ color: theme.colors[colorPalette].text,
41
20
  },
42
21
  },
43
- // type: () => ({
44
- // underline: { textDecorationLine: 'underline' },
45
- // bold: { fontWeight: 'bold' },
46
- // }),
47
22
  },
48
- },
23
+ }),
49
24
  }))
50
-
51
- export default LinkStyles
@@ -1,34 +1,72 @@
1
1
  import {StyleSheet} from 'react-native-unistyles'
2
+ import {PalettesWithNestedKeys} from '../style/varia/types'
3
+ import {FadeIn, FadeOut, Keyframe} from 'react-native-reanimated'
4
+ import {textStyle} from '../style/varia/textStyles'
2
5
 
3
6
  export const ModalTokens = {
4
7
  defaultProps: {
5
- colorPalette: 'primary',
8
+ variant: 'solid',
9
+ animation: 'animation1',
6
10
  },
7
- baseStyles: {
8
- backgroundColor: 'blue',
11
+ animations: {
12
+ variants: {
13
+ animation1: {
14
+ enteringOverlay: FadeIn.duration(100),
15
+ exitingOverlay: FadeOut.duration(150),
16
+ enteringContent: new Keyframe({
17
+ 0: {opacity: 0, transform: [{translateY: 40}]},
18
+ 20: {opacity: 0.3, transform: [{translateY: 20}]},
19
+ 100: {opacity: 1, transform: [{translateY: 0}]},
20
+ }).duration(150),
21
+ exitingContent: new Keyframe({
22
+ 0: {opacity: 1, transform: [{translateY: 0}]},
23
+ 100: {opacity: 0, transform: [{translateY: 40}]},
24
+ }).duration(100),
25
+ },
26
+ animation2: {
27
+ enteringOverlay: FadeIn.duration(100),
28
+ exitingOverlay: FadeOut.duration(250),
29
+ enteringContent: new Keyframe({
30
+ 0: {opacity: 0, transform: [{scale: 0.85}]},
31
+ 20: {opacity: 0.5, transform: [{scale: 0.95}]},
32
+ 100: {opacity: 1, transform: [{scale: 1}]},
33
+ }).duration(100),
34
+ exitingContent: new Keyframe({
35
+ 0: {opacity: 1, transform: [{scale: 1}]},
36
+ 100: {opacity: 0, transform: [{scale: 0.8}]},
37
+ }).duration(100),
38
+ },
39
+ },
9
40
  },
10
41
  } as const
11
42
 
12
43
  export const ModalStyles = StyleSheet.create(theme => ({
13
- container: {
44
+ content: (colorPalette: PalettesWithNestedKeys) => ({
45
+ backgroundColor: theme.colors.bg.default,
46
+ boxShadow: theme.shadows.lg,
47
+ borderRadius: theme.radii.lg,
48
+ padding: theme.spacing[4],
14
49
  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
- },
50
+ variant: {
51
+ solid: {},
31
52
  },
32
53
  },
33
- },
54
+ }),
55
+ overlay: (colorPalette: PalettesWithNestedKeys) => ({
56
+ backgroundColor: theme.colors.backdrop,
57
+ variants: {
58
+ variant: {
59
+ solid: {},
60
+ },
61
+ },
62
+ }),
63
+ title: (colorPalette: PalettesWithNestedKeys) => ({
64
+ fontWeight: theme.fontWeights.semibold,
65
+ ...textStyle.lg,
66
+ variants: {
67
+ variant: {
68
+ solid: {},
69
+ },
70
+ },
71
+ }),
34
72
  }))