-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.d.ts
630 lines (580 loc) · 17.6 KB
/
index.d.ts
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
import React from "react";
import Carousel from "react-native-snap-carousel";
import dayjs from "dayjs";
import RNPopover from "react-native-popover-view";
import {
FlexboxProps,
SpaceProps,
BorderProps,
ColorProps,
LayoutProps,
PositionProps,
ButtonStyleProps,
TypographyProps as SSTypographyProps,
} from "styled-system";
import {
ImageProps as RNImageProps,
ViewProps as RNViewProps,
TextInputProps as RNTextInputProps,
ScrollViewProps as RNScrollViewProps,
FlatListProps as RNFlatListProps,
TextProps as RNTextProps,
TextInputAndroidProps as RNTextInputAndroidProps,
TextInputIOSProps as RNTextInputIOSProps,
ViewStyle,
TextStyle,
TouchableOpacityProps as RNTouchableOpacityProps,
} from "react-native";
import { ModalProps } from "react-native-modal";
import { BottomTabBarProps } from "@react-navigation/bottom-tabs";
import { CalendarProps as RNCalendarProps } from "react-native-calendars";
import { FlashListProps as RNFlashListProps } from "@shopify/flash-list";
import {
RichEditorProps,
RichToolbarProps,
} from "react-native-pell-rich-editor";
import { MaterialTopTabBarProps } from "@react-navigation/material-top-tabs";
import {
ToastProps as RNToastProps,
ToastHideParams,
ToastShowParams,
ToastConfig,
} from "react-native-toast-message";
import { FastImageProps } from "react-native-fast-image";
import { theme as themeDef } from "./src/theme";
import { BUTTON_VARIANTS } from "./src/components/Button";
type addPrefixToObject<
TObject extends object,
TPrefix extends string
> = `${TPrefix}${keyof TObject}`;
const theme: {
colors: {
font: addPrefixToObject<typeof themeDef.colors.font, "font.">;
background: addPrefixToObject<
typeof themeDef.colors.background,
"background."
>;
border: addPrefixToObject<typeof themeDef.colors.border, "border.">;
toast: addPrefixToObject<typeof themeDef.colors.toast, "toast.">;
};
fonts: keyof typeof themeDef.fonts;
fontSizes: keyof typeof themeDef.fontSizes;
};
interface StyleProps
extends FlexboxProps,
SpaceProps,
BorderProps,
ColorProps,
LayoutProps,
PositionProps {
borderColor?: typeof theme.colors.border;
borderTopColor?: typeof theme.colors.border;
borderBottomColor?: typeof theme.colors.border;
borderLeftColor?: typeof theme.colors.border;
borderRightColor?: typeof theme.colors.border;
backgroundColor?: typeof theme.colors.background;
bg?: typeof theme.colors.background;
color?: typeof theme.colors.font;
}
interface TypographyProps extends SSTypographyProps {
fontFamily?: typeof theme.fonts;
fontSize?: typeof theme.fontSizes;
}
interface ViewProps extends RNViewProps, StyleProps {
children?: React.ReactNode;
}
interface TextProps extends RNTextProps, StyleProps, TypographyProps {
children?: React.ReactNode;
}
interface TextInputProps
extends RNTextInputAndroidProps,
RNTextInputIOSProps,
StyleProps,
TypographyProps {}
interface FlatListProps extends RNFlatListProps, StyleProps {}
interface ScrollViewProps extends RNScrollViewProps, StyleProps {}
interface TouchableOpacityProps
extends RNTouchableOpacityProps,
StyleProps,
ButtonStyleProps {
children?: React.ReactNode;
}
interface RipplePropTypes {
isCentered?: boolean;
isSequential?: boolean;
shouldFade?: boolean;
shouldOverflowContainer?: boolean;
color?: string;
opacity?: number;
duration?: number;
size?: number;
containerBorderRadius?: number;
}
interface TouchableProps extends StyleProps, ButtonStyleProps {
children?: React.ReactNode;
rippleConfig?: RipplePropTypes;
}
interface AccordionProps extends ViewProps {
header?: () => React.ReactNode;
headerContainerProps?: TouchableOpacityProps;
noBorder?: boolean;
onStateChanged?: (isExpanded: boolean) => void;
iconProp?: {
Label?: () => React.ReactNode;
size?: number;
color?: string;
};
position?: "top" | "bottom";
shouldShowToggle?: boolean;
}
type AlertProps = {};
type AlertButton = {
label: string;
onPress?: () => void;
variant?: typeof BUTTON_VARIANTS[keyof typeof BUTTON_VARIANTS];
};
type AlertShowParams = {
title?: string;
description?: string;
isCancelable?: boolean;
onDismiss?: () => void;
buttons?: Array<AlertButton>;
};
interface AnimatedImageProps extends RNImageProps, FastImageProps {
imageHeight?: number;
imageWidth?: number;
imageUrl: string;
}
interface AvatarProps extends ViewProps {
name?: string;
variant?: "extra-small" | "small" | "medium";
bgColor?: typeof theme.colors.background;
fontColor?: typeof theme.colors.font;
imageUrl?: string;
}
interface BadgeProps extends ViewProps {
badgeColor?: typeof theme.colors.background;
content?: string | number;
size?: number;
fontSize?: typeof theme.fontSizes;
fontFamily?: typeof theme.fonts;
color?: typeof theme.colors.font;
}
interface BottomSheetProps extends ViewProps {
showCreateOption?: boolean;
CreateItemComponent?: React.FC;
showCreateOptionLoader?: boolean;
createSearchedOptionLabelStyle?: TextProps;
createOptionLabel?: string;
onPressCreateOption?: (searchText: string) => void;
createSearchedOptionContainerStyle?: TouchableProps;
data?: Array<any>;
title?: string;
hide?: () => void;
isVisible?: boolean;
onItemPress?: ({ index, item }: { index: number; item: any }) => void;
selectedItem?: object | string;
bg?: typeof theme.colors.background;
titleContainerStyle?: ViewProps;
titleTextStyle?: TextProps;
modalParams?: ModalProps;
HeaderComponent?: () => React.ReactNode;
ContentRow?: () => React.ReactNode;
contentType?: "checkbox" | null;
canSearch?: boolean;
onDonePress?: () => void;
valueExtractor?: () => {};
labelExtractor?: () => {};
searchBarProps?: SearchBarProps;
onBackdropPress?: () => void;
disabled?: boolean;
noResultsLabelContainerStyle?: ViewProps;
noResultsLabelStyle?: TextProps;
noResultsLabel?: string;
NoResultsComponent?: () => React.ReactNode;
shouldHideKeyboardOnScrollBegin?: boolean;
shouldShowItemSeparator?: boolean;
}
interface ButtonProps extends TouchableProps {
variant?: typeof BUTTON_VARIANTS[keyof typeof BUTTON_VARIANTS];
label: string;
labelStyle?: TextProps;
RightIcon?: () => React.ReactNode;
LeftIcon?: () => React.ReactNode;
disabled?: boolean;
isLoading?: boolean;
loadingText?: string;
fontFamily?: typeof theme.fonts;
color?: typeof theme.colors;
fontSize?: typeof theme.fontSizes;
}
type ButtonGroupProps = {
activeColor?: typeof theme.colors[keyof typeof theme.colors];
inActiveColor?: typeof theme.colors[keyof typeof theme.colors];
buttonItems: Array<string>;
onPress: () => void;
currentActiveBtn: string;
wrapperStyle?: ViewProps;
buttonTextStyle?: TextProps;
buttonStyle?: TouchableProps;
};
interface CalendarProps extends RNCalendarProps {
selectedDate?: string | typeof dayjs;
}
interface CardProps extends TouchableOpacityProps, StyleProps {
elevation?: number;
}
type CarouselProps = {
itemArray: Array<any>;
renderItem: () => React.ReactNode;
carouselRef?: React.RefObject<Carousel>;
onSnapToItem?: (index: number) => void;
containerStyle: ViewProps;
};
interface CheckBoxProps extends TouchableProps {
checked: boolean;
onSelect: () => void;
disabled?: boolean;
label?: string;
checkIconStyle?: any;
labelStyle?: TextProps;
}
type ChipProps = {
label: string;
LeftIcon?: React.FC;
variant?: "outlined" | "solid";
labelColor?: typeof theme.colors.font;
closeIconBackground?: typeof theme.colors.background;
closeIconColor?: string;
onClose?: () => void;
onChipPress?: () => void;
isDisabled?: disabled;
closeIconSize?: number;
closeIcon?: string;
containerStyle?: TouchableProps;
closeIconContainerStyle?: TouchableProps;
};
interface DividerProps extends ViewProps {
thickness?: number | string;
orientation?: "horizontal" | "vertical";
bg?: typeof theme.colors.background;
}
interface FabProps extends TouchableProps {
Icon: React.FC;
bg: typeof theme.colors.background;
disabled?: boolean;
variant?: "solid" | "inverse";
onPress: () => void;
}
interface FlashListProps extends RNFlashListProps {
SkeletonComponent?: React.FC;
animationDuration?: number;
data: Array<any>;
isLoading?: boolean;
placeHolderItemCount?: number;
onRefresh?: () => void;
onEndReached?: () => void;
keyExtractor?: (item: any, index: number) => string;
}
type InputProps = {
label?: string;
value: string;
onChangeText: (val: string) => void;
onBlur?: () => void;
errorMessage?: string;
PrefixIcon?: React.FC;
SuffixIcon?: React.FC;
autoFocus?: boolean;
disabled?: boolean;
noBorder?: boolean;
showInputAccessoryView?: boolean;
inputProps?: RNTextInputProps;
textAlignVertical?: string;
};
type ChatInputProps = {
isLoading?: boolean;
shouldShowEmailFields?: boolean;
value: string;
initialSelectedOption?: "REPLY" | "NOTE" | "FORWARD";
onOptionChange?: (option: string) => void;
onChangeText: (text: string) => void;
onForward?: () => void;
onCannedResponse?: () => void;
toEmails?: string;
onReply?: () => void;
onAddNote?: () => void;
onAttachment?: () => void;
attachmentsCount?: number;
Attachments?: React.FC;
showCannedResponsesFor?: Array<"REPLY" | "NOTE" | "FORWARD">;
showSuggestionsFor?: Array<"REPLY" | "NOTE" | "FORWARD">;
disabled?: boolean;
suggestions: Array<{
name: string;
imageUrl: string;
id: string;
}>;
};
type LineLoaderProps = {
backgroundColor?: string;
foregroundColor?: string;
height?: number;
isLoading?: boolean;
};
type InputEmailChipProps = {
disabled?: boolean;
label?: string;
emails?: Array<string>;
delimiters?: Array<string>;
onUpdate?: (emails: Array<string>) => void;
};
interface ListItemProps extends ViewProps {
LeftComponent?: React.FC;
label: string;
RightComponent: React.FC;
}
interface LoaderProps extends ViewProps {
size?: "s" | "m" | "l";
color: typeof theme.colors.background;
}
type NotificationPreferenceListItem = {
label: string;
enabled: boolean;
onSwitch: (item: any, index: number) => void;
LeftIcon?: React.FC;
};
interface NotificationPreferenceListProps extends ViewProps {
data: Array<NotificationPreferenceListItem>;
itemWrapperProps?: ViewProps;
itemContainerProps?: ViewProps;
labelContainerProps?: ViewProps;
labelProps?: TypographyProps;
title?: string;
titleProps?: TypographyProps;
isLoading?: boolean;
}
interface MultiSelectConfirmationAlertObjProps {
alertTitle?: string;
alertDescription?: string;
alertConfirmButtonLabel?: string;
showDeleteAlertConfirmation?: boolean;
}
interface MultiSelectProps extends ViewProps {
options?: Array<any>;
label?: string;
value?: string | Array<any>;
labelExtractor?: (item: any, index: number) => string;
valueExtractor?: (item: any, index: number) => string;
onSelect?: (selectedData: Array<any>) => void;
deletedValue?: (deletedOption: any) => void;
isLoading?: boolean;
isSearchable?: boolean;
showCreateOption?: boolean;
labelStyle?: TextProps;
containerStyle?: ViewProps;
inputContainerStyle?: ViewProps;
dropdownContainerStyle?: ViewProps;
itemContainerStyle?: ViewProps;
multiSelectedItemContainerStyle?: ViewProps;
multiSelectedItemLabelStyle?: TextProps;
selectedValue?: (selectedOption: any) => void;
CreateItemComponent?: React.FC;
showCreateOptionLoader?: boolean;
createSearchedOptionLabelStyle?: TextProps;
onPressCreateOption?: (searchText: string) => void;
createSearchedOptionContainerStyle?: ViewProps;
onDonePress?: () => void;
disabled?: boolean;
noResultsLabelContainerStyle?: ViewStyle;
noResultsLabelStyle?: TextStyle;
noResultsLabel?: TypographyProps;
NoResultsComponent?: React.ReactNode;
maxItemSize?: number;
moreItemLabelContainerStyle?: ViewStyle;
moreItemLabelStyle?: TextStyle;
MoreItemComponent?: () => React.ReactNode;
onBackdropPress?: () => void;
searchbarProps?: SearchBarProps;
confirmationAlertObj?: MultiSelectConfirmationAlertObjProps;
}
type OnBoardingProps = {
appLogo: React.FC;
slides: Array<any>;
onComplete: () => void;
logoWidth?: number;
};
interface OrganizationItemProps extends ViewProps {
label?: string;
labelContainerProps?: ViewProps;
iconContainerProps?: ViewProps;
iconProps?: { size: number; color: typeof theme.colors.font; name: string };
labelProps?: TypographyProps;
name: string;
nameProps?: TypographyProps;
}
type OtpInputsProps = {
handleChange: (value: string) => void;
numberOfInputs: number;
error?: boolean;
code: string;
containerStyles?: ViewProps;
textStyles?: TextProps;
};
interface ParentViewProps extends ViewProps {
barStyle?: "light-content" | "dark-content";
topInset?: boolean;
rightInset?: boolean;
leftInset?: boolean;
bottomInset?: boolean;
shouldDismissKeyboardOnTap?: boolean;
backgroundColor?: string;
bg?: string;
}
interface PopOverItemNestedItemProps {
Icon?: React.FC;
label?: string;
labelProps?: TypographyProps;
}
interface PopoverItemProps {
item?: PopOverItemNestedItemProps;
onPress?: () => void;
fontFamily?: typeof theme.fonts;
fontSize?: typeof theme.fontSizes;
}
type RNPopoverProps = typeof RNPopover.propTypes;
interface PopoverProps extends RNPopoverProps {
children?: React.ReactNode;
data?: Array<PopoverItemProps>;
fontFamily?: typeof theme.fonts;
fontSize?: typeof theme.fontSizes;
}
interface RadioButtonProps extends TouchableProps {
selected: boolean;
onSelect: () => void;
disabled?: boolean;
label?: string;
radioButtonStyle?: ViewProps;
labelStyle?: TextProps;
}
type RichTextEditorProps = {
onChange: (val: string) => void;
placeholderText?: string;
children?: React.ReactNode;
toolbarActions: Array<string>;
editorProps?: RichEditorProps;
toolBarProps?: RichToolbarProps;
};
interface SearchBarProps extends ViewProps {
placeholder?: string;
onChangeText: (val: string) => void;
onCancel?: () => void;
debounceDelay?: number | string;
showCancelButton?: boolean;
containerProps?: ViewProps;
searchbarProps?: TextInputProps;
}
interface SegmentedTopBarStateProps {
routes?: Array<any>;
index?: number;
}
interface NavigationProps {
navigation: NavigationScreenProp<NavigationState, NavigationParams>;
}
interface SegmentedTopBarProps extends MaterialTopTabBarProps {
state?: SegmentedTopBarStateProps;
navigation?: NavigationProps;
height?: number;
descriptors?: object;
}
interface SocialButtonProps extends TouchableProps {
variant: "apple" | "google";
disabled?: boolean;
labelStyle?: TextProps;
isLoading?: boolean;
}
interface ToastProps extends Omit<RNToastProps, "config" | "position"> {
toasterConfig: ToastConfig;
}
type ToggleSwitchProps = {
value: boolean;
onValueChange?: () => void;
disabled?: boolean;
};
type TopBarProps = {
data: Array<any>;
activeIndex?: number;
onActiveTabChange: () => void;
activeTabTextStyle?: TextStyle;
activeTabContainerStyle?: ViewStyle;
inActiveTabTextStyle?: TextStyle;
inActiveTabContainerStyle?: ViewStyle;
tabContainerStyle?: ViewStyle;
};
type NotificationIconProps = {
unreadCount: number;
onPress: () => void;
};
type ActionIconProps = {
isLoading: boolean;
icon: () => React.ReactNode;
onPress: () => void;
size: number;
color: typeof theme.colors.font;
disabled: boolean;
label?: string;
iconProps: {
size?: number;
color?: typeof theme.colors.font;
viewBox: string;
};
};
export const Accordion: React.FC<AccordionProps>;
export const ActionIcon: React.FC<ActionIconProps>;
export const Alert: React.FC<AlertProps> & {
show?: (params: AlertShowParams) => void;
};
export const AnimatedImage: React.FC<AnimatedImageProps>;
export const Avatar: React.FC<AvatarProps>;
export const Badge: React.FC<BadgeProps>;
export const BottomSheet: React.FC<BottomSheetProps>;
export const BottomTabBar: React.FC<BottomTabBarProps>;
export const Button: React.FC<ButtonProps>;
export const ButtonGroup: React.FC<ButtonGroupProps>;
export const Calendar: React.FC<CalendarProps>;
export const Card: React.FC<CardProps>;
export const Carousel: React.FC<CarouselProps>;
export const CheckBox: React.FC<CheckBoxProps>;
export const Chip: React.FC<ChipProps>;
export const Container: React.FC<ViewProps>;
export const Divider: React.FC<DividerProps>;
export const FAB: React.FC<FabProps>;
export const FlashList: React.FC<FlashListProps>;
export const FlatList: React.FC<FlatListProps>;
export const Input: React.FC<InputProps>;
export const InputEmailChip: React.FC<InputEmailChipProps>;
export const ChatInput: React.FC<ChatInputProps>;
export const LineLoader: React.FC<LineLoaderProps>;
export const ListItem: React.FC<ListItemProps>;
export const Loader: React.FC<LoaderProps>;
export const NotificationPreferenceList: React.FC<NotificationPreferenceListProps>;
export const NotificationIcon: React.FC<NotificationIconProps>;
export const MultiSelect: React.FC<MultiSelectProps>;
export const OnBoarding: React.FC<OnBoardingProps>;
export const OrganizationItem: React.FC<OrganizationItemProps>;
export const OtpInputs: React.FC<OtpInputsProps>;
export const ParentView: React.FC<ParentViewProps>;
export const Popover: React.FC<PopoverProps>;
export const RadioButton: React.FC<RadioButtonProps>;
export const RichTextEditor: React.FC<RichTextEditorProps>;
export const ScrollView: React.FC<ScrollViewProps>;
export const SearchBar: React.FC<SearchBarProps>;
export const SegmentedTopBar: React.FC<SegmentedTopBarProps>;
export const SocialButton: React.FC<SocialButtonProps>;
export const Toast: React.FC<ToastProps> & {
show?: (params: ToastShowParams) => void;
hide?: (params: ToastHideParams) => void;
};
export const ToggleSwitch: React.FC<ToggleSwitchProps>;
export const TopBar: React.FC<TopBarProps>;
export const Touchable: React.FC<TouchableProps>;
export const Typography: React.FC<TextProps>;