@bigbinary/neetoui-rn 0.0.185 → 0.0.186
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/index.d.ts +449 -0
- package/lib/components/Button.js +1 -1
- package/package.json +2 -1
- package/src/components/Button.js +15 -12
- package/src/components/FAB.js +1 -1
package/index.d.ts
ADDED
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Carousel from "react-native-snap-carousel";
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
import RNPopover from "react-native-popover-view";
|
|
5
|
+
import {
|
|
6
|
+
FlexboxProps,
|
|
7
|
+
SpaceProps,
|
|
8
|
+
BorderProps,
|
|
9
|
+
ColorProps,
|
|
10
|
+
LayoutProps,
|
|
11
|
+
PositionProps,
|
|
12
|
+
ButtonStyleProps,
|
|
13
|
+
TypographyProps,
|
|
14
|
+
} from "styled-system";
|
|
15
|
+
import {
|
|
16
|
+
ImageProps as RNImageProps,
|
|
17
|
+
ViewProps as RNViewProps,
|
|
18
|
+
TextInputProps as RNTextInputProps,
|
|
19
|
+
ScrollViewProps as RNScrollViewProps,
|
|
20
|
+
FlatListProps as RNFlatListProps,
|
|
21
|
+
TextProps as RNTextProps,
|
|
22
|
+
TextInputAndroidProps as RNTextInputAndroidProps,
|
|
23
|
+
TextInputIOSProps as RNTextInputIOSProps,
|
|
24
|
+
ViewStyle,
|
|
25
|
+
TextStyle,
|
|
26
|
+
TouchableOpacityProps,
|
|
27
|
+
} from "react-native";
|
|
28
|
+
import { ModalProps } from "react-native-modal";
|
|
29
|
+
import { BottomTabBarProps } from "@react-navigation/bottom-tabs";
|
|
30
|
+
import { CalendarProps as RNCalendarProps } from "react-native-calendars";
|
|
31
|
+
import { FlashListProps as RNFlashListProps } from "@shopify/flash-list";
|
|
32
|
+
import {
|
|
33
|
+
RichEditorProps,
|
|
34
|
+
RichToolbarProps,
|
|
35
|
+
} from "react-native-pell-rich-editor";
|
|
36
|
+
import { MaterialTopTabBarProps } from "@react-navigation/material-top-tabs";
|
|
37
|
+
import {
|
|
38
|
+
ToastProps as RNToastProps,
|
|
39
|
+
ToastHideParams,
|
|
40
|
+
ToastShowParams,
|
|
41
|
+
ToastConfig,
|
|
42
|
+
} from "react-native-toast-message";
|
|
43
|
+
import { RippleProps } from "react-native-material-ripple";
|
|
44
|
+
|
|
45
|
+
import { theme as themeDef } from "./src/theme";
|
|
46
|
+
import { BUTTON_VARIANTS } from "./src/components/Button";
|
|
47
|
+
|
|
48
|
+
type addPrefixToObject<
|
|
49
|
+
TObject extends object,
|
|
50
|
+
TPrefix extends string
|
|
51
|
+
> = `${TPrefix}${keyof TObject}`;
|
|
52
|
+
|
|
53
|
+
const theme: {
|
|
54
|
+
colors: {
|
|
55
|
+
font: addPrefixToObject<typeof themeDef.colors.font, "font.">;
|
|
56
|
+
background: addPrefixToObject<
|
|
57
|
+
typeof themeDef.colors.background,
|
|
58
|
+
"background."
|
|
59
|
+
>;
|
|
60
|
+
border: addPrefixToObject<typeof themeDef.colors.border, "border.">;
|
|
61
|
+
toast: addPrefixToObject<typeof themeDef.colors.toast, "toast.">;
|
|
62
|
+
};
|
|
63
|
+
fonts: keyof typeof themeDef.fonts;
|
|
64
|
+
fontSizes: keyof typeof themeDef.fontSizes;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
interface StyleProps
|
|
68
|
+
extends FlexboxProps,
|
|
69
|
+
SpaceProps,
|
|
70
|
+
BorderProps,
|
|
71
|
+
ColorProps,
|
|
72
|
+
LayoutProps,
|
|
73
|
+
PositionProps {}
|
|
74
|
+
|
|
75
|
+
interface ViewProps extends RNViewProps, StyleProps {
|
|
76
|
+
children?: React.ReactNode;
|
|
77
|
+
}
|
|
78
|
+
interface TextProps extends RNTextProps, StyleProps, TypographyProps {
|
|
79
|
+
children?: React.ReactNode;
|
|
80
|
+
}
|
|
81
|
+
interface TextInputProps
|
|
82
|
+
extends RNTextInputAndroidProps,
|
|
83
|
+
RNTextInputIOSProps,
|
|
84
|
+
StyleProps,
|
|
85
|
+
TypographyProps {}
|
|
86
|
+
interface FlatListProps extends RNFlatListProps, StyleProps {}
|
|
87
|
+
interface ScrollViewProps extends RNScrollViewProps, StyleProps {}
|
|
88
|
+
interface TouchableProps extends RippleProps, StyleProps, ButtonStyleProps {
|
|
89
|
+
children?: React.ReactNode;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface AccordionProps extends ViewProps {
|
|
93
|
+
header?: () => React.ReactNode;
|
|
94
|
+
noBorder?: boolean;
|
|
95
|
+
onStateChange?: (isExpanded: boolean) => void;
|
|
96
|
+
iconProp?: {
|
|
97
|
+
name?: string;
|
|
98
|
+
Label?: () => React.ReactNode;
|
|
99
|
+
size?: number;
|
|
100
|
+
color?: string;
|
|
101
|
+
};
|
|
102
|
+
position?: "top" | "bottom";
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
type AlertProps = {};
|
|
106
|
+
type AlertButton = {
|
|
107
|
+
label: string;
|
|
108
|
+
onPress?: () => void;
|
|
109
|
+
variant?: typeof BUTTON_VARIANTS[keyof typeof BUTTON_VARIANTS];
|
|
110
|
+
};
|
|
111
|
+
type AlertShowParams = {
|
|
112
|
+
title?: string;
|
|
113
|
+
description?: string;
|
|
114
|
+
isCancelable?: boolean;
|
|
115
|
+
onDismiss?: () => void;
|
|
116
|
+
buttons?: Array<AlertButton>;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
interface AnimatedImageProps extends RNImageProps {
|
|
120
|
+
imageHeight?: number;
|
|
121
|
+
imageWidth?: number;
|
|
122
|
+
imageUrl: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface AvatarProps extends ViewProps {
|
|
126
|
+
name?: string;
|
|
127
|
+
variant?: "small" | "medium";
|
|
128
|
+
bgColor?: typeof theme.colors.background;
|
|
129
|
+
fontColor?: typeof theme.colors.font;
|
|
130
|
+
imageUrl?: string;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interface BadgeProps extends ViewProps {
|
|
134
|
+
badgeColor?: typeof theme.colors.background;
|
|
135
|
+
content?: string | number;
|
|
136
|
+
size?: number;
|
|
137
|
+
fontSize?: typeof theme.fontSizes;
|
|
138
|
+
fontFamily?: typeof theme.fonts;
|
|
139
|
+
color?: typeof theme.colors.font;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
interface BottomSheetProps extends ViewProps {
|
|
143
|
+
showCreateOption?: boolean;
|
|
144
|
+
CreateItemComponent?: React.ReactNode;
|
|
145
|
+
showCreateOptionLoader?: boolean;
|
|
146
|
+
createSearchedOptionLabelStyle?: TextProps;
|
|
147
|
+
createOptionLabel?: string;
|
|
148
|
+
onPressCreateOption?: (searchText: string) => void;
|
|
149
|
+
createSearchedOptionContainerStyle?: TouchableProps;
|
|
150
|
+
data?: Array<any>;
|
|
151
|
+
title?: string;
|
|
152
|
+
hide?: () => void;
|
|
153
|
+
isVisible?: boolean;
|
|
154
|
+
onItemPress?: ({ index, item }: { index: number; item: any }) => void;
|
|
155
|
+
selectedItemIndex?: number;
|
|
156
|
+
bg?: typeof theme.colors.background;
|
|
157
|
+
titleContainerStyle?: ViewProps;
|
|
158
|
+
titleTextStyle?: TextProps;
|
|
159
|
+
modalParams?: ModalProps;
|
|
160
|
+
HeaderComponent?: () => React.ReactNode;
|
|
161
|
+
ContentRow?: () => React.ReactNode;
|
|
162
|
+
contentType?: "checkbox" | null;
|
|
163
|
+
canSearch?: boolean;
|
|
164
|
+
onDonePress?: () => void;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
interface ButtonProps extends TouchableProps {
|
|
168
|
+
variant?: typeof BUTTON_VARIANTS[keyof typeof BUTTON_VARIANTS];
|
|
169
|
+
label: string;
|
|
170
|
+
labelStyle?: TextProps;
|
|
171
|
+
RightIcon?: () => React.ReactNode;
|
|
172
|
+
LeftIcon?: () => React.ReactNode;
|
|
173
|
+
disabled?: boolean;
|
|
174
|
+
isLoading?: boolean;
|
|
175
|
+
loadingText?: string;
|
|
176
|
+
fontFamily?: typeof theme.fonts;
|
|
177
|
+
color?: typeof theme.colors;
|
|
178
|
+
fontSize?: typeof theme.fontSizes;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
type ButtonGroupProps = {
|
|
182
|
+
activeColor?: typeof theme.colors[keyof typeof theme.colors];
|
|
183
|
+
inActiveColor?: typeof theme.colors[keyof typeof theme.colors];
|
|
184
|
+
buttonItems: Array<string>;
|
|
185
|
+
onPress: () => void;
|
|
186
|
+
currentActiveBtn: string;
|
|
187
|
+
wrapperStyle?: ViewProps;
|
|
188
|
+
buttonTextStyle?: TextProps;
|
|
189
|
+
buttonStyle?: TouchableProps;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
interface CalendarProps extends RNCalendarProps {
|
|
193
|
+
selectedDate?: string | typeof dayjs;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
interface CardProps extends TouchableOpacityProps, StyleProps {
|
|
197
|
+
elevation?: number;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
type CarouselProps = {
|
|
201
|
+
itemArray: Array<any>;
|
|
202
|
+
renderItem: () => React.ReactNode;
|
|
203
|
+
carouselRef?: React.RefObject<Carousel>;
|
|
204
|
+
onSnapToItem?: (index: number) => void;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
interface CheckBoxProps extends TouchableProps {
|
|
208
|
+
checked: boolean;
|
|
209
|
+
onSelect: () => void;
|
|
210
|
+
disabled?: boolean;
|
|
211
|
+
label?: string;
|
|
212
|
+
checkboxStyle?: ViewProps;
|
|
213
|
+
checkIconStyle?: any;
|
|
214
|
+
labelStyle?: TextProps;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
type ChipProps = {
|
|
218
|
+
label: string;
|
|
219
|
+
LeftIcon?: React.FC;
|
|
220
|
+
variant?: "outlined" | "solid";
|
|
221
|
+
labelColor?: typeof theme.colors.font;
|
|
222
|
+
closeIconBackground?: typeof theme.colors.background;
|
|
223
|
+
closeIconColor?: string;
|
|
224
|
+
onClose?: () => void;
|
|
225
|
+
onChipPress?: () => void;
|
|
226
|
+
isDisabled?: disabled;
|
|
227
|
+
closeIconSize?: number;
|
|
228
|
+
closeIcon?: string;
|
|
229
|
+
containerStyle?: TouchableProps;
|
|
230
|
+
closeIconContainerStyle?: TouchableProps;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
interface DividerProps extends ViewProps {
|
|
234
|
+
thickness?: number | string;
|
|
235
|
+
orientation?: "horizontal" | "vertical";
|
|
236
|
+
bg?: typeof theme.colors.background;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
interface FabProps extends TouchableProps {
|
|
240
|
+
Icon: React.FC;
|
|
241
|
+
bg: typeof theme.colors.background;
|
|
242
|
+
disabled?: boolean;
|
|
243
|
+
variant?: "solid" | "inverse";
|
|
244
|
+
onPress: () => void;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
interface FlashListProps extends RNFlashListProps {
|
|
248
|
+
SkeletonComponent?: React.FC;
|
|
249
|
+
durationPerItem?: number;
|
|
250
|
+
data: Array<any>;
|
|
251
|
+
isLoading?: boolean;
|
|
252
|
+
placeHolderItemCount?: number;
|
|
253
|
+
onRefresh?: () => void;
|
|
254
|
+
onEndReached?: () => void;
|
|
255
|
+
keyExtractor?: (item: any, index: number) => string;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
type InputProps = {
|
|
259
|
+
label?: string;
|
|
260
|
+
value: string;
|
|
261
|
+
onChangeText: (val: string) => void;
|
|
262
|
+
onBlur?: () => void;
|
|
263
|
+
errorMessage?: string;
|
|
264
|
+
PrefixIcon?: React.FC;
|
|
265
|
+
SuffixIcon?: React.FC;
|
|
266
|
+
autoFocus?: boolean;
|
|
267
|
+
disabled?: boolean;
|
|
268
|
+
noBorder?: boolean;
|
|
269
|
+
inputProps?: RNTextInputProps;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
interface ListItemProps extends ViewProps {
|
|
273
|
+
LeftComponent?: React.FC;
|
|
274
|
+
label: string;
|
|
275
|
+
RightComponent: React.FC;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
interface MultiSelectProps extends ViewProps {
|
|
279
|
+
options?: Array<any>;
|
|
280
|
+
label?: string;
|
|
281
|
+
value?: string | Array<any>;
|
|
282
|
+
placeholder?: string;
|
|
283
|
+
labelExtractor?: (item: any, index: number) => string;
|
|
284
|
+
valueExtractor?: (item: any, index: number) => string;
|
|
285
|
+
onSelect?: (selectedData: Array<any>) => void;
|
|
286
|
+
deletedValue?: (deletedOption: any) => void;
|
|
287
|
+
isLoading?: boolean;
|
|
288
|
+
isSearchable?: boolean;
|
|
289
|
+
showCreateOption?: boolean;
|
|
290
|
+
labelStyle?: TextProps;
|
|
291
|
+
containerStyle?: ViewProps;
|
|
292
|
+
inputContainerStyle?: ViewProps;
|
|
293
|
+
dropdownContainerStyle?: ViewProps;
|
|
294
|
+
itemContainerStyle?: ViewProps;
|
|
295
|
+
multiSelectedItemContainerStyle?: ViewProps;
|
|
296
|
+
multiSelectedItemLabelStyle?: TextProps;
|
|
297
|
+
selectedValue?: (selectedOption: any) => void;
|
|
298
|
+
CreateItemComponent?: React.FC;
|
|
299
|
+
showCreateOptionLoader?: boolean;
|
|
300
|
+
createSearchedOptionLabelStyle?: TextProps;
|
|
301
|
+
onPressCreateOption?: (searchText: string) => void;
|
|
302
|
+
createSearchedOptionContainerStyle?: ViewProps;
|
|
303
|
+
onDonePress?: () => void;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
type OnBoardingProps = {
|
|
307
|
+
appLogo: React.FC;
|
|
308
|
+
slides: Array<any>;
|
|
309
|
+
onComplete: () => void;
|
|
310
|
+
logoWidth?: number;
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
type OtpInputsProps = {
|
|
314
|
+
handleChange: (value: string) => void;
|
|
315
|
+
numberOfInputs: number;
|
|
316
|
+
error?: boolean;
|
|
317
|
+
code: string;
|
|
318
|
+
containerStyles?: ViewProps;
|
|
319
|
+
textStyles?: TextProps;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
interface ParentViewProps extends ViewProps {
|
|
323
|
+
barStyle?: "light-content" | "dark-content";
|
|
324
|
+
topInset?: boolean;
|
|
325
|
+
rightInset?: boolean;
|
|
326
|
+
leftInset?: boolean;
|
|
327
|
+
bottomInset?: boolean;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
type RNPopoverProps = typeof RNPopover.propTypes;
|
|
331
|
+
interface PopoverProps extends RNPopoverProps {
|
|
332
|
+
children?: React.ReactNode;
|
|
333
|
+
data?: Array<any>;
|
|
334
|
+
fontFamily?: typeof theme.fonts;
|
|
335
|
+
fontSize?: typeof theme.fontSizes;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
interface RadioButtonProps extends TouchableProps {
|
|
339
|
+
selected: boolean;
|
|
340
|
+
onSelect: () => void;
|
|
341
|
+
disabled?: boolean;
|
|
342
|
+
label?: string;
|
|
343
|
+
radioButtonStyle?: ViewProps;
|
|
344
|
+
labelStyle?: TextProps;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
type RichTextEditorProps = {
|
|
348
|
+
onChange: (val: string) => void;
|
|
349
|
+
placeholderText?: string;
|
|
350
|
+
children?: React.ReactNode;
|
|
351
|
+
toolbarActions: Array<string>;
|
|
352
|
+
editorProps?: RichEditorProps;
|
|
353
|
+
toolBarProps?: RichToolbarProps;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
interface SearchBarProps extends ViewProps {
|
|
357
|
+
placeholder?: string;
|
|
358
|
+
onChangeText: (val: string) => void;
|
|
359
|
+
onCancel?: () => void;
|
|
360
|
+
debounceDelay?: number | string;
|
|
361
|
+
showCancelButton?: boolean;
|
|
362
|
+
containerProps?: ViewProps;
|
|
363
|
+
searchbarProps?: TextInputProps;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
interface SegmentedTopBarProps extends MaterialTopTabBarProps {
|
|
367
|
+
inactiveSegmentStyle?: ViewStyle;
|
|
368
|
+
activeSegmentStyle?: ViewStyle;
|
|
369
|
+
activeTextStyle?: TouchableProps;
|
|
370
|
+
inactiveTextStyle?: TouchableProps;
|
|
371
|
+
height?: number;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
interface SelectProps
|
|
375
|
+
extends Omit<MultiSelectProps, "value" | "selectedValue" | "deletedValue"> {
|
|
376
|
+
value: any;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
interface SocialButtonProps extends TouchableProps {
|
|
380
|
+
variant: "apple" | "google";
|
|
381
|
+
disabled?: boolean;
|
|
382
|
+
labelStyle?: TextProps;
|
|
383
|
+
isLoading?: boolean;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
interface ToastProps extends Omit<RNToastProps, "config" | "position"> {
|
|
387
|
+
toasterConfig: ToastConfig;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
type ToggleSwitchProps = {
|
|
391
|
+
value: boolean;
|
|
392
|
+
onValueChange?: () => void;
|
|
393
|
+
disabled?: boolean;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
type TopBarProps = {
|
|
397
|
+
data: Array<any>;
|
|
398
|
+
activeIndex?: number;
|
|
399
|
+
onActiveTabChange: () => void;
|
|
400
|
+
activeTabTextStyle?: TextStyle;
|
|
401
|
+
activeTabContainerStyle?: ViewStyle;
|
|
402
|
+
inActiveTabTextStyle?: TextStyle;
|
|
403
|
+
inActiveTabContainerStyle?: ViewStyle;
|
|
404
|
+
tabContainerStyle?: ViewStyle;
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
export const Accordion: React.FC<AccordionProps>;
|
|
408
|
+
export const Alert: React.FC<AlertProps> & {
|
|
409
|
+
show?: (params: AlertShowParams) => void;
|
|
410
|
+
};
|
|
411
|
+
export const AnimatedImage: React.FC<AnimatedImageProps>;
|
|
412
|
+
export const Avatar: React.FC<AvatarProps>;
|
|
413
|
+
export const Badge: React.FC<BadgeProps>;
|
|
414
|
+
export const BottomSheet: React.FC<BottomSheetProps>;
|
|
415
|
+
export const BottomTabBar: React.FC<BottomTabBarProps>;
|
|
416
|
+
export const Button: React.FC<ButtonProps>;
|
|
417
|
+
export const ButtonGroup: React.FC<ButtonGroupProps>;
|
|
418
|
+
export const Calendar: React.FC<CalendarProps>;
|
|
419
|
+
export const Card: React.FC<CardProps>;
|
|
420
|
+
export const Carousel: React.FC<CarouselProps>;
|
|
421
|
+
export const CheckBox: React.FC<CheckBoxProps>;
|
|
422
|
+
export const Chip: React.FC<ChipProps>;
|
|
423
|
+
export const Container: React.FC<ViewProps>;
|
|
424
|
+
export const Divider: React.FC<DividerProps>;
|
|
425
|
+
export const Fab: React.FC<FabProps>;
|
|
426
|
+
export const FlashList: React.FC<FlashListProps>;
|
|
427
|
+
export const FlatList: React.FC<FlatListProps>;
|
|
428
|
+
export const Input: React.FC<InputProps>;
|
|
429
|
+
export const ListItem: React.FC<ListItemProps>;
|
|
430
|
+
export const MultiSelect: React.FC<MultiSelectProps>;
|
|
431
|
+
export const OnBoarding: React.FC<OnBoardingProps>;
|
|
432
|
+
export const OtpInputs: React.FC<OtpInputsProps>;
|
|
433
|
+
export const ParentView: React.FC<ParentViewProps>;
|
|
434
|
+
export const Popover: React.FC<PopoverProps>;
|
|
435
|
+
export const RadioButton: React.FC<RadioButtonProps>;
|
|
436
|
+
export const RichTextEditor: React.FC<RichTextEditorProps>;
|
|
437
|
+
export const ScrollView: React.FC<ScrollViewProps>;
|
|
438
|
+
export const SearchBar: React.FC<SearchBarProps>;
|
|
439
|
+
export const SegmentedTopBar: React.FC<SegmentedTopBarProps>;
|
|
440
|
+
export const Select: React.FC<SelectProps>;
|
|
441
|
+
export const SocialButton: React.FC<SocialButtonProps>;
|
|
442
|
+
export const Toast: React.FC<ToastProps> & {
|
|
443
|
+
show?: (params: ToastShowParams) => void;
|
|
444
|
+
hide?: (params: ToastHideParams) => void;
|
|
445
|
+
};
|
|
446
|
+
export const ToggleSwitch: React.FC<ToggleSwitchProps>;
|
|
447
|
+
export const TopBar: React.FC<TopBarProps>;
|
|
448
|
+
export const Touchable: React.FC<TouchableProps>;
|
|
449
|
+
export const Typography: React.FC<TextProps>;
|
package/lib/components/Button.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.Button=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _propTypes=_interopRequireDefault(require("@styled-system/prop-types"));var _propTypes2=_interopRequireDefault(require("prop-types"));var _native=require("styled-components/native");var _reactNative=require("react-native");var _=require("./");var _excluded=["variant","label","labelStyle","RightIcon","LeftIcon","disabled","isLoading","loadingText","fontFamily","color","fontSize"];var _this=this,_jsxFileName="/home/runner/work/neeto-ui-rn/neeto-ui-rn/src/components/Button.js";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var Button=function Button(props){var variant=props.variant,label=props.label,labelStyle=props.labelStyle,RightIcon=props.RightIcon,LeftIcon=props.LeftIcon,disabled=props.disabled,isLoading=props.isLoading,loadingText=props.loadingText,fontFamily=props.fontFamily,color=props.color,fontSize=props.fontSize,rest=(0,_objectWithoutProperties2.default)(props,_excluded);var theme=(0,_react.useContext)(_native.ThemeContext);var width=variant==="text"||variant==="danger-text"?null:"100%";var getButtonColors=function getButtonColors(){switch(variant){case
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.Button=exports.BUTTON_VARIANTS=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _propTypes=_interopRequireDefault(require("@styled-system/prop-types"));var _propTypes2=_interopRequireDefault(require("prop-types"));var _native=require("styled-components/native");var _reactNative=require("react-native");var _=require("./");var _excluded=["variant","label","labelStyle","RightIcon","LeftIcon","disabled","isLoading","loadingText","fontFamily","color","fontSize"];var _this=this,_jsxFileName="/home/runner/work/neeto-ui-rn/neeto-ui-rn/src/components/Button.js";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var BUTTON_VARIANTS=Object.freeze({SOLID:"solid",TEXT:"text",DANGER:"danger",DANGER_INVERSE:"danger-inverse",DANGER_TEXT:"danger-text"});exports.BUTTON_VARIANTS=BUTTON_VARIANTS;var Button=function Button(props){var variant=props.variant,label=props.label,labelStyle=props.labelStyle,RightIcon=props.RightIcon,LeftIcon=props.LeftIcon,disabled=props.disabled,isLoading=props.isLoading,loadingText=props.loadingText,fontFamily=props.fontFamily,color=props.color,fontSize=props.fontSize,rest=(0,_objectWithoutProperties2.default)(props,_excluded);var theme=(0,_react.useContext)(_native.ThemeContext);var width=variant==="text"||variant==="danger-text"?null:"100%";var getButtonColors=function getButtonColors(){switch(variant){case BUTTON_VARIANTS.SOLID:return{bg:theme.colors.background[disabled?"grey400":"base"],border:theme.colors.background[disabled?"grey400":"base"],color:theme.colors.background.white,ripple:"white"};case BUTTON_VARIANTS.TEXT:return{bg:"transparent",border:"transparent",color:theme.colors.font.primary,ripple:theme.colors.background.grey800};case BUTTON_VARIANTS.DANGER:return{bg:theme.colors.background.danger,border:theme.colors.background.danger,color:theme.colors.background.white,ripple:"white"};case BUTTON_VARIANTS.DANGER_INVERSE:return{bg:theme.colors.background.white,border:theme.colors.background.danger,color:theme.colors.background.danger,ripple:theme.colors.background.grey800};case BUTTON_VARIANTS.DANGER_TEXT:return{bg:"transparent",border:"transparent",color:theme.colors.background.danger,ripple:theme.colors.background.grey800};default:return{bg:theme.colors.background[disabled?"grey400":"base"],border:theme.colors.background[disabled?"grey400":"base"],color:theme.colors.background.white,ripple:"white"};}};var renderOpacity=function renderOpacity(){if(["danger","danger-inverse","danger-text"].includes(variant)&&disabled)return 0.5;return 1;};return _react.default.createElement(_.Touchable,(0,_extends2.default)({rippleColor:getButtonColors().ripple,disabled:disabled||isLoading,bg:getButtonColors().bg,height:48,width:width,borderRadius:8,flexDirection:"row",alignItems:"center",justifyContent:"center",borderColor:getButtonColors().border,borderWidth:1,opacity:renderOpacity()},rest,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:145,columnNumber:5}}),isLoading?_react.default.createElement(_.Container,{flexDirection:"row",__self:_this,__source:{fileName:_jsxFileName,lineNumber:161,columnNumber:9}},_react.default.createElement(_reactNative.ActivityIndicator,{color:getButtonColors().color,__self:_this,__source:{fileName:_jsxFileName,lineNumber:162,columnNumber:11}}),!!loadingText&&_react.default.createElement(_.Typography,(0,_extends2.default)({textAlign:"center",mx:2,color:color||getButtonColors().color,fontSize:fontSize,fontFamily:fontFamily||theme.fonts.sf500},labelStyle,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:164,columnNumber:13}}),loadingText)):_react.default.createElement(_react.default.Fragment,null,LeftIcon&&_react.default.createElement(LeftIcon,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:178,columnNumber:24}}),_react.default.createElement(_.Typography,(0,_extends2.default)({textAlign:"center",mx:2,color:color||getButtonColors().color,fontSize:fontSize,fontFamily:fontFamily||theme.fonts.sf500},labelStyle,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:179,columnNumber:11}}),label),RightIcon&&_react.default.createElement(RightIcon,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:189,columnNumber:25}})));};exports.Button=Button;Button.defaultProps={variant:"solid",isLoading:false,loadingText:"",fontSize:"m"};Button.propTypes=(0,_extends2.default)({},_propTypes.default.buttonStyle,_propTypes.default.flexbox,_propTypes.default.space,_propTypes.default.border,_propTypes.default.layout,_propTypes.default.color,{label:_propTypes2.default.string.isRequired,variant:_propTypes2.default.oneOf(Object.values(BUTTON_VARIANTS)),disabled:_propTypes2.default.bool,labelStyle:_propTypes2.default.object,RightIcon:_propTypes2.default.elementType,LeftIcon:_propTypes2.default.elementType,isLoading:_propTypes2.default.bool,loadingText:_propTypes2.default.string});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neetoui-rn",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.186",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"author": "BigBinary",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"lib",
|
|
33
33
|
"src",
|
|
34
34
|
"react-native.config.js",
|
|
35
|
+
"index.d.ts",
|
|
35
36
|
"assets"
|
|
36
37
|
],
|
|
37
38
|
"lint-staged": {
|
package/src/components/Button.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @bigbinary/neeto/no-dangling-constants */
|
|
1
2
|
import React, { useContext } from "react";
|
|
2
3
|
import propTypes from "@styled-system/prop-types";
|
|
3
4
|
import PropTypes from "prop-types";
|
|
@@ -6,6 +7,14 @@ import { ActivityIndicator } from "react-native";
|
|
|
6
7
|
|
|
7
8
|
import { Typography, Touchable, Container } from "@components";
|
|
8
9
|
|
|
10
|
+
export const BUTTON_VARIANTS = Object.freeze({
|
|
11
|
+
SOLID: "solid",
|
|
12
|
+
TEXT: "text",
|
|
13
|
+
DANGER: "danger",
|
|
14
|
+
DANGER_INVERSE: "danger-inverse",
|
|
15
|
+
DANGER_TEXT: "danger-text",
|
|
16
|
+
});
|
|
17
|
+
|
|
9
18
|
/**
|
|
10
19
|
*
|
|
11
20
|
* Buttons are touchable elements used to interact with the screen and to trigger an action.
|
|
@@ -78,35 +87,35 @@ export const Button = props => {
|
|
|
78
87
|
|
|
79
88
|
const getButtonColors = () => {
|
|
80
89
|
switch (variant) {
|
|
81
|
-
case
|
|
90
|
+
case BUTTON_VARIANTS.SOLID:
|
|
82
91
|
return {
|
|
83
92
|
bg: theme.colors.background[disabled ? "grey400" : "base"],
|
|
84
93
|
border: theme.colors.background[disabled ? "grey400" : "base"],
|
|
85
94
|
color: theme.colors.background.white,
|
|
86
95
|
ripple: "white",
|
|
87
96
|
};
|
|
88
|
-
case
|
|
97
|
+
case BUTTON_VARIANTS.TEXT:
|
|
89
98
|
return {
|
|
90
99
|
bg: "transparent",
|
|
91
100
|
border: "transparent",
|
|
92
101
|
color: theme.colors.font.primary,
|
|
93
102
|
ripple: theme.colors.background.grey800,
|
|
94
103
|
};
|
|
95
|
-
case
|
|
104
|
+
case BUTTON_VARIANTS.DANGER:
|
|
96
105
|
return {
|
|
97
106
|
bg: theme.colors.background.danger,
|
|
98
107
|
border: theme.colors.background.danger,
|
|
99
108
|
color: theme.colors.background.white,
|
|
100
109
|
ripple: "white",
|
|
101
110
|
};
|
|
102
|
-
case
|
|
111
|
+
case BUTTON_VARIANTS.DANGER_INVERSE:
|
|
103
112
|
return {
|
|
104
113
|
bg: theme.colors.background.white,
|
|
105
114
|
border: theme.colors.background.danger,
|
|
106
115
|
color: theme.colors.background.danger,
|
|
107
116
|
ripple: theme.colors.background.grey800,
|
|
108
117
|
};
|
|
109
|
-
case
|
|
118
|
+
case BUTTON_VARIANTS.DANGER_TEXT:
|
|
110
119
|
return {
|
|
111
120
|
bg: "transparent",
|
|
112
121
|
border: "transparent",
|
|
@@ -210,13 +219,7 @@ Button.propTypes = {
|
|
|
210
219
|
* <li>solid - button with a background color.</li>
|
|
211
220
|
* </ul>
|
|
212
221
|
*/
|
|
213
|
-
variant: PropTypes.oneOf(
|
|
214
|
-
"text",
|
|
215
|
-
"solid",
|
|
216
|
-
"danger",
|
|
217
|
-
"danger-inverse",
|
|
218
|
-
"danger-text",
|
|
219
|
-
]),
|
|
222
|
+
variant: PropTypes.oneOf(Object.values(BUTTON_VARIANTS)),
|
|
220
223
|
/**
|
|
221
224
|
* Enable or Disable the button.
|
|
222
225
|
*/
|
package/src/components/FAB.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @bigbinary/neeto/no-dangling-constants */
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import propTypes from "@styled-system/prop-types";
|
|
3
4
|
import PropTypes from "prop-types";
|
|
@@ -43,7 +44,6 @@ import { theme } from "@theme";
|
|
|
43
44
|
* @extends StyledSystems props /styled-system
|
|
44
45
|
*/
|
|
45
46
|
|
|
46
|
-
// eslint-disable-next-line neeto/no-dangling-constants
|
|
47
47
|
export const FAB = ({ Icon, bg, disabled, variant, onPress, ...rest }) => {
|
|
48
48
|
const shadowStyle = {
|
|
49
49
|
shadowColor: theme.colors.background.grey800,
|