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.
- package/bin/cli.js +35 -18
- package/lib/components/Badge.tsx +31 -32
- package/lib/components/Button.tsx +20 -20
- package/lib/components/Checkbox.tsx +95 -0
- package/lib/components/CircleProgress.tsx +56 -66
- package/lib/components/Field.tsx +137 -0
- package/lib/components/GradientBackground.tsx +17 -18
- package/lib/components/GradientText.tsx +25 -64
- package/lib/components/IconWrapper.tsx +32 -25
- package/lib/components/Input.tsx +66 -68
- package/lib/components/Link.tsx +14 -28
- package/lib/components/Modal.tsx +197 -97
- package/lib/components/NewSelect.tsx +202 -0
- package/lib/components/NumberInput.tsx +226 -0
- package/lib/components/RadioGroup.tsx +195 -0
- package/lib/components/ReText.tsx +53 -87
- package/lib/components/Select.tsx +272 -0
- package/lib/components/SelectOld.tsx +153 -0
- package/lib/components/Slider.tsx +32 -40
- package/lib/components/Slideshow.tsx +174 -261
- package/lib/components/SlidingDrawer.tsx +216 -265
- package/lib/components/Spinner.tsx +21 -12
- package/lib/components/Switch.tsx +133 -180
- package/lib/components/Switchold.tsx +174 -0
- package/lib/components/Text.tsx +36 -83
- package/lib/components/layoutTest.tsx +74 -0
- package/lib/patterns/index.tsx +143 -202
- package/lib/theme/Badge.recipe.tsx +44 -39
- package/lib/theme/Button.recipe.tsx +139 -48
- package/lib/theme/Checkbox.recipe.tsx +121 -0
- package/lib/theme/CircleProgress.recipe.tsx +16 -22
- package/lib/theme/Field.recipe.tsx +66 -0
- package/lib/theme/GradientBackground.recipe.tsx +7 -20
- package/lib/theme/GradientText.recipe.tsx +42 -28
- package/lib/theme/IconWrapper.recipe.tsx +10 -85
- package/lib/theme/Input.recipe.tsx +76 -83
- package/lib/theme/Link.recipe.tsx +16 -43
- package/lib/theme/Modal.recipe.tsx +59 -21
- package/lib/theme/NumberInput.recipe.tsx +191 -0
- package/lib/theme/RadioGroup.recipe.tsx +163 -0
- package/lib/theme/ReText.recipe.tsx +4 -7
- package/lib/theme/Select.recipe.tsx +121 -0
- package/lib/theme/Slider.recipe.tsx +97 -181
- package/lib/theme/Slideshow.recipe.tsx +24 -102
- package/lib/theme/SlidingDrawer.recipe.tsx +21 -59
- package/lib/theme/Spinner.recipe.tsx +28 -3
- package/lib/theme/Switch.recipe.tsx +75 -54
- package/lib/theme/Text.recipe.tsx +66 -8
- package/lib/theme/animations.tsx +13 -0
- package/lib/varia/colorPalettes/amber.ts +54 -0
- package/lib/varia/colorPalettes/blue.ts +54 -0
- package/lib/varia/colorPalettes/bronze.ts +54 -0
- package/lib/varia/colorPalettes/brown.ts +54 -0
- package/lib/varia/colorPalettes/crimson.ts +55 -0
- package/lib/varia/colorPalettes/cyan.ts +54 -0
- package/lib/varia/colorPalettes/gold.ts +54 -0
- package/lib/varia/colorPalettes/grass.ts +54 -0
- package/lib/varia/colorPalettes/green.ts +54 -0
- package/lib/varia/colorPalettes/indigo.ts +54 -0
- package/lib/varia/colorPalettes/iris.ts +54 -0
- package/lib/varia/colorPalettes/jade.ts +54 -0
- package/lib/varia/colorPalettes/lime.ts +55 -0
- package/lib/varia/colorPalettes/mauve.ts +54 -0
- package/lib/varia/colorPalettes/mint.ts +54 -0
- package/lib/varia/colorPalettes/neutral.ts +54 -0
- package/lib/varia/colorPalettes/olive.ts +54 -0
- package/lib/varia/colorPalettes/orange.ts +54 -0
- package/lib/varia/colorPalettes/pink.ts +54 -0
- package/lib/varia/colorPalettes/plum.ts +54 -0
- package/lib/varia/colorPalettes/purple.ts +56 -0
- package/lib/varia/colorPalettes/red.ts +55 -0
- package/lib/varia/colorPalettes/ruby.ts +56 -0
- package/lib/varia/colorPalettes/sage.ts +56 -0
- package/lib/varia/colorPalettes/sand.ts +56 -0
- package/lib/varia/colorPalettes/sky.ts +56 -0
- package/lib/varia/colorPalettes/slate.ts +56 -0
- package/lib/varia/colorPalettes/teal.ts +56 -0
- package/lib/varia/colorPalettes/tomato.ts +56 -0
- package/lib/varia/colorPalettes/violet.ts +56 -0
- package/lib/varia/colorPalettes/yellow.ts +56 -0
- package/lib/varia/defaultTheme.ts +174 -0
- package/lib/varia/mixins.ts +223 -0
- package/lib/varia/textStyles.ts +48 -0
- package/lib/varia/types.ts +277 -0
- package/lib/varia/utils.ts +283 -0
- package/package.json +1 -1
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import {colorPalettes} from '../themes'
|
|
2
|
+
|
|
3
|
+
export const defaultFontSizes = {
|
|
4
|
+
xxs: 10,
|
|
5
|
+
xs: 12,
|
|
6
|
+
sm: 14,
|
|
7
|
+
md: 16,
|
|
8
|
+
lg: 18,
|
|
9
|
+
xl: 20,
|
|
10
|
+
'2xl': 24,
|
|
11
|
+
'3xl': 30,
|
|
12
|
+
'4xl': 36,
|
|
13
|
+
'5xl': 48,
|
|
14
|
+
'6xl': 60,
|
|
15
|
+
'7xl': 72,
|
|
16
|
+
} as const
|
|
17
|
+
export const defaultFontWeights = {
|
|
18
|
+
semilight: 100,
|
|
19
|
+
light: 200,
|
|
20
|
+
thin: 300,
|
|
21
|
+
regular: 400,
|
|
22
|
+
medium: 500,
|
|
23
|
+
semibold: 600,
|
|
24
|
+
bold: 700,
|
|
25
|
+
} as const
|
|
26
|
+
|
|
27
|
+
export const defaultRadii = {
|
|
28
|
+
none: 0,
|
|
29
|
+
'2xs': 1,
|
|
30
|
+
xs: 2,
|
|
31
|
+
sm: 4,
|
|
32
|
+
md: 6,
|
|
33
|
+
lg: 8,
|
|
34
|
+
xl: 12,
|
|
35
|
+
'2xl': 16,
|
|
36
|
+
'3xl': 24,
|
|
37
|
+
full: 9999,
|
|
38
|
+
} as const
|
|
39
|
+
|
|
40
|
+
export const defaultSpacing = {
|
|
41
|
+
0: 0,
|
|
42
|
+
0.5: 2, // 0.125rem * 16
|
|
43
|
+
1: 4, // 0.25rem * 16
|
|
44
|
+
1.5: 6, // 0.375rem * 16
|
|
45
|
+
2: 8, // 0.5rem * 16
|
|
46
|
+
2.5: 10, // 0.625rem * 16
|
|
47
|
+
3: 12, // 0.75rem * 16
|
|
48
|
+
3.5: 14, // 0.875rem * 16
|
|
49
|
+
4: 16, // 1rem * 16
|
|
50
|
+
4.5: 18, // 1.125rem * 16
|
|
51
|
+
5: 20, // 1.25rem * 16
|
|
52
|
+
6: 24, // 1.5rem * 16
|
|
53
|
+
7: 28, // 1.75rem * 16
|
|
54
|
+
8: 32, // 2rem * 16
|
|
55
|
+
9: 36, // 2.25rem * 16
|
|
56
|
+
10: 40, // 2.5rem * 16
|
|
57
|
+
11: 44, // 2.75rem * 16
|
|
58
|
+
12: 48, // 3rem * 16
|
|
59
|
+
14: 56, // 3.5rem * 16
|
|
60
|
+
16: 64, // 4rem * 16
|
|
61
|
+
20: 80, // 5rem * 16
|
|
62
|
+
24: 96, // 6rem * 16
|
|
63
|
+
28: 112, // 7rem * 16
|
|
64
|
+
32: 128, // 8rem * 16
|
|
65
|
+
36: 144, // 9rem * 16
|
|
66
|
+
40: 160, // 10rem * 16
|
|
67
|
+
44: 176, // 11rem * 16
|
|
68
|
+
48: 192, // 12rem * 16
|
|
69
|
+
52: 208, // 13rem * 16
|
|
70
|
+
56: 224, // 14rem * 16
|
|
71
|
+
60: 240, // 15rem * 16
|
|
72
|
+
64: 256, // 16rem * 16
|
|
73
|
+
72: 288, // 18rem * 16
|
|
74
|
+
80: 320, // 20rem * 16
|
|
75
|
+
96: 384, // 24rem * 16
|
|
76
|
+
} as const
|
|
77
|
+
|
|
78
|
+
export const defaultSizes = {
|
|
79
|
+
0: 0,
|
|
80
|
+
1: 4,
|
|
81
|
+
2: 8,
|
|
82
|
+
3: 12,
|
|
83
|
+
4: 16,
|
|
84
|
+
5: 20,
|
|
85
|
+
6: 24,
|
|
86
|
+
7: 28,
|
|
87
|
+
8: 32,
|
|
88
|
+
9: 36,
|
|
89
|
+
10: 40,
|
|
90
|
+
11: 44,
|
|
91
|
+
12: 48,
|
|
92
|
+
14: 56,
|
|
93
|
+
16: 64,
|
|
94
|
+
20: 80,
|
|
95
|
+
24: 96,
|
|
96
|
+
28: 112,
|
|
97
|
+
32: 128,
|
|
98
|
+
36: 144,
|
|
99
|
+
40: 160,
|
|
100
|
+
44: 176,
|
|
101
|
+
48: 192,
|
|
102
|
+
52: 208,
|
|
103
|
+
56: 224,
|
|
104
|
+
60: 240,
|
|
105
|
+
64: 256,
|
|
106
|
+
72: 288,
|
|
107
|
+
80: 320,
|
|
108
|
+
96: 384,
|
|
109
|
+
0.5: 2,
|
|
110
|
+
1.5: 6,
|
|
111
|
+
2.5: 10,
|
|
112
|
+
3.5: 14,
|
|
113
|
+
4.5: 18,
|
|
114
|
+
'2xs': 256,
|
|
115
|
+
xs: 320,
|
|
116
|
+
sm: 384,
|
|
117
|
+
md: 448,
|
|
118
|
+
lg: 512,
|
|
119
|
+
xl: 576,
|
|
120
|
+
'2xl': 672,
|
|
121
|
+
'3xl': 768,
|
|
122
|
+
'4xl': 896,
|
|
123
|
+
'5xl': 1024,
|
|
124
|
+
'6xl': 1152,
|
|
125
|
+
'7xl': 1280,
|
|
126
|
+
'8xl': 1440,
|
|
127
|
+
full: '100%',
|
|
128
|
+
} as const
|
|
129
|
+
|
|
130
|
+
export const defaultColors = {
|
|
131
|
+
black: {
|
|
132
|
+
0: '#000000',
|
|
133
|
+
a1: 'rgba(0, 0, 0, 0.05)',
|
|
134
|
+
a2: 'rgba(0, 0, 0, 0.1)',
|
|
135
|
+
a3: 'rgba(0, 0, 0, 0.15)',
|
|
136
|
+
a4: 'rgba(0, 0, 0, 0.2)',
|
|
137
|
+
a5: 'rgba(0, 0, 0, 0.3)',
|
|
138
|
+
a6: 'rgba(0, 0, 0, 0.4)',
|
|
139
|
+
a7: 'rgba(0, 0, 0, 0.5)',
|
|
140
|
+
a8: 'rgba(0, 0, 0, 0.6)',
|
|
141
|
+
a9: 'rgba(0, 0, 0, 0.7)',
|
|
142
|
+
a10: 'rgba(0, 0, 0, 0.8)',
|
|
143
|
+
a11: 'rgba(0, 0, 0, 0.9)',
|
|
144
|
+
a12: 'rgba(0, 0, 0, 0.95)',
|
|
145
|
+
},
|
|
146
|
+
white: {
|
|
147
|
+
0: '#FFFFFF',
|
|
148
|
+
a1: 'rgba(255, 255, 255, 0.05)',
|
|
149
|
+
a2: 'rgba(255, 255, 255, 0.1)',
|
|
150
|
+
a3: 'rgba(255, 255, 255, 0.15)',
|
|
151
|
+
a4: 'rgba(255, 255, 255, 0.2)',
|
|
152
|
+
a5: 'rgba(255, 255, 255, 0.3)',
|
|
153
|
+
a6: 'rgba(255, 255, 255, 0.4)',
|
|
154
|
+
a7: 'rgba(255, 255, 255, 0.5)',
|
|
155
|
+
a8: 'rgba(255, 255, 255, 0.6)',
|
|
156
|
+
a9: 'rgba(255, 255, 255, 0.7)',
|
|
157
|
+
a10: 'rgba(255, 255, 255, 0.8)',
|
|
158
|
+
a11: 'rgba(255, 255, 255, 0.9)',
|
|
159
|
+
a12: 'rgba(255, 255, 255, 0.95)',
|
|
160
|
+
},
|
|
161
|
+
} as const
|
|
162
|
+
|
|
163
|
+
export const defaultShadows = (
|
|
164
|
+
themeColors: typeof colorPalettes.light | typeof colorPalettes.dark,
|
|
165
|
+
) => {
|
|
166
|
+
return {
|
|
167
|
+
xs: `0px 1px 1px var(${defaultColors.black.a12}), 0px 0px 1px inset var(${themeColors.gray.a7})`,
|
|
168
|
+
sm: `0px 2px 4px var(${defaultColors.black.a10}), 0px 0px 1px inset var(${themeColors.gray.a7})`,
|
|
169
|
+
md: `0px 8px 16px var(${defaultColors.black.a10}), 0px 0px 1px inset var(${themeColors.gray.a7})`,
|
|
170
|
+
lg: `0px 16px 24px var(${defaultColors.black.a10}), 0px 0px 1px inset var(${themeColors.gray.a7})`,
|
|
171
|
+
xl: `0px 24px 40px var(${defaultColors.black.a10}), 0px 0px 1px inset var(${themeColors.gray.a7})`,
|
|
172
|
+
'2xl': `0px 24px 40px var(${defaultColors.black.a10}), 0px 0px 1px inset var(${themeColors.gray.a7})`,
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native-unistyles'
|
|
2
|
+
import {ThemeColors} from './types'
|
|
3
|
+
import {extractThemeColor} from './utils'
|
|
4
|
+
|
|
5
|
+
const mixins = StyleSheet.create((theme, rt) => ({
|
|
6
|
+
size: (width: number, height: number = width) => ({
|
|
7
|
+
width,
|
|
8
|
+
height,
|
|
9
|
+
}),
|
|
10
|
+
row: {
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
flexDirection: 'row',
|
|
13
|
+
},
|
|
14
|
+
gap: (gap: number) => ({
|
|
15
|
+
gap,
|
|
16
|
+
}),
|
|
17
|
+
center: {
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
},
|
|
21
|
+
sx: (sx: any) => ({
|
|
22
|
+
...sx,
|
|
23
|
+
}),
|
|
24
|
+
w: (width: number) => ({
|
|
25
|
+
width,
|
|
26
|
+
}),
|
|
27
|
+
h: (height: number) => ({
|
|
28
|
+
height,
|
|
29
|
+
}),
|
|
30
|
+
font: (fontSize: number) => ({
|
|
31
|
+
fontSize,
|
|
32
|
+
}),
|
|
33
|
+
bg: (backgroundColor: ThemeColors) => ({
|
|
34
|
+
backgroundColor: extractThemeColor(backgroundColor, theme),
|
|
35
|
+
}),
|
|
36
|
+
flexColumn: (flex: number = 1) => ({
|
|
37
|
+
flex,
|
|
38
|
+
width: '100%',
|
|
39
|
+
}),
|
|
40
|
+
flexRow: (flex: number = 1) => ({
|
|
41
|
+
flex,
|
|
42
|
+
height: '100%',
|
|
43
|
+
}),
|
|
44
|
+
minMaxW: (minWidth: number, maxWidth: number) => ({
|
|
45
|
+
minWidth,
|
|
46
|
+
maxWidth,
|
|
47
|
+
}),
|
|
48
|
+
minMaxH: (minHeight: number, maxHeight: number) => ({
|
|
49
|
+
minHeight,
|
|
50
|
+
maxHeight,
|
|
51
|
+
}),
|
|
52
|
+
vw: (amount: number) => ({
|
|
53
|
+
width:
|
|
54
|
+
((rt.screen.width - rt.insets.left - rt.insets.right) * amount) / 100,
|
|
55
|
+
}),
|
|
56
|
+
vh: (amount: number) => ({
|
|
57
|
+
height:
|
|
58
|
+
((rt.screen.height - rt.insets.top - rt.insets.bottom) * amount) / 100,
|
|
59
|
+
}),
|
|
60
|
+
vwh: (amount: number) => ({
|
|
61
|
+
width:
|
|
62
|
+
((rt.screen.width - rt.insets.left - rt.insets.right) * amount) / 100,
|
|
63
|
+
height:
|
|
64
|
+
((rt.screen.height - rt.insets.top - rt.insets.bottom) * amount) / 100,
|
|
65
|
+
}),
|
|
66
|
+
self: (
|
|
67
|
+
alignSelf: 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch',
|
|
68
|
+
) => ({
|
|
69
|
+
alignSelf,
|
|
70
|
+
}),
|
|
71
|
+
justify: (
|
|
72
|
+
justifyContent:
|
|
73
|
+
| 'flex-start'
|
|
74
|
+
| 'flex-end'
|
|
75
|
+
| 'center'
|
|
76
|
+
| 'space-around'
|
|
77
|
+
| 'space-between'
|
|
78
|
+
| 'space-evenly',
|
|
79
|
+
) => ({
|
|
80
|
+
justifyContent,
|
|
81
|
+
}),
|
|
82
|
+
rtl: {
|
|
83
|
+
direction: 'rtl',
|
|
84
|
+
},
|
|
85
|
+
ar: (aspectRatio: number) => ({
|
|
86
|
+
aspectRatio,
|
|
87
|
+
}),
|
|
88
|
+
br: (borderRadius: number) => ({
|
|
89
|
+
borderRadius,
|
|
90
|
+
}),
|
|
91
|
+
bw: (borderWidth: number) => ({
|
|
92
|
+
borderWidth,
|
|
93
|
+
}),
|
|
94
|
+
bc: (borderColor: ThemeColors) => ({
|
|
95
|
+
borderColor: extractThemeColor(borderColor, theme),
|
|
96
|
+
}),
|
|
97
|
+
border: (borderWidth: number, borderColor: ThemeColors) => ({
|
|
98
|
+
borderWidth,
|
|
99
|
+
borderColor: extractThemeColor(borderColor, theme),
|
|
100
|
+
}),
|
|
101
|
+
m: (margin: number) => ({
|
|
102
|
+
margin,
|
|
103
|
+
}),
|
|
104
|
+
mt: (marginTop: number) => ({
|
|
105
|
+
marginTop,
|
|
106
|
+
}),
|
|
107
|
+
mb: (marginBottom: number) => ({
|
|
108
|
+
marginBottom,
|
|
109
|
+
}),
|
|
110
|
+
ml: (marginLeft: number) => ({
|
|
111
|
+
marginLeft,
|
|
112
|
+
}),
|
|
113
|
+
mr: (marginRight: number) => ({
|
|
114
|
+
marginRight,
|
|
115
|
+
}),
|
|
116
|
+
mx: (marginHorizontal: number) => ({
|
|
117
|
+
marginHorizontal,
|
|
118
|
+
}),
|
|
119
|
+
my: (marginVertical: number) => ({
|
|
120
|
+
marginVertical,
|
|
121
|
+
}),
|
|
122
|
+
p: (padding: number) => ({
|
|
123
|
+
padding,
|
|
124
|
+
}),
|
|
125
|
+
pt: (paddingTop: number) => ({
|
|
126
|
+
paddingTop,
|
|
127
|
+
}),
|
|
128
|
+
pb: (paddingBottom: number) => ({
|
|
129
|
+
paddingBottom,
|
|
130
|
+
}),
|
|
131
|
+
pl: (paddingLeft: number) => ({
|
|
132
|
+
paddingLeft,
|
|
133
|
+
}),
|
|
134
|
+
pr: (paddingRight: number) => ({
|
|
135
|
+
paddingRight,
|
|
136
|
+
}),
|
|
137
|
+
px: (paddingHorizontal: number) => ({
|
|
138
|
+
paddingHorizontal,
|
|
139
|
+
}),
|
|
140
|
+
py: (paddingVertical: number) => ({
|
|
141
|
+
paddingVertical,
|
|
142
|
+
}),
|
|
143
|
+
t: (top: number = 0) => ({
|
|
144
|
+
position: 'absolute',
|
|
145
|
+
top,
|
|
146
|
+
}),
|
|
147
|
+
b: (bottom: number = 0) => ({
|
|
148
|
+
position: 'absolute',
|
|
149
|
+
bottom,
|
|
150
|
+
}),
|
|
151
|
+
l: (left: number = 0) => ({
|
|
152
|
+
position: 'absolute',
|
|
153
|
+
left,
|
|
154
|
+
}),
|
|
155
|
+
r: (right: number = 0) => ({
|
|
156
|
+
position: 'absolute',
|
|
157
|
+
right,
|
|
158
|
+
}),
|
|
159
|
+
static: {
|
|
160
|
+
position: 'static',
|
|
161
|
+
},
|
|
162
|
+
absolute: {
|
|
163
|
+
position: 'absolute',
|
|
164
|
+
},
|
|
165
|
+
relative: {
|
|
166
|
+
position: 'relative',
|
|
167
|
+
},
|
|
168
|
+
z: (zIndex: number) => ({
|
|
169
|
+
zIndex,
|
|
170
|
+
}),
|
|
171
|
+
opacity: (opacity: number) => ({
|
|
172
|
+
opacity,
|
|
173
|
+
}),
|
|
174
|
+
circle: {
|
|
175
|
+
borderRadius: 9999,
|
|
176
|
+
},
|
|
177
|
+
}))
|
|
178
|
+
|
|
179
|
+
export const {
|
|
180
|
+
size,
|
|
181
|
+
row,
|
|
182
|
+
gap,
|
|
183
|
+
center,
|
|
184
|
+
sx,
|
|
185
|
+
flexColumn,
|
|
186
|
+
w,
|
|
187
|
+
h,
|
|
188
|
+
minMaxW,
|
|
189
|
+
minMaxH,
|
|
190
|
+
vw,
|
|
191
|
+
vh,
|
|
192
|
+
vwh,
|
|
193
|
+
self,
|
|
194
|
+
justify,
|
|
195
|
+
border,
|
|
196
|
+
bc,
|
|
197
|
+
bg,
|
|
198
|
+
br,
|
|
199
|
+
p,
|
|
200
|
+
m,
|
|
201
|
+
mt,
|
|
202
|
+
mb,
|
|
203
|
+
ml,
|
|
204
|
+
mr,
|
|
205
|
+
mx,
|
|
206
|
+
my,
|
|
207
|
+
pt,
|
|
208
|
+
pb,
|
|
209
|
+
pl,
|
|
210
|
+
pr,
|
|
211
|
+
px,
|
|
212
|
+
py,
|
|
213
|
+
t,
|
|
214
|
+
b,
|
|
215
|
+
l,
|
|
216
|
+
r,
|
|
217
|
+
absolute,
|
|
218
|
+
relative,
|
|
219
|
+
z,
|
|
220
|
+
opacity,
|
|
221
|
+
circle,
|
|
222
|
+
font,
|
|
223
|
+
} = mixins
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native-unistyles'
|
|
2
|
+
|
|
3
|
+
export const textStyle = StyleSheet.create((theme, rt) => ({
|
|
4
|
+
xs: {
|
|
5
|
+
fontSize: theme.fontSizes.xs,
|
|
6
|
+
lineHeight: 12,
|
|
7
|
+
},
|
|
8
|
+
sm: {
|
|
9
|
+
fontSize: theme.fontSizes.sm,
|
|
10
|
+
lineHeight: 20,
|
|
11
|
+
},
|
|
12
|
+
md: {
|
|
13
|
+
fontSize: theme.fontSizes.md,
|
|
14
|
+
lineHeight: 24,
|
|
15
|
+
},
|
|
16
|
+
lg: {
|
|
17
|
+
fontSize: theme.fontSizes.lg,
|
|
18
|
+
lineHeight: 28,
|
|
19
|
+
},
|
|
20
|
+
xl: {
|
|
21
|
+
fontSize: theme.fontSizes.xl,
|
|
22
|
+
lineHeight: 30,
|
|
23
|
+
},
|
|
24
|
+
'2xl': {
|
|
25
|
+
fontSize: theme.fontSizes['2xl'],
|
|
26
|
+
lineHeight: 32,
|
|
27
|
+
},
|
|
28
|
+
'3xl': {
|
|
29
|
+
fontSize: theme.fontSizes['3xl'],
|
|
30
|
+
lineHeight: 38,
|
|
31
|
+
},
|
|
32
|
+
'4xl': {
|
|
33
|
+
fontSize: theme.fontSizes['4xl'],
|
|
34
|
+
lineHeight: 44,
|
|
35
|
+
},
|
|
36
|
+
'5xl': {
|
|
37
|
+
fontSize: theme.fontSizes['5xl'],
|
|
38
|
+
lineHeight: 60,
|
|
39
|
+
},
|
|
40
|
+
'6xl': {
|
|
41
|
+
fontSize: theme.fontSizes['6xl'],
|
|
42
|
+
lineHeight: 72,
|
|
43
|
+
},
|
|
44
|
+
'7xl': {
|
|
45
|
+
fontSize: theme.fontSizes['7xl'],
|
|
46
|
+
lineHeight: 92,
|
|
47
|
+
},
|
|
48
|
+
}))
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import {darkTheme, lightTheme} from '../themes'
|
|
2
|
+
|
|
3
|
+
export interface AlphaPalette {
|
|
4
|
+
'0': string
|
|
5
|
+
a1: string
|
|
6
|
+
a2: string
|
|
7
|
+
a3: string
|
|
8
|
+
a4: string
|
|
9
|
+
a5: string
|
|
10
|
+
a6: string
|
|
11
|
+
a7: string
|
|
12
|
+
a8: string
|
|
13
|
+
a9: string
|
|
14
|
+
a10: string
|
|
15
|
+
a11: string
|
|
16
|
+
a12: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface BlackWhitePalette {
|
|
20
|
+
black: AlphaPalette
|
|
21
|
+
white: AlphaPalette
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ColorPaletteBase {
|
|
25
|
+
'1': string
|
|
26
|
+
'2': string
|
|
27
|
+
'3': string
|
|
28
|
+
'4': string
|
|
29
|
+
'5': string
|
|
30
|
+
'6': string
|
|
31
|
+
'7': string
|
|
32
|
+
'8': string
|
|
33
|
+
'9': string
|
|
34
|
+
'10': string
|
|
35
|
+
'11': string
|
|
36
|
+
'12': string
|
|
37
|
+
a1: string
|
|
38
|
+
a2: string
|
|
39
|
+
a3: string
|
|
40
|
+
a4: string
|
|
41
|
+
a5: string
|
|
42
|
+
a6: string
|
|
43
|
+
a7: string
|
|
44
|
+
a8: string
|
|
45
|
+
a9: string
|
|
46
|
+
a10: string
|
|
47
|
+
a11: string
|
|
48
|
+
a12: string
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface ColorSchema {
|
|
52
|
+
theme: ColorTheme
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ColorTheme {
|
|
56
|
+
light: ColorScheme & CustomColorScheme
|
|
57
|
+
dark: ColorScheme & CustomColorScheme
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface ColorScheme {
|
|
61
|
+
gray: ColorPalette
|
|
62
|
+
accent: ColorPalette
|
|
63
|
+
fg: ColorPaletteForeground
|
|
64
|
+
bg: ColorPaletteBackground
|
|
65
|
+
border: ColorPaletteBorder
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface CustomColorScheme {
|
|
69
|
+
[palette: string]: ColorPalette
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface ColorPaletteSemantic {
|
|
73
|
+
default: string
|
|
74
|
+
emphasized: string
|
|
75
|
+
fg: string
|
|
76
|
+
text: string
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface CreatePresetDTO {
|
|
80
|
+
accent: ThemePresetDTO
|
|
81
|
+
gray: ThemePresetDTO
|
|
82
|
+
[palette: string]: ThemePresetDTO
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface ThemePresetDTO {
|
|
86
|
+
light: ColorPaletteBase
|
|
87
|
+
dark: ColorPaletteBase
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export type ColorPalette = ColorPaletteBase & ColorPaletteSemantic
|
|
91
|
+
|
|
92
|
+
interface ColorPaletteUI {
|
|
93
|
+
default: string
|
|
94
|
+
muted: string
|
|
95
|
+
subtle: string
|
|
96
|
+
disabled: string
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface ColorPaletteForeground extends ColorPaletteUI {
|
|
100
|
+
error: string
|
|
101
|
+
}
|
|
102
|
+
export interface ColorPaletteBorder extends ColorPaletteUI {
|
|
103
|
+
outline: string
|
|
104
|
+
error: string
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface ColorPaletteBackground extends ColorPaletteUI {
|
|
108
|
+
canvas: string
|
|
109
|
+
emphasized: string
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const themes = {
|
|
113
|
+
light: lightTheme,
|
|
114
|
+
dark: darkTheme,
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export type ColorPaletteType =
|
|
118
|
+
keyof (typeof themes)[keyof typeof themes]['colors']
|
|
119
|
+
|
|
120
|
+
export type ColorsType = (typeof themes)[keyof typeof themes]['colors']
|
|
121
|
+
|
|
122
|
+
export type NestedColorsType = (typeof themes)[keyof typeof themes]['colors']
|
|
123
|
+
|
|
124
|
+
type ConstantPalettes = 'bg' | 'fg' | 'border'
|
|
125
|
+
|
|
126
|
+
export type PalettesWithNestedKeys = {
|
|
127
|
+
[K in keyof NestedColorsType]: NestedColorsType[K] extends object
|
|
128
|
+
? K extends ConstantPalettes
|
|
129
|
+
? never
|
|
130
|
+
: K
|
|
131
|
+
: never
|
|
132
|
+
}[keyof NestedColorsType]
|
|
133
|
+
|
|
134
|
+
export type ThemeType = (typeof themes)[keyof typeof themes]
|
|
135
|
+
|
|
136
|
+
export type TextSemanticSizes =
|
|
137
|
+
| 'h1'
|
|
138
|
+
| 'h2'
|
|
139
|
+
| 'h3'
|
|
140
|
+
| 'h4'
|
|
141
|
+
| 'h5'
|
|
142
|
+
| 'h6'
|
|
143
|
+
| 'h7'
|
|
144
|
+
| 'h8'
|
|
145
|
+
| 'h9'
|
|
146
|
+
| 'body'
|
|
147
|
+
|
|
148
|
+
export type directions =
|
|
149
|
+
| 'to top'
|
|
150
|
+
| 'to bottom'
|
|
151
|
+
| 'to left'
|
|
152
|
+
| 'to right'
|
|
153
|
+
| 'to top left'
|
|
154
|
+
| 'to top right'
|
|
155
|
+
| 'to bottom left'
|
|
156
|
+
| 'to bottom right'
|
|
157
|
+
|
|
158
|
+
type ColorName = keyof ColorsType
|
|
159
|
+
|
|
160
|
+
type LooseString<T extends string> = T | (string & {})
|
|
161
|
+
|
|
162
|
+
type DotPrefix<T extends string, P extends string> = `${P}.${T}`
|
|
163
|
+
|
|
164
|
+
export type DotNestedKeys<T, Prefix extends string = ''> = {
|
|
165
|
+
[K in keyof T]: T[K] extends object
|
|
166
|
+
? DotNestedKeys<
|
|
167
|
+
T[K],
|
|
168
|
+
Prefix extends '' ? K & string : DotPrefix<K & string, Prefix>
|
|
169
|
+
>
|
|
170
|
+
: Prefix extends ''
|
|
171
|
+
? K & string
|
|
172
|
+
: DotPrefix<K & string, Prefix>
|
|
173
|
+
}[keyof T]
|
|
174
|
+
|
|
175
|
+
type ColorKeys = DotNestedKeys<ColorsType>
|
|
176
|
+
|
|
177
|
+
export type ThemeColors = LooseString<ColorKeys>
|
|
178
|
+
|
|
179
|
+
export function createGradientTokens<
|
|
180
|
+
const V extends Record<
|
|
181
|
+
string,
|
|
182
|
+
{startColor: ThemeColors; endColor: ThemeColors}
|
|
183
|
+
>,
|
|
184
|
+
>(tokens: {
|
|
185
|
+
defaultProps: {
|
|
186
|
+
variant: keyof V
|
|
187
|
+
direction: directions
|
|
188
|
+
}
|
|
189
|
+
variants: {
|
|
190
|
+
direction: Record<
|
|
191
|
+
directions,
|
|
192
|
+
{x1: number; y1: number; x2: number; y2: number}
|
|
193
|
+
>
|
|
194
|
+
variant: V
|
|
195
|
+
}
|
|
196
|
+
}) {
|
|
197
|
+
return tokens
|
|
198
|
+
}
|
|
199
|
+
export function createGradientTextTokens<
|
|
200
|
+
const V extends Record<
|
|
201
|
+
string,
|
|
202
|
+
{startColor: ThemeColors; endColor: ThemeColors}
|
|
203
|
+
>,
|
|
204
|
+
const TS extends Record<
|
|
205
|
+
string,
|
|
206
|
+
{fontSize: number | string; fontWeight?: number; lineHeight?: number}
|
|
207
|
+
>,
|
|
208
|
+
>(tokens: {
|
|
209
|
+
defaultProps: {
|
|
210
|
+
variant: keyof V
|
|
211
|
+
direction: directions
|
|
212
|
+
size: keyof TS
|
|
213
|
+
}
|
|
214
|
+
variants: {
|
|
215
|
+
direction: Record<
|
|
216
|
+
directions,
|
|
217
|
+
{x1: number; y1: number; x2: number; y2: number}
|
|
218
|
+
>
|
|
219
|
+
variant: V
|
|
220
|
+
size: TS
|
|
221
|
+
}
|
|
222
|
+
}) {
|
|
223
|
+
return tokens
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
type SVGSize = {
|
|
227
|
+
width: number
|
|
228
|
+
height: number
|
|
229
|
+
viewBoxWidth: number
|
|
230
|
+
viewBoxHeight: number
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export function createIconTokens<
|
|
234
|
+
const V extends Record<string, {color: ThemeColors}>,
|
|
235
|
+
const S extends Record<string, SVGSize>,
|
|
236
|
+
>(tokens: {
|
|
237
|
+
defaultProps: {
|
|
238
|
+
variant: keyof V
|
|
239
|
+
sizeVariant: keyof S
|
|
240
|
+
scale: number
|
|
241
|
+
}
|
|
242
|
+
variants: {
|
|
243
|
+
sizeVariant: S
|
|
244
|
+
variant: V
|
|
245
|
+
}
|
|
246
|
+
}) {
|
|
247
|
+
return tokens
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export type SliderTokensType = {
|
|
251
|
+
defaultProps: {
|
|
252
|
+
size: string
|
|
253
|
+
color: ThemeColors
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export function createCircleProgressTokens<
|
|
258
|
+
const V extends Record<
|
|
259
|
+
string,
|
|
260
|
+
{trackColor: ThemeColors; progressColor: ThemeColors}
|
|
261
|
+
>,
|
|
262
|
+
const S extends Record<
|
|
263
|
+
string,
|
|
264
|
+
{trackStrokeWidth: number; progressStrokeWidth: number}
|
|
265
|
+
>,
|
|
266
|
+
>(tokens: {
|
|
267
|
+
defaultProps: {
|
|
268
|
+
variant: keyof V
|
|
269
|
+
size: keyof S
|
|
270
|
+
}
|
|
271
|
+
variants: {
|
|
272
|
+
size: S
|
|
273
|
+
variant: V
|
|
274
|
+
}
|
|
275
|
+
}) {
|
|
276
|
+
return tokens
|
|
277
|
+
}
|