sapo-components-ui-rn 1.0.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 (215) hide show
  1. package/README.md +69 -0
  2. package/dist/assets/error.png +0 -0
  3. package/dist/assets/icon-checkbox-active.svg +4 -0
  4. package/dist/assets/icon-checkbox.svg +3 -0
  5. package/dist/assets/image_default.png +0 -0
  6. package/dist/assets/images/error.png +0 -0
  7. package/dist/assets/images/image_default.png +0 -0
  8. package/dist/assets/images/info.png +0 -0
  9. package/dist/assets/images/success.png +0 -0
  10. package/dist/assets/images/warning.png +0 -0
  11. package/dist/assets/info.png +0 -0
  12. package/dist/assets/success.png +0 -0
  13. package/dist/assets/svg/icon-checkbox-active.svg +4 -0
  14. package/dist/assets/svg/icon-checkbox.svg +3 -0
  15. package/dist/assets/warning.png +0 -0
  16. package/dist/components/ActivityIndicator.d.ts +28 -0
  17. package/dist/components/Avatar/index.d.ts +17 -0
  18. package/dist/components/Badge/index.d.ts +13 -0
  19. package/dist/components/Button/index.d.ts +23 -0
  20. package/dist/components/ButtonIcon/index.d.ts +18 -0
  21. package/dist/components/Checkbox/index.d.ts +14 -0
  22. package/dist/components/ChipBar/index.d.ts +16 -0
  23. package/dist/components/CountingDot/index.d.ts +13 -0
  24. package/dist/components/FloatingButton/index.d.ts +17 -0
  25. package/dist/components/Icon/index.d.ts +17 -0
  26. package/dist/components/IconSvg/index.d.ts +12 -0
  27. package/dist/components/Image/index.d.ts +14 -0
  28. package/dist/components/ProgressBar.d.ts +42 -0
  29. package/dist/components/RadioButton/index.d.ts +13 -0
  30. package/dist/components/ScaleButton/index.d.ts +4 -0
  31. package/dist/components/SelectionField/index.d.ts +24 -0
  32. package/dist/components/Spacer/index.d.ts +9 -0
  33. package/dist/components/Switch/Switch.d.ts +47 -0
  34. package/dist/components/Switch/utils.d.ts +14 -0
  35. package/dist/components/Text/index.d.ts +14 -0
  36. package/dist/components/TextInput/Addons/Outline.d.ts +15 -0
  37. package/dist/components/TextInput/Addons/Underline.d.ts +19 -0
  38. package/dist/components/TextInput/Adornment/TextInputAdornment.d.ts +43 -0
  39. package/dist/components/TextInput/Adornment/TextInputAffix.d.ts +72 -0
  40. package/dist/components/TextInput/Adornment/enums.d.ts +12 -0
  41. package/dist/components/TextInput/Adornment/types.d.ts +11 -0
  42. package/dist/components/TextInput/Adornment/utils.d.ts +11 -0
  43. package/dist/components/TextInput/Label/InputLabel.d.ts +4 -0
  44. package/dist/components/TextInput/Label/LabelBackground.d.ts +4 -0
  45. package/dist/components/TextInput/TextInput.d.ts +171 -0
  46. package/dist/components/TextInput/TextInputDefault.d.ts +4 -0
  47. package/dist/components/TextInput/TextInputFlat.d.ts +4 -0
  48. package/dist/components/TextInput/constants.d.ts +31 -0
  49. package/dist/components/TextInput/helpers.d.ts +95 -0
  50. package/dist/components/TextInput/types.d.ts +154 -0
  51. package/dist/components/Toast/ToastProvider.d.ts +21 -0
  52. package/dist/components/Toast/index.d.ts +3 -0
  53. package/dist/components/Typography/AnimatedText.d.ts +34 -0
  54. package/dist/components/Typography/StyledText.d.ts +12 -0
  55. package/dist/components/Typography/Text.d.ts +35 -0
  56. package/dist/components/Typography/types.d.ts +2 -0
  57. package/dist/components/View/index.d.ts +38 -0
  58. package/dist/components/ViewVisibleAnimated/index.d.ts +25 -0
  59. package/dist/constants.d.ts +1 -0
  60. package/dist/core/theming.d.ts +43 -0
  61. package/dist/icons/IconArrowDown.d.ts +4 -0
  62. package/dist/icons/IconCheckbox.d.ts +4 -0
  63. package/dist/icons/IconCheckboxActive.d.ts +4 -0
  64. package/dist/icons/IconClearText.d.ts +4 -0
  65. package/dist/icons/IconRadio.d.ts +4 -0
  66. package/dist/icons/IconRadioActive.d.ts +4 -0
  67. package/dist/icons/IconRadioDisable.d.ts +4 -0
  68. package/dist/index.d.ts +33 -0
  69. package/dist/index.esm.js +6758 -0
  70. package/dist/index.esm.js.map +1 -0
  71. package/dist/index.js +6823 -0
  72. package/dist/index.js.map +1 -0
  73. package/dist/styles/fonts.d.ts +78 -0
  74. package/dist/styles/overlay.d.ts +3 -0
  75. package/dist/styles/shadow.d.ts +18 -0
  76. package/dist/styles/themes/DarkTheme.d.ts +2 -0
  77. package/dist/styles/themes/LightTheme.d.ts +2 -0
  78. package/dist/styles/themes/index.d.ts +2 -0
  79. package/dist/styles/themes/tokens.d.ts +830 -0
  80. package/dist/theme/blue.d.ts +14 -0
  81. package/dist/theme/colors.d.ts +99 -0
  82. package/dist/theme/container-styles.d.ts +124 -0
  83. package/dist/theme/dimensions.d.ts +36 -0
  84. package/dist/theme/green.d.ts +15 -0
  85. package/dist/theme/icon.d.ts +5 -0
  86. package/dist/theme/ink.d.ts +11 -0
  87. package/dist/theme/orange.d.ts +14 -0
  88. package/dist/theme/purple.d.ts +6 -0
  89. package/dist/theme/red.d.ts +15 -0
  90. package/dist/theme/themes.d.ts +277 -0
  91. package/dist/theme/white.d.ts +10 -0
  92. package/dist/theme/yellow.d.ts +15 -0
  93. package/dist/types/index.d.ts +65 -0
  94. package/dist/types.d.ts +220 -0
  95. package/dist/utils/BackHandler/BackHandler.d.ts +9 -0
  96. package/dist/utils/BackHandler/BackHandler.native.d.ts +2 -0
  97. package/dist/utils/addEventListener.d.ts +12 -0
  98. package/dist/utils/forwardRef.d.ts +11 -0
  99. package/dist/utils/function-utils.d.ts +12 -0
  100. package/dist/utils/getContrastingColor.d.ts +2 -0
  101. package/dist/utils/hasTouchHandler.d.ts +5 -0
  102. package/dist/utils/roundLayoutSize.d.ts +1 -0
  103. package/dist/utils/splitStyles.d.ts +19 -0
  104. package/dist/utils/toast-manager.d.ts +21 -0
  105. package/dist/utils/useAnimatedValue.d.ts +2 -0
  106. package/dist/utils/useAnimatedValueArray.d.ts +2 -0
  107. package/dist/utils/useIsKeyboardShown.d.ts +6 -0
  108. package/dist/utils/useLayout.d.ts +6 -0
  109. package/dist/utils/useLazyRef.d.ts +2 -0
  110. package/package.json +104 -0
  111. package/src/.DS_Store +0 -0
  112. package/src/assets/images/error.png +0 -0
  113. package/src/assets/images/image_default.png +0 -0
  114. package/src/assets/images/info.png +0 -0
  115. package/src/assets/images/success.png +0 -0
  116. package/src/assets/images/warning.png +0 -0
  117. package/src/assets/svg/icon-checkbox-active.svg +4 -0
  118. package/src/assets/svg/icon-checkbox.svg +3 -0
  119. package/src/babel/.eslintrc +7 -0
  120. package/src/babel/index.js +63 -0
  121. package/src/components/.DS_Store +0 -0
  122. package/src/components/ActivityIndicator.tsx +238 -0
  123. package/src/components/Avatar/index.tsx +102 -0
  124. package/src/components/Badge/index.tsx +55 -0
  125. package/src/components/Button/index.tsx +162 -0
  126. package/src/components/ButtonIcon/index.tsx +98 -0
  127. package/src/components/Checkbox/index.tsx +107 -0
  128. package/src/components/ChipBar/index.tsx +112 -0
  129. package/src/components/CountingDot/index.tsx +63 -0
  130. package/src/components/FloatingButton/index.tsx +99 -0
  131. package/src/components/Icon/index.tsx +135 -0
  132. package/src/components/IconSvg/index.tsx +42 -0
  133. package/src/components/Image/index.tsx +127 -0
  134. package/src/components/ProgressBar.tsx +272 -0
  135. package/src/components/RadioButton/index.tsx +105 -0
  136. package/src/components/ScaleButton/index.tsx +17 -0
  137. package/src/components/SelectionField/index.tsx +166 -0
  138. package/src/components/Spacer/index.tsx +19 -0
  139. package/src/components/Switch/Switch.tsx +110 -0
  140. package/src/components/Switch/utils.ts +96 -0
  141. package/src/components/Text/index.tsx +69 -0
  142. package/src/components/TextInput/.DS_Store +0 -0
  143. package/src/components/TextInput/Addons/Outline.tsx +62 -0
  144. package/src/components/TextInput/Addons/Underline.tsx +71 -0
  145. package/src/components/TextInput/Adornment/TextInputAdornment.tsx +191 -0
  146. package/src/components/TextInput/Adornment/TextInputAffix.tsx +212 -0
  147. package/src/components/TextInput/Adornment/enums.tsx +12 -0
  148. package/src/components/TextInput/Adornment/types.tsx +11 -0
  149. package/src/components/TextInput/Adornment/utils.ts +39 -0
  150. package/src/components/TextInput/Label/InputLabel.tsx +216 -0
  151. package/src/components/TextInput/Label/LabelBackground.tsx +100 -0
  152. package/src/components/TextInput/TextInput.tsx +564 -0
  153. package/src/components/TextInput/TextInputDefault.tsx +187 -0
  154. package/src/components/TextInput/TextInputFlat.tsx +452 -0
  155. package/src/components/TextInput/constants.tsx +48 -0
  156. package/src/components/TextInput/helpers.tsx +546 -0
  157. package/src/components/TextInput/types.tsx +155 -0
  158. package/src/components/Toast/ToastProvider.tsx +69 -0
  159. package/src/components/Toast/index.tsx +239 -0
  160. package/src/components/Typography/AnimatedText.tsx +84 -0
  161. package/src/components/Typography/StyledText.tsx +53 -0
  162. package/src/components/Typography/Text.tsx +189 -0
  163. package/src/components/Typography/types.tsx +5 -0
  164. package/src/components/View/index.tsx +175 -0
  165. package/src/components/ViewVisibleAnimated/index.tsx +199 -0
  166. package/src/constants.tsx +16 -0
  167. package/src/core/theming.tsx +144 -0
  168. package/src/icons/IconArrowDown.tsx +14 -0
  169. package/src/icons/IconCheckbox.tsx +20 -0
  170. package/src/icons/IconCheckboxActive.tsx +18 -0
  171. package/src/icons/IconClearText.tsx +14 -0
  172. package/src/icons/IconRadio.tsx +11 -0
  173. package/src/icons/IconRadioActive.tsx +12 -0
  174. package/src/icons/IconRadioDisable.tsx +12 -0
  175. package/src/index.ts +51 -0
  176. package/src/index.tsx +50 -0
  177. package/src/styles/fonts.tsx +89 -0
  178. package/src/styles/overlay.tsx +69 -0
  179. package/src/styles/shadow.tsx +47 -0
  180. package/src/styles/themes/DarkTheme.tsx +157 -0
  181. package/src/styles/themes/LightTheme.tsx +160 -0
  182. package/src/styles/themes/index.ts +3 -0
  183. package/src/styles/themes/tokens.tsx +481 -0
  184. package/src/theme/blue.ts +25 -0
  185. package/src/theme/colors.ts +21 -0
  186. package/src/theme/container-styles.tsx +126 -0
  187. package/src/theme/dimensions.ts +44 -0
  188. package/src/theme/green.ts +27 -0
  189. package/src/theme/icon.ts +7 -0
  190. package/src/theme/ink.ts +18 -0
  191. package/src/theme/orange.ts +24 -0
  192. package/src/theme/purple.ts +8 -0
  193. package/src/theme/red.ts +26 -0
  194. package/src/theme/themes.tsx +287 -0
  195. package/src/theme/white.ts +16 -0
  196. package/src/theme/yellow.ts +26 -0
  197. package/src/types/index.ts +71 -0
  198. package/src/types/svg.d.ts +5 -0
  199. package/src/types.ts +259 -0
  200. package/src/types.tsx +284 -0
  201. package/src/utils/BackHandler/BackHandler.native.tsx +3 -0
  202. package/src/utils/BackHandler/BackHandler.tsx +11 -0
  203. package/src/utils/addEventListener.tsx +56 -0
  204. package/src/utils/forwardRef.tsx +23 -0
  205. package/src/utils/function-utils.tsx +108 -0
  206. package/src/utils/getContrastingColor.tsx +15 -0
  207. package/src/utils/hasTouchHandler.tsx +23 -0
  208. package/src/utils/roundLayoutSize.ts +2 -0
  209. package/src/utils/splitStyles.ts +60 -0
  210. package/src/utils/toast-manager.tsx +46 -0
  211. package/src/utils/useAnimatedValue.tsx +9 -0
  212. package/src/utils/useAnimatedValueArray.tsx +13 -0
  213. package/src/utils/useIsKeyboardShown.tsx +55 -0
  214. package/src/utils/useLayout.tsx +29 -0
  215. package/src/utils/useLazyRef.tsx +11 -0
package/src/types.ts ADDED
@@ -0,0 +1,259 @@
1
+ import type * as React from "react";
2
+
3
+ import type { $DeepPartial } from "@callstack/react-theme-provider";
4
+
5
+ export type Font = {
6
+ fontFamily: string;
7
+ fontWeight?:
8
+ | "normal"
9
+ | "bold"
10
+ | "100"
11
+ | "200"
12
+ | "300"
13
+ | "400"
14
+ | "500"
15
+ | "600"
16
+ | "700"
17
+ | "800"
18
+ | "900";
19
+ fontStyle?: "normal" | "italic" | undefined;
20
+ };
21
+
22
+ export type Fonts = {
23
+ regular: Font;
24
+ medium: Font;
25
+ light: Font;
26
+ thin: Font;
27
+ };
28
+
29
+ type Mode = "adaptive" | "exact";
30
+
31
+ export type ThemeColors = {
32
+
33
+ elevation: MD3ElevationColors;
34
+ //background
35
+ backgroundPrimary: string;
36
+ backgroundSecondary: string;
37
+ borderBrandDefault: string;
38
+ borderCriticalDefault: string;
39
+ borderCriticalHover: string;
40
+ borderCriticalPressed: string;
41
+ borderCriticalInverseDefault: string;
42
+ borderCriticalInverseHover: string;
43
+ borderCriticalInversePressed: string;
44
+ borderErrorInverseDefault: string;
45
+ borderPrimaryFocused: string;
46
+ borderWarningInverseDefault: string;
47
+ borderSuccessInverseDefault: string;
48
+ borderErrorDefault: string;
49
+ borderInfoDefault: string;
50
+ borderPrimaryDefault: string;
51
+ borderPrimaryDisabled: string;
52
+ borderPrimaryHovered: string;
53
+ borderPrimaryInverseDefault: string;
54
+ borderPrimaryPressed: string;
55
+ borderSuccessDefault: string;
56
+ borderWarningDefault: string;
57
+ iconBrandDefault: string;
58
+ iconCriticalDefault: string;
59
+ iconErrorDefault: string;
60
+ iconInfoDefault: string;
61
+ iconPrimaryDefault: string;
62
+ iconPrimaryHover: string;
63
+ iconPrimaryDisabled: string;
64
+ iconPrimaryInverseDefault: string;
65
+ iconPrimaryInverseHover: string;
66
+ iconPrimaryInversePressed: string;
67
+ iconPrimaryPressed: string;
68
+ iconSuccessDefault: string;
69
+ iconWarningDefault: string;
70
+ surfaceBrandDefault: string;
71
+ surfaceBrandDisabled: string;
72
+ surfaceBrandHover: string;
73
+ surfaceBrandInverseDefault: string;
74
+ surfaceBrandInverseHover: string;
75
+ surfaceBrandInversePressed: string;
76
+ surfaceBrandPressed: string;
77
+ surfaceCriticalDefault: string;
78
+ surfaceCriticalDisabled: string;
79
+ surfaceCriticalHover: string;
80
+ surfaceCriticalInverseDefault: string;
81
+ surfaceCriticalInverseHover: string;
82
+ surfaceCriticalInversePressed: string;
83
+ surfaceCriticalPressed: string;
84
+ surfaceErrorDefault: string;
85
+ surfaceErrorDisabled: string;
86
+ surfaceErrorHover: string;
87
+ surfaceErrorInverseDefault: string;
88
+ surfaceErrorInverseHover: string;
89
+ surfaceErrorInversePressed: string;
90
+ surfaceErrorPressed: string;
91
+ surfaceInfoDefault: string;
92
+ surfaceInfoDisabled: string;
93
+ surfaceInfoHover: string;
94
+ surfaceInfoInverseDefault: string;
95
+ surfaceInfoInverseHover: string;
96
+ surfaceInfoInversePressed: string;
97
+ surfaceInfoPressed: string;
98
+ surfacePrimaryDefault: string;
99
+ surfacePrimaryDisabled: string;
100
+ surfacePrimaryHover: string;
101
+ surfacePrimaryInverseDefault: string;
102
+ surfacePrimaryInverseHover: string;
103
+ surfacePrimaryInversePressed: string;
104
+ surfacePrimaryPressed: string;
105
+ surfaceSecondaryDefault: string;
106
+ surfaceSecondaryDisabled: string;
107
+ surfaceSecondaryHover: string;
108
+ surfaceSecondaryPressed: string;
109
+ surfaceSuccessDefault: string;
110
+ surfaceSuccessDisabled: string;
111
+ surfaceSuccessHover: string;
112
+ surfaceSuccessInverseDefault: string;
113
+ surfaceSuccessInverseHover: string;
114
+ surfaceSuccessInversePressed: string;
115
+ surfaceSuccessPressed: string;
116
+ surfaceWarningDefault: string;
117
+ surfaceWarningDisabled: string;
118
+ surfaceWarningHover: string;
119
+ surfaceWarningInverseDefault: string;
120
+ surfaceWarningInverseHover: string;
121
+ surfaceWarningInversePressed: string;
122
+ surfaceWarningPressed: string;
123
+ textDefault: string;
124
+ textDisabled: string;
125
+ textPlaceholder: string;
126
+ textSecondary: string;
127
+ textBrandDefault: string;
128
+ textBrandDisabled: string;
129
+ textBrandHovered: string;
130
+ textBrandPressed: string;
131
+ textCriticalDefault: string;
132
+ textCriticalDisabled: string;
133
+ textCriticalHovered: string;
134
+ textCriticalPressed: string;
135
+ textErrorDefault: string;
136
+ textErrorDisabled: string;
137
+ textErrorHovered: string;
138
+ textErrorPressed: string;
139
+ textInfoDefault: string;
140
+ textInfoDisabled: string;
141
+ textInfoHovered: string;
142
+ textInfoPressed: string;
143
+ textLinkDefault: string;
144
+ textLinkDisabled: string;
145
+ textLinkHovered: string;
146
+ textLinkPressed: string;
147
+ textLinkVisitedDefault: string;
148
+ textLinkVisitedDisabled: string;
149
+ textLinkVisitedHovered: string;
150
+ textLinkVisitedPressed: string;
151
+ textOnFillDefault: string;
152
+ textOnFillDisabled: string;
153
+ textOnFillHovered: string;
154
+ textOnFillPressed: string;
155
+ textSuccessDefault: string;
156
+ textSuccessDisabled: string;
157
+ textSuccessHovered: string;
158
+ textSuccessPressed: string;
159
+ textWarningDefault: string;
160
+ textWarningDisabled: string;
161
+ textWarningHovered: string;
162
+ textWarningPressed: string;
163
+ selectBackgroundDisabled: string;
164
+ selectIconDisabled: string;
165
+ };
166
+
167
+ export type ThemeProp = $DeepPartial<InternalTheme>;
168
+
169
+ export type ThemeBase = {
170
+ dark: boolean;
171
+ mode?: Mode;
172
+ roundness: number;
173
+ animation: {
174
+ scale: number;
175
+ defaultAnimationDuration?: number;
176
+ };
177
+ };
178
+
179
+ export type AppTheme = ThemeBase & {
180
+ version: 3;
181
+ colors: ThemeColors;
182
+ fonts: MD3Typescale;
183
+ };
184
+
185
+ export type InternalTheme = AppTheme;
186
+
187
+ // MD3 types
188
+ export enum MD3TypescaleKey {
189
+ displayLarge = "displayLarge",
190
+ displayMedium = "displayMedium",
191
+ displaySmall = "displaySmall",
192
+
193
+ headlineLarge = "headlineLarge",
194
+ headlineMedium = "headlineMedium",
195
+ headlineSmall = "headlineSmall",
196
+
197
+ titleLarge = "titleLarge",
198
+ titleMedium = "titleMedium",
199
+ titleSmall = "titleSmall",
200
+
201
+ labelLarge = "labelLarge",
202
+ labelMedium = "labelMedium",
203
+ labelSmall = "labelSmall",
204
+
205
+ bodyLarge = "bodyLarge",
206
+ bodyMedium = "bodyMedium",
207
+ bodySmall = "bodySmall",
208
+ }
209
+
210
+ export type MD3Type = {
211
+ fontFamily: string;
212
+ letterSpacing: number;
213
+ fontWeight: Font["fontWeight"];
214
+ lineHeight: number;
215
+ fontSize: number;
216
+ fontStyle?: Font["fontStyle"];
217
+ };
218
+
219
+ export type MD3Typescale =
220
+ | {
221
+ [key in MD3TypescaleKey]: MD3Type;
222
+ } & {
223
+ ["default"]: Omit<MD3Type, "lineHeight" | "fontSize">;
224
+ };
225
+
226
+ export type MD3Elevation = 0 | 1 | 2 | 3 | 4 | 5;
227
+
228
+ export enum ElevationLevels {
229
+ "level0",
230
+ "level1",
231
+ "level2",
232
+ "level3",
233
+ "level4",
234
+ "level5",
235
+ }
236
+
237
+ export type MD3ElevationColors = {
238
+ [key in keyof typeof ElevationLevels]: string;
239
+ };
240
+
241
+ export type $Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
242
+ export type $RemoveChildren<T extends React.ComponentType<any>> = $Omit<
243
+ React.ComponentPropsWithoutRef<T>,
244
+ "children"
245
+ >;
246
+
247
+ export type EllipsizeProp = "head" | "middle" | "tail" | "clip";
248
+
249
+ export type NavigationTheme = {
250
+ dark: boolean;
251
+ colors: {
252
+ primary: string;
253
+ background: string;
254
+ card: string;
255
+ text: string;
256
+ border: string;
257
+ notification: string;
258
+ };
259
+ };
package/src/types.tsx ADDED
@@ -0,0 +1,284 @@
1
+ import type * as React from "react";
2
+
3
+ import type { $DeepPartial } from "@callstack/react-theme-provider";
4
+
5
+ export type Font = {
6
+ fontFamily: string;
7
+ fontWeight?:
8
+ | "normal"
9
+ | "bold"
10
+ | "100"
11
+ | "200"
12
+ | "300"
13
+ | "400"
14
+ | "500"
15
+ | "600"
16
+ | "700"
17
+ | "800"
18
+ | "900";
19
+ fontStyle?: "normal" | "italic" | undefined;
20
+ };
21
+
22
+ export type Fonts = {
23
+ regular: Font;
24
+ medium: Font;
25
+ light: Font;
26
+ thin: Font;
27
+ };
28
+
29
+ type Mode = "adaptive" | "exact";
30
+
31
+ export type ThemeColors = {
32
+ text_primary: string;
33
+ primary: string;
34
+ primaryContainer: string;
35
+ secondary: string;
36
+ secondaryContainer: string;
37
+ tertiary: string;
38
+ tertiaryContainer: string;
39
+ surface: string;
40
+ surfaceVariant: string;
41
+ surfaceDisabled: string;
42
+ background: string;
43
+ error: string;
44
+ errorContainer: string;
45
+ onPrimary: string;
46
+ onPrimaryContainer: string;
47
+ onSecondary: string;
48
+ onSecondaryContainer: string;
49
+ onTertiary: string;
50
+ onTertiaryContainer: string;
51
+ onSurface: string;
52
+ onSurfaceVariant: string;
53
+ onSurfaceDisabled: string;
54
+ onError: string;
55
+ onErrorContainer: string;
56
+ onBackground: string;
57
+ outline: string;
58
+ outlineVariant: string;
59
+ inverseSurface: string;
60
+ inverseOnSurface: string;
61
+ inversePrimary: string;
62
+ shadow: string;
63
+ scrim: string;
64
+ backdrop: string;
65
+ elevation: MD3ElevationColors;
66
+ //new theme colors
67
+
68
+ //background
69
+ backgroundPrimary: string;
70
+ backgroundSecondary: string;
71
+ borderBrandDefault: string;
72
+ borderCriticalDefault: string;
73
+ borderErrorDefault: string;
74
+ borderInfoDefault: string;
75
+ borderPrimaryDefault: string;
76
+ borderPrimaryDisabled: string;
77
+ borderPrimaryHovered: string;
78
+ borderPrimaryInverseDefault: string;
79
+ borderPrimaryPressed: string;
80
+ borderSuccessDefault: string;
81
+ borderWarningDefault: string;
82
+ iconBrandDefault: string;
83
+ iconCriticalDefault: string;
84
+ iconErrorDefault: string;
85
+ iconInfoDefault: string;
86
+ iconPrimaryDefault: string;
87
+ iconPrimaryHover: string;
88
+ iconPrimaryDisabled: string;
89
+ iconPrimaryInverseDefault: string;
90
+ iconPrimaryInverseHover: string;
91
+ iconPrimaryInversePressed: string;
92
+ iconPrimaryPressed: string;
93
+ iconSuccessDefault: string;
94
+ iconWarningDefault: string;
95
+ surfaceBrandDefault: string;
96
+ surfaceBrandDisabled: string;
97
+ surfaceBrandHover: string;
98
+ surfaceBrandInverseDefault: string;
99
+ surfaceBrandInverseHover: string;
100
+ surfaceBrandInversePressed: string;
101
+ surfaceBrandPressed: string;
102
+ surfaceCriticalDefault: string;
103
+ surfaceCriticalDisabled: string;
104
+ surfaceCriticalHover: string;
105
+ surfaceCriticalInverseDefault: string;
106
+ surfaceCriticalInverseHover: string;
107
+ surfaceCriticalInversePressed: string;
108
+ surfaceCriticalPressed: string;
109
+ surfaceErrorDefault: string;
110
+ surfaceErrorDisabled: string;
111
+ surfaceErrorHover: string;
112
+ surfaceErrorInverseDefault: string;
113
+ surfaceErrorInverseHover: string;
114
+ surfaceErrorInversePressed: string;
115
+ surfaceErrorPressed: string;
116
+ surfaceInfoDefault: string;
117
+ surfaceInfoDisabled: string;
118
+ surfaceInfoHover: string;
119
+ surfaceInfoInverseDefault: string;
120
+ surfaceInfoInverseHover: string;
121
+ surfaceInfoInversePressed: string;
122
+ surfaceInfoPressed: string;
123
+ surfacePrimaryDefault: string;
124
+ surfacePrimaryDisabled: string;
125
+ surfacePrimaryHover: string;
126
+ surfacePrimaryInverseDefault: string;
127
+ surfacePrimaryInverseHover: string;
128
+ surfacePrimaryInversePressed: string;
129
+ surfacePrimaryPressed: string;
130
+ surfaceSecondaryDefault: string;
131
+ surfaceSecondaryDisabled: string;
132
+ surfaceSecondaryHover: string;
133
+ surfaceSecondaryPressed: string;
134
+ surfaceSuccessDefault: string;
135
+ surfaceSuccessDisabled: string;
136
+ surfaceSuccessHover: string;
137
+ surfaceSuccessInverseDefault: string;
138
+ surfaceSuccessInverseHover: string;
139
+ surfaceSuccessInversePressed: string;
140
+ surfaceSuccessPressed: string;
141
+ surfaceWarningDefault: string;
142
+ surfaceWarningDisabled: string;
143
+ surfaceWarningHover: string;
144
+ surfaceWarningInverseDefault: string;
145
+ surfaceWarningInverseHover: string;
146
+ surfaceWarningInversePressed: string;
147
+ surfaceWarningPressed: string;
148
+ textDefault: string;
149
+ textDisabled: string;
150
+ textPlaceholder: string;
151
+ textSecondary: string;
152
+ textBrandDefault: string;
153
+ textBrandDisabled: string;
154
+ textBrandHovered: string;
155
+ textBrandPressed: string;
156
+ textCriticalDefault: string;
157
+ textCriticalDisabled: string;
158
+ textCriticalHovered: string;
159
+ textCriticalPressed: string;
160
+ textErrorDefault: string;
161
+ textErrorDisabled: string;
162
+ textErrorHovered: string;
163
+ textErrorPressed: string;
164
+ textInfoDefault: string;
165
+ textInfoDisabled: string;
166
+ textInfoHovered: string;
167
+ textInfoPressed: string;
168
+ textLinkDefault: string;
169
+ textLinkDisabled: string;
170
+ textLinkHovered: string;
171
+ textLinkPressed: string;
172
+ textLinkVisitedDefault: string;
173
+ textLinkVisitedDisabled: string;
174
+ textLinkVisitedHovered: string;
175
+ textLinkVisitedPressed: string;
176
+ textOnFillDefault: string;
177
+ textOnFillDisabled: string;
178
+ textOnFillHovered: string;
179
+ textOnFillPressed: string;
180
+ textSuccessDefault: string;
181
+ textSuccessDisabled: string;
182
+ textSuccessHovered: string;
183
+ textSuccessPressed: string;
184
+ textWarningDefault: string;
185
+ textWarningDisabled: string;
186
+ textWarningHovered: string;
187
+ textWarningPressed: string;
188
+ selectBackgroundDisabled: string;
189
+ selectIconDisabled: string;
190
+ };
191
+
192
+ export type ThemeProp = $DeepPartial<InternalTheme>;
193
+
194
+ export type ThemeBase = {
195
+ dark: boolean;
196
+ mode?: Mode;
197
+ roundness: number;
198
+ animation: {
199
+ scale: number;
200
+ defaultAnimationDuration?: number;
201
+ };
202
+ };
203
+
204
+ export type AppTheme = ThemeBase & {
205
+ version: 3;
206
+ colors: ThemeColors;
207
+ fonts: MD3Typescale;
208
+ };
209
+
210
+ export type InternalTheme = AppTheme;
211
+
212
+ // MD3 types
213
+ export enum MD3TypescaleKey {
214
+ displayLarge = "displayLarge",
215
+ displayMedium = "displayMedium",
216
+ displaySmall = "displaySmall",
217
+
218
+ headlineLarge = "headlineLarge",
219
+ headlineMedium = "headlineMedium",
220
+ headlineSmall = "headlineSmall",
221
+
222
+ titleLarge = "titleLarge",
223
+ titleMedium = "titleMedium",
224
+ titleSmall = "titleSmall",
225
+
226
+ labelLarge = "labelLarge",
227
+ labelMedium = "labelMedium",
228
+ labelSmall = "labelSmall",
229
+
230
+ bodyLarge = "bodyLarge",
231
+ bodyMedium = "bodyMedium",
232
+ bodySmall = "bodySmall",
233
+ }
234
+
235
+ export type MD3Type = {
236
+ fontFamily: string;
237
+ letterSpacing: number;
238
+ fontWeight: Font["fontWeight"];
239
+ lineHeight: number;
240
+ fontSize: number;
241
+ fontStyle?: Font["fontStyle"];
242
+ };
243
+
244
+ export type MD3Typescale =
245
+ | {
246
+ [key in MD3TypescaleKey]: MD3Type;
247
+ } & {
248
+ ["default"]: Omit<MD3Type, "lineHeight" | "fontSize">;
249
+ };
250
+
251
+ export type MD3Elevation = 0 | 1 | 2 | 3 | 4 | 5;
252
+
253
+ export enum ElevationLevels {
254
+ "level0",
255
+ "level1",
256
+ "level2",
257
+ "level3",
258
+ "level4",
259
+ "level5",
260
+ }
261
+
262
+ export type MD3ElevationColors = {
263
+ [key in keyof typeof ElevationLevels]: string;
264
+ };
265
+
266
+ export type $Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
267
+ export type $RemoveChildren<T extends React.ComponentType<any>> = $Omit<
268
+ React.ComponentPropsWithoutRef<T>,
269
+ "children"
270
+ >;
271
+
272
+ export type EllipsizeProp = "head" | "middle" | "tail" | "clip";
273
+
274
+ export type NavigationTheme = {
275
+ dark: boolean;
276
+ colors: {
277
+ primary: string;
278
+ background: string;
279
+ card: string;
280
+ text: string;
281
+ border: string;
282
+ notification: string;
283
+ };
284
+ };
@@ -0,0 +1,3 @@
1
+ import { BackHandler } from 'react-native';
2
+
3
+ export { BackHandler };
@@ -0,0 +1,11 @@
1
+ function emptyFunction() {}
2
+
3
+ export const BackHandler = {
4
+ exitApp: emptyFunction,
5
+ addEventListener(): { remove: () => void } {
6
+ return {
7
+ remove: emptyFunction,
8
+ };
9
+ },
10
+ removeEventListener: emptyFunction,
11
+ };
@@ -0,0 +1,56 @@
1
+ import type {
2
+ NativeEventSubscription,
3
+ EmitterSubscription,
4
+ } from 'react-native';
5
+
6
+ export function addEventListener<
7
+ T extends {
8
+ addEventListener: (
9
+ ...args: any
10
+ ) => NativeEventSubscription | EmitterSubscription;
11
+ } & { removeEventListener?: (...args: any) => void } & {
12
+ remove?: (...args: any) => void;
13
+ }
14
+ >(Module: T, ...rest: Parameters<typeof Module.addEventListener>) {
15
+ const [eventName, handler] = rest;
16
+
17
+ let removed = false;
18
+
19
+ const subscription = Module.addEventListener(eventName, handler) ?? {
20
+ remove: () => {
21
+ if (removed) {
22
+ return;
23
+ }
24
+
25
+ Module.removeEventListener?.(eventName, handler);
26
+ Module.remove?.(eventName, handler);
27
+ removed = true;
28
+ },
29
+ };
30
+
31
+ return subscription;
32
+ }
33
+
34
+ export function addListener<
35
+ T extends {
36
+ addListener: (...args: any) => EmitterSubscription;
37
+ removeEventListener: (...args: any) => void;
38
+ }
39
+ >(Module: T, ...rest: Parameters<typeof Module.addListener>) {
40
+ const [eventName, handler] = rest;
41
+
42
+ let removed = false;
43
+
44
+ const subscription = Module.addListener(eventName, handler) ?? {
45
+ remove: () => {
46
+ if (removed) {
47
+ return;
48
+ }
49
+
50
+ Module.removeEventListener(eventName, handler);
51
+ removed = true;
52
+ },
53
+ };
54
+
55
+ return subscription;
56
+ }
@@ -0,0 +1,23 @@
1
+ import * as React from 'react';
2
+ import type {
3
+ ForwardRefRenderFunction,
4
+ PropsWithoutRef,
5
+ RefAttributes,
6
+ ForwardRefExoticComponent,
7
+ } from 'react';
8
+
9
+ export type ForwardRefComponent<T, P = {}> = ForwardRefExoticComponent<
10
+ PropsWithoutRef<P> & RefAttributes<T>
11
+ >;
12
+
13
+ /**
14
+ * TypeScript generated a large union of props from `ViewProps` in
15
+ * `d.ts` files when using `React.forwardRef`. To prevent this
16
+ * `ForwardRefComponent` was created and exported. Use this
17
+ * `forwardRef` instead of `React.forwardRef` so you don't have to
18
+ * import `ForwardRefComponent`.
19
+ * More info: https://github.com/callstack/react-native-paper/pull/3603
20
+ */
21
+ export const forwardRef: <T, P = {}>(
22
+ render: ForwardRefRenderFunction<T, P>
23
+ ) => ForwardRefComponent<T, P> = React.forwardRef;