forked from callstack/react-native-paper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.tsx
216 lines (190 loc) · 4.27 KB
/
types.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
import type * as React from 'react';
import type { $DeepPartial } from '@callstack/react-theme-provider';
export type Font = {
fontFamily: string;
fontWeight?:
| 'normal'
| 'bold'
| '100'
| '200'
| '300'
| '400'
| '500'
| '600'
| '700'
| '800'
| '900';
fontStyle?: 'normal' | 'italic' | undefined;
};
export type Fonts = {
regular: Font;
medium: Font;
light: Font;
thin: Font;
};
type Mode = 'adaptive' | 'exact';
export type MD2Colors = {
primary: string;
background: string;
surface: string;
accent: string;
error: string;
text: string;
onSurface: string;
disabled: string;
placeholder: string;
backdrop: string;
notification: string;
tooltip: string;
};
export type MD3Colors = {
primary: string;
primaryContainer: string;
secondary: string;
secondaryContainer: string;
tertiary: string;
tertiaryContainer: string;
surface: string;
surfaceVariant: string;
surfaceDisabled: string;
background: string;
error: string;
errorContainer: string;
onPrimary: string;
onPrimaryContainer: string;
onSecondary: string;
onSecondaryContainer: string;
onTertiary: string;
onTertiaryContainer: string;
onSurface: string;
onSurfaceVariant: string;
onSurfaceDisabled: string;
onError: string;
onErrorContainer: string;
onBackground: string;
outline: string;
outlineVariant: string;
inverseSurface: string;
inverseOnSurface: string;
inversePrimary: string;
shadow: string;
scrim: string;
backdrop: string;
elevation: MD3ElevationColors;
};
export type MD3AndroidColors = {
primary: number;
primaryContainer: number;
secondary: number;
secondaryContainer: number;
tertiary: number;
tertiaryContainer: number;
surface: number;
surfaceVariant: number;
background: number;
error: number;
errorContainer: number;
onPrimary: number;
onPrimaryContainer: number;
onSecondary: number;
onSecondaryContainer: number;
onTertiary: number;
onTertiaryContainer: number;
onSurface: number;
onSurfaceVariant: number;
onError: number;
onErrorContainer: number;
onBackground: number;
outline: number;
outlineVariant: number;
inverseSurface: number;
inverseOnSurface: number;
inversePrimary: number;
shadow: number;
scrim: number;
};
export type MD3Palette = {};
export type ThemeProp = $DeepPartial<InternalTheme>;
export type ThemeBase = {
dark: boolean;
mode?: Mode;
roundness: number;
animation: {
scale: number;
defaultAnimationDuration?: number;
};
};
export type MD3Theme = ThemeBase & {
version: 3;
isV3: true;
colors: MD3Colors;
fonts: MD3Typescale;
};
export type MD2Theme = ThemeBase & {
version: 2;
isV3: false;
colors: MD2Colors;
fonts: Fonts;
};
export type InternalTheme = MD2Theme | MD3Theme;
// MD3 types
export enum MD3TypescaleKey {
displayLarge = 'displayLarge',
displayMedium = 'displayMedium',
displaySmall = 'displaySmall',
headlineLarge = 'headlineLarge',
headlineMedium = 'headlineMedium',
headlineSmall = 'headlineSmall',
titleLarge = 'titleLarge',
titleMedium = 'titleMedium',
titleSmall = 'titleSmall',
labelLarge = 'labelLarge',
labelMedium = 'labelMedium',
labelSmall = 'labelSmall',
bodyLarge = 'bodyLarge',
bodyMedium = 'bodyMedium',
bodySmall = 'bodySmall',
}
export type MD3Type = {
fontFamily: string;
letterSpacing: number;
fontWeight: Font['fontWeight'];
lineHeight: number;
fontSize: number;
fontStyle?: Font['fontStyle'];
};
export type MD3Typescale =
| {
[key in MD3TypescaleKey]: MD3Type;
} & {
['default']: Omit<MD3Type, 'lineHeight' | 'fontSize'>;
};
export type MD3Elevation = 0 | 1 | 2 | 3 | 4 | 5;
export enum ElevationLevels {
'level0',
'level1',
'level2',
'level3',
'level4',
'level5',
}
export type MD3ElevationColors = {
[key in keyof typeof ElevationLevels]: string;
};
export type $Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
export type $RemoveChildren<T extends React.ComponentType<any>> = $Omit<
React.ComponentPropsWithoutRef<T>,
'children'
>;
export type EllipsizeProp = 'head' | 'middle' | 'tail' | 'clip';
export type NavigationTheme = {
dark: boolean;
colors: {
primary: string;
background: string;
card: string;
text: string;
border: string;
notification: string;
};
};