@bigbinary/neetoui-rn 0.0.184 → 0.0.187
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 +450 -0
- package/lib/components/BottomTabBar.js +1 -1
- package/lib/components/Button.js +1 -1
- package/lib/components/Input.js +1 -1
- package/lib/components/SearchBar.js +1 -1
- package/package.json +2 -1
- package/src/components/BottomTabBar.js +25 -23
- package/src/components/Button.js +15 -12
- package/src/components/FAB.js +1 -1
- package/src/components/Input.js +31 -24
- package/src/components/SearchBar.js +25 -32
package/index.d.ts
ADDED
|
@@ -0,0 +1,450 @@
|
|
|
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
|
+
showInputAccessoryView?: boolean;
|
|
270
|
+
inputProps?: RNTextInputProps;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
interface ListItemProps extends ViewProps {
|
|
274
|
+
LeftComponent?: React.FC;
|
|
275
|
+
label: string;
|
|
276
|
+
RightComponent: React.FC;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
interface MultiSelectProps extends ViewProps {
|
|
280
|
+
options?: Array<any>;
|
|
281
|
+
label?: string;
|
|
282
|
+
value?: string | Array<any>;
|
|
283
|
+
placeholder?: string;
|
|
284
|
+
labelExtractor?: (item: any, index: number) => string;
|
|
285
|
+
valueExtractor?: (item: any, index: number) => string;
|
|
286
|
+
onSelect?: (selectedData: Array<any>) => void;
|
|
287
|
+
deletedValue?: (deletedOption: any) => void;
|
|
288
|
+
isLoading?: boolean;
|
|
289
|
+
isSearchable?: boolean;
|
|
290
|
+
showCreateOption?: boolean;
|
|
291
|
+
labelStyle?: TextProps;
|
|
292
|
+
containerStyle?: ViewProps;
|
|
293
|
+
inputContainerStyle?: ViewProps;
|
|
294
|
+
dropdownContainerStyle?: ViewProps;
|
|
295
|
+
itemContainerStyle?: ViewProps;
|
|
296
|
+
multiSelectedItemContainerStyle?: ViewProps;
|
|
297
|
+
multiSelectedItemLabelStyle?: TextProps;
|
|
298
|
+
selectedValue?: (selectedOption: any) => void;
|
|
299
|
+
CreateItemComponent?: React.FC;
|
|
300
|
+
showCreateOptionLoader?: boolean;
|
|
301
|
+
createSearchedOptionLabelStyle?: TextProps;
|
|
302
|
+
onPressCreateOption?: (searchText: string) => void;
|
|
303
|
+
createSearchedOptionContainerStyle?: ViewProps;
|
|
304
|
+
onDonePress?: () => void;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
type OnBoardingProps = {
|
|
308
|
+
appLogo: React.FC;
|
|
309
|
+
slides: Array<any>;
|
|
310
|
+
onComplete: () => void;
|
|
311
|
+
logoWidth?: number;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
type OtpInputsProps = {
|
|
315
|
+
handleChange: (value: string) => void;
|
|
316
|
+
numberOfInputs: number;
|
|
317
|
+
error?: boolean;
|
|
318
|
+
code: string;
|
|
319
|
+
containerStyles?: ViewProps;
|
|
320
|
+
textStyles?: TextProps;
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
interface ParentViewProps extends ViewProps {
|
|
324
|
+
barStyle?: "light-content" | "dark-content";
|
|
325
|
+
topInset?: boolean;
|
|
326
|
+
rightInset?: boolean;
|
|
327
|
+
leftInset?: boolean;
|
|
328
|
+
bottomInset?: boolean;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
type RNPopoverProps = typeof RNPopover.propTypes;
|
|
332
|
+
interface PopoverProps extends RNPopoverProps {
|
|
333
|
+
children?: React.ReactNode;
|
|
334
|
+
data?: Array<any>;
|
|
335
|
+
fontFamily?: typeof theme.fonts;
|
|
336
|
+
fontSize?: typeof theme.fontSizes;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
interface RadioButtonProps extends TouchableProps {
|
|
340
|
+
selected: boolean;
|
|
341
|
+
onSelect: () => void;
|
|
342
|
+
disabled?: boolean;
|
|
343
|
+
label?: string;
|
|
344
|
+
radioButtonStyle?: ViewProps;
|
|
345
|
+
labelStyle?: TextProps;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
type RichTextEditorProps = {
|
|
349
|
+
onChange: (val: string) => void;
|
|
350
|
+
placeholderText?: string;
|
|
351
|
+
children?: React.ReactNode;
|
|
352
|
+
toolbarActions: Array<string>;
|
|
353
|
+
editorProps?: RichEditorProps;
|
|
354
|
+
toolBarProps?: RichToolbarProps;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
interface SearchBarProps extends ViewProps {
|
|
358
|
+
placeholder?: string;
|
|
359
|
+
onChangeText: (val: string) => void;
|
|
360
|
+
onCancel?: () => void;
|
|
361
|
+
debounceDelay?: number | string;
|
|
362
|
+
showCancelButton?: boolean;
|
|
363
|
+
containerProps?: ViewProps;
|
|
364
|
+
searchbarProps?: TextInputProps;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
interface SegmentedTopBarProps extends MaterialTopTabBarProps {
|
|
368
|
+
inactiveSegmentStyle?: ViewStyle;
|
|
369
|
+
activeSegmentStyle?: ViewStyle;
|
|
370
|
+
activeTextStyle?: TouchableProps;
|
|
371
|
+
inactiveTextStyle?: TouchableProps;
|
|
372
|
+
height?: number;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
interface SelectProps
|
|
376
|
+
extends Omit<MultiSelectProps, "value" | "selectedValue" | "deletedValue"> {
|
|
377
|
+
value: any;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
interface SocialButtonProps extends TouchableProps {
|
|
381
|
+
variant: "apple" | "google";
|
|
382
|
+
disabled?: boolean;
|
|
383
|
+
labelStyle?: TextProps;
|
|
384
|
+
isLoading?: boolean;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
interface ToastProps extends Omit<RNToastProps, "config" | "position"> {
|
|
388
|
+
toasterConfig: ToastConfig;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
type ToggleSwitchProps = {
|
|
392
|
+
value: boolean;
|
|
393
|
+
onValueChange?: () => void;
|
|
394
|
+
disabled?: boolean;
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
type TopBarProps = {
|
|
398
|
+
data: Array<any>;
|
|
399
|
+
activeIndex?: number;
|
|
400
|
+
onActiveTabChange: () => void;
|
|
401
|
+
activeTabTextStyle?: TextStyle;
|
|
402
|
+
activeTabContainerStyle?: ViewStyle;
|
|
403
|
+
inActiveTabTextStyle?: TextStyle;
|
|
404
|
+
inActiveTabContainerStyle?: ViewStyle;
|
|
405
|
+
tabContainerStyle?: ViewStyle;
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
export const Accordion: React.FC<AccordionProps>;
|
|
409
|
+
export const Alert: React.FC<AlertProps> & {
|
|
410
|
+
show?: (params: AlertShowParams) => void;
|
|
411
|
+
};
|
|
412
|
+
export const AnimatedImage: React.FC<AnimatedImageProps>;
|
|
413
|
+
export const Avatar: React.FC<AvatarProps>;
|
|
414
|
+
export const Badge: React.FC<BadgeProps>;
|
|
415
|
+
export const BottomSheet: React.FC<BottomSheetProps>;
|
|
416
|
+
export const BottomTabBar: React.FC<BottomTabBarProps>;
|
|
417
|
+
export const Button: React.FC<ButtonProps>;
|
|
418
|
+
export const ButtonGroup: React.FC<ButtonGroupProps>;
|
|
419
|
+
export const Calendar: React.FC<CalendarProps>;
|
|
420
|
+
export const Card: React.FC<CardProps>;
|
|
421
|
+
export const Carousel: React.FC<CarouselProps>;
|
|
422
|
+
export const CheckBox: React.FC<CheckBoxProps>;
|
|
423
|
+
export const Chip: React.FC<ChipProps>;
|
|
424
|
+
export const Container: React.FC<ViewProps>;
|
|
425
|
+
export const Divider: React.FC<DividerProps>;
|
|
426
|
+
export const Fab: React.FC<FabProps>;
|
|
427
|
+
export const FlashList: React.FC<FlashListProps>;
|
|
428
|
+
export const FlatList: React.FC<FlatListProps>;
|
|
429
|
+
export const Input: React.FC<InputProps>;
|
|
430
|
+
export const ListItem: React.FC<ListItemProps>;
|
|
431
|
+
export const MultiSelect: React.FC<MultiSelectProps>;
|
|
432
|
+
export const OnBoarding: React.FC<OnBoardingProps>;
|
|
433
|
+
export const OtpInputs: React.FC<OtpInputsProps>;
|
|
434
|
+
export const ParentView: React.FC<ParentViewProps>;
|
|
435
|
+
export const Popover: React.FC<PopoverProps>;
|
|
436
|
+
export const RadioButton: React.FC<RadioButtonProps>;
|
|
437
|
+
export const RichTextEditor: React.FC<RichTextEditorProps>;
|
|
438
|
+
export const ScrollView: React.FC<ScrollViewProps>;
|
|
439
|
+
export const SearchBar: React.FC<SearchBarProps>;
|
|
440
|
+
export const SegmentedTopBar: React.FC<SegmentedTopBarProps>;
|
|
441
|
+
export const Select: React.FC<SelectProps>;
|
|
442
|
+
export const SocialButton: React.FC<SocialButtonProps>;
|
|
443
|
+
export const Toast: React.FC<ToastProps> & {
|
|
444
|
+
show?: (params: ToastShowParams) => void;
|
|
445
|
+
hide?: (params: ToastHideParams) => void;
|
|
446
|
+
};
|
|
447
|
+
export const ToggleSwitch: React.FC<ToggleSwitchProps>;
|
|
448
|
+
export const TopBar: React.FC<TopBarProps>;
|
|
449
|
+
export const Touchable: React.FC<TouchableProps>;
|
|
450
|
+
export const Typography: React.FC<TextProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.BottomTabBar=void 0;var _react=_interopRequireWildcard(require("react"));var _reactNativeRemixIcon=_interopRequireDefault(require("react-native-remix-icon"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNative=require("react-native");var _reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated"));var _=require("./");var _native=require("styled-components/native");var _jsxFileName="/home/runner/work/neeto-ui-rn/neeto-ui-rn/src/components/BottomTabBar.js",_this=this;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;}function TabElement(_ref){var isFocused=_ref.isFocused,onPress=_ref.onPress,name=_ref.name,tabBarActiveTintColor=_ref.tabBarActiveTintColor,tabBarInactiveTintColor=_ref.tabBarInactiveTintColor,icon=_ref.icon,size=_ref.size;var theme=(0,_react.useContext)(_native.ThemeContext);var offset=(0,_reactNativeReanimated.useSharedValue)(isFocused?1:0);(0,_react.useEffect)(function(){if(isFocused){offset.value=(0,_reactNativeReanimated.withTiming)(1,{duration:500});}else{offset.value=(0,_reactNativeReanimated.withTiming)(0,{duration:0});}},[isFocused]);var animatedStyles=(0,_reactNativeReanimated.useAnimatedStyle)(function(){var _f=function _f(){return{opacity:(0,_reactNativeReanimated.interpolate)(offset.value,[0,1],[1,0],{extrapolateRight:_reactNativeReanimated.Extrapolation.CLAMP})};};_f._closure={interpolate:_reactNativeReanimated.interpolate,offset:offset,Extrapolation:{CLAMP:_reactNativeReanimated.Extrapolation.CLAMP}};_f.asString="function _f(){const{interpolate,offset,Extrapolation}=jsThis._closure;{return{opacity:interpolate(offset.value,[0,1],[1,0],{extrapolateRight:Extrapolation.CLAMP})};}}";_f.__workletHash=10271988492931;_f.__location="/home/runner/work/neeto-ui-rn/neeto-ui-rn/src/components/BottomTabBar.js (
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.BottomTabBar=void 0;var _react=_interopRequireWildcard(require("react"));var _reactNativeRemixIcon=_interopRequireDefault(require("react-native-remix-icon"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNative=require("react-native");var _reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated"));var _=require("./");var _native=require("styled-components/native");var _jsxFileName="/home/runner/work/neeto-ui-rn/neeto-ui-rn/src/components/BottomTabBar.js",_this=this;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;}function TabElement(_ref){var isFocused=_ref.isFocused,onPress=_ref.onPress,name=_ref.name,tabBarActiveTintColor=_ref.tabBarActiveTintColor,tabBarInactiveTintColor=_ref.tabBarInactiveTintColor,icon=_ref.icon,size=_ref.size;var theme=(0,_react.useContext)(_native.ThemeContext);var offset=(0,_reactNativeReanimated.useSharedValue)(isFocused?1:0);(0,_react.useEffect)(function(){if(isFocused){offset.value=(0,_reactNativeReanimated.withTiming)(1,{duration:500});}else{offset.value=(0,_reactNativeReanimated.withTiming)(0,{duration:0});}},[isFocused]);var animatedStyles=(0,_reactNativeReanimated.useAnimatedStyle)(function(){var _f=function _f(){return{opacity:(0,_reactNativeReanimated.interpolate)(offset.value,[0,1],[1,0],{extrapolateRight:_reactNativeReanimated.Extrapolation.CLAMP})};};_f._closure={interpolate:_reactNativeReanimated.interpolate,offset:offset,Extrapolation:{CLAMP:_reactNativeReanimated.Extrapolation.CLAMP}};_f.asString="function _f(){const{interpolate,offset,Extrapolation}=jsThis._closure;{return{opacity:interpolate(offset.value,[0,1],[1,0],{extrapolateRight:Extrapolation.CLAMP})};}}";_f.__workletHash=10271988492931;_f.__location="/home/runner/work/neeto-ui-rn/neeto-ui-rn/src/components/BottomTabBar.js (93:42)";_f.__optimalization=3;return _f;}());var animatedStyles2=(0,_reactNativeReanimated.useAnimatedStyle)(function(){var _f=function _f(){return{opacity:(0,_reactNativeReanimated.interpolate)(offset.value,[0,0.9,1],[0,0.5,1],{extrapolateRight:_reactNativeReanimated.Extrapolation.CLAMP}),transform:[{scale:(0,_reactNativeReanimated.interpolate)(offset.value,[0,0.8,1],[1,1.2,1],{extrapolateRight:_reactNativeReanimated.Extrapolation.CLAMP})}]};};_f._closure={interpolate:_reactNativeReanimated.interpolate,offset:offset,Extrapolation:{CLAMP:_reactNativeReanimated.Extrapolation.CLAMP}};_f.asString="function _f(){const{interpolate,offset,Extrapolation}=jsThis._closure;{return{opacity:interpolate(offset.value,[0,0.9,1],[0,0.5,1],{extrapolateRight:Extrapolation.CLAMP}),transform:[{scale:interpolate(offset.value,[0,0.8,1],[1,1.2,1],{extrapolateRight:Extrapolation.CLAMP})}]};}}";_f.__workletHash=9420491443699;_f.__location="/home/runner/work/neeto-ui-rn/neeto-ui-rn/src/components/BottomTabBar.js (101:43)";_f.__optimalization=3;return _f;}());return _react.default.createElement(_reactNative.TouchableWithoutFeedback,{onPress:onPress,__self:this,__source:{fileName:_jsxFileName,lineNumber:117,columnNumber:5}},_react.default.createElement(_.Container,{flex:1,alignItems:"center",borderTopWidth:1,borderColor:"background.grey200",__self:this,__source:{fileName:_jsxFileName,lineNumber:118,columnNumber:7}},_react.default.createElement(_.Container,{height:35,width:48,alignItems:"center",mb:1,__self:this,__source:{fileName:_jsxFileName,lineNumber:124,columnNumber:9}},_react.default.createElement(_reactNativeReanimated.default.View,{style:[styles.iconContainer,animatedStyles],__self:this,__source:{fileName:_jsxFileName,lineNumber:125,columnNumber:11}},_react.default.createElement(_reactNativeRemixIcon.default,{size:size,color:theme.colors.font.grey500,name:icon,__self:this,__source:{fileName:_jsxFileName,lineNumber:126,columnNumber:13}})),_react.default.createElement(_reactNativeReanimated.default.View,{style:[styles.iconContainer,animatedStyles2],__self:this,__source:{fileName:_jsxFileName,lineNumber:128,columnNumber:11}},_react.default.createElement(_reactNativeRemixIcon.default,{size:size,color:theme.colors.font.base,name:icon,__self:this,__source:{fileName:_jsxFileName,lineNumber:129,columnNumber:13}}))),_react.default.createElement(_.Typography,{color:isFocused?tabBarActiveTintColor:tabBarInactiveTintColor,fontFamily:"sf500",fontSize:"4xs",__self:this,__source:{fileName:_jsxFileName,lineNumber:132,columnNumber:9}},name)));}var styles=_reactNative.StyleSheet.create({iconContainer:{position:"absolute",margin:10}});var BottomTabBar=function BottomTabBar(_ref2){var state=_ref2.state,descriptors=_ref2.descriptors,navigation=_ref2.navigation;return _react.default.createElement(_.Container,{flexDirection:"row",height:_reactNative.Platform.OS==="android"?63:83,bg:"background.white",__self:_this,__source:{fileName:_jsxFileName,lineNumber:153,columnNumber:5}},state.routes.map(function(_ref3,index){var key=_ref3.key,name=_ref3.name;var options=descriptors[key].options;var isFocused=state.index===index;var _options$customTabBar=options==null?void 0:options.customTabBarProps,icon=_options$customTabBar.icon,size=_options$customTabBar.size;var tabBarActiveTintColor=options.tabBarActiveTintColor,tabBarInactiveTintColor=options.tabBarInactiveTintColor;var onPress=function onPress(){var event=navigation.emit({type:"tabPress",target:key,canPreventDefault:true});if(!isFocused&&!event.defaultPrevented){navigation.navigate({name:name,merge:true});}};return _react.default.createElement(TabElement,{key:index,onPress:onPress,isFocused:isFocused,name:name,tabBarActiveTintColor:tabBarActiveTintColor,tabBarInactiveTintColor:tabBarInactiveTintColor,icon:icon,size:size,__self:_this,__source:{fileName:_jsxFileName,lineNumber:176,columnNumber:11}});}));};exports.BottomTabBar=BottomTabBar;TabElement.propTypes={isFocused:_propTypes.default.bool,onPress:_propTypes.default.func,name:_propTypes.default.string,tabBarActiveTintColor:_propTypes.default.string,tabBarInactiveTintColor:_propTypes.default.string,icon:_propTypes.default.string,size:_propTypes.default.number};BottomTabBar.propTypes={state:_propTypes.default.object,descriptors:_propTypes.default.object,navigation:_propTypes.default.object};
|
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/lib/components/Input.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.styles=exports.Input=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _taggedTemplateLiteralLoose2=_interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteralLoose"));var _react=_interopRequireWildcard(require("react"));var _styledSystem=require("styled-system");var _reactNative=require("react-native");var _native=_interopRequireWildcard(require("styled-components/native"));var _propTypes=_interopRequireDefault(require("prop-types"));var _=require("./");var _theme=require("../../src/theme");var _excluded=["label","value","onChangeText","onBlur","errorMessage","PrefixIcon","SuffixIcon","autoFocus","disabled","noBorder","textAlignVertical"];var _templateObject,_templateObject2,_templateObject3,_this=this,_jsxFileName="/home/runner/work/neeto-ui-rn/neeto-ui-rn/src/components/Input.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 TextInput=_native.default.TextInput(_templateObject||(_templateObject=(0,_taggedTemplateLiteralLoose2.default)(["\n ","\n ","\n ","\n ","\n ","\n ","\n"])),_styledSystem.flexbox,_styledSystem.space,_styledSystem.border,_styledSystem.buttonStyle,_styledSystem.typography,_styledSystem.color);var View=_native.default.View(_templateObject2||(_templateObject2=(0,_taggedTemplateLiteralLoose2.default)(["\n ","\n ","\n ","\n ","\n ","\n"])),_styledSystem.flexbox,_styledSystem.space,_styledSystem.border,_styledSystem.color,_styledSystem.layout);var Typography=_native.default.Text(_templateObject3||(_templateObject3=(0,_taggedTemplateLiteralLoose2.default)(["\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n"])),_styledSystem.textStyle,_styledSystem.space,_styledSystem.layout,_styledSystem.flexbox,_styledSystem.typography,_styledSystem.color,_styledSystem.position,(0,_styledSystem.system)({textDecoration:{property:"textDecoration",cssProperty:"textDecoration"},textTransform:{property:"textTransform",cssProperty:"textTransform"}}));var AnimatedLabel=_reactNative.Animated.createAnimatedComponent(Typography);var Input=function Input(props){var _rest$inputProps,_rest$inputProps2,_rest$inputProps3;var label=props.label,_props$value=props.value,value=_props$value===void 0?"":_props$value,_props$onChangeText=props.onChangeText,onChangeText=_props$onChangeText===void 0?function(){}:_props$onChangeText,_props$onBlur=props.onBlur,_onBlur=_props$onBlur===void 0?function(){}:_props$onBlur,_props$errorMessage=props.errorMessage,errorMessage=_props$errorMessage===void 0?null:_props$errorMessage,PrefixIcon=props.PrefixIcon,SuffixIcon=props.SuffixIcon,_props$autoFocus=props.autoFocus,autoFocus=_props$autoFocus===void 0?false:_props$autoFocus,_props$disabled=props.disabled,disabled=_props$disabled===void 0?false:_props$disabled,_props$noBorder=props.noBorder,noBorder=_props$noBorder===void 0?false:_props$noBorder,_props$textAlignVerti=props.textAlignVertical,textAlignVertical=_props$textAlignVerti===void 0?"top":_props$textAlignVerti,rest=(0,_objectWithoutProperties2.default)(props,_excluded);var _useWindowDimensions=(0,_reactNative.useWindowDimensions)(),width=_useWindowDimensions.width;var colors=(0,_react.useContext)(_native.ThemeContext).colors;var inputRef=(0,_react.useRef)();var containerRef=(0,_react.useRef)();var animatedController=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;(0,_react.useEffect)(function(){if(autoFocus){handleLabelAnimation(true);}else{handleLabelAnimation(false);}},[autoFocus]);(0,_react.useEffect)(function(){if(value){if(Math.floor(animatedController._value)===0){handleLabelAnimation(true);}}else{handleLabelAnimation(false);}},[value]);var handleLabelAnimation=function handleLabelAnimation(isFocused){_reactNative.Animated.timing(animatedController,{toValue:!!isFocused||!!value?1:0,duration:300,useNativeDriver:false}).start();!!label&&inputRef.current&&inputRef.current.setNativeProps({style:{top:isFocused?10:0}});};var handleStyles=(0,_react.useCallback)(function(isFocused){containerRef.current&&containerRef.current.setNativeProps({borderColor:errorMessage?colors.border.danger:isFocused?colors.border.purple500:colors.border.grey400,borderWidth:errorMessage||isFocused?1.5:1});},[]);var labelStyles={fontSize:animatedController.interpolate({inputRange:[0,1],outputRange:[17,13]}),top:animatedController.interpolate({inputRange:[0,1],outputRange:[14,6]})};var handleFocusBlur=function handleFocusBlur(isFocused){if(label){if(!value)handleLabelAnimation(isFocused);if(!noBorder)handleStyles(isFocused);}};return _react.default.createElement(View,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.styles=exports.Input=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _taggedTemplateLiteralLoose2=_interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteralLoose"));var _react=_interopRequireWildcard(require("react"));var _styledSystem=require("styled-system");var _reactNative=require("react-native");var _native=_interopRequireWildcard(require("styled-components/native"));var _propTypes=_interopRequireDefault(require("prop-types"));var _=require("./");var _theme=require("../../src/theme");var _excluded=["label","value","onChangeText","onBlur","errorMessage","PrefixIcon","SuffixIcon","autoFocus","disabled","noBorder","showInputAccessoryView","textAlignVertical"];var _templateObject,_templateObject2,_templateObject3,_this=this,_jsxFileName="/home/runner/work/neeto-ui-rn/neeto-ui-rn/src/components/Input.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 TextInput=_native.default.TextInput(_templateObject||(_templateObject=(0,_taggedTemplateLiteralLoose2.default)(["\n ","\n ","\n ","\n ","\n ","\n ","\n"])),_styledSystem.flexbox,_styledSystem.space,_styledSystem.border,_styledSystem.buttonStyle,_styledSystem.typography,_styledSystem.color);var View=_native.default.View(_templateObject2||(_templateObject2=(0,_taggedTemplateLiteralLoose2.default)(["\n ","\n ","\n ","\n ","\n ","\n"])),_styledSystem.flexbox,_styledSystem.space,_styledSystem.border,_styledSystem.color,_styledSystem.layout);var Typography=_native.default.Text(_templateObject3||(_templateObject3=(0,_taggedTemplateLiteralLoose2.default)(["\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n"])),_styledSystem.textStyle,_styledSystem.space,_styledSystem.layout,_styledSystem.flexbox,_styledSystem.typography,_styledSystem.color,_styledSystem.position,(0,_styledSystem.system)({textDecoration:{property:"textDecoration",cssProperty:"textDecoration"},textTransform:{property:"textTransform",cssProperty:"textTransform"}}));var AnimatedLabel=_reactNative.Animated.createAnimatedComponent(Typography);var Input=function Input(props){var _rest$inputProps,_rest$inputProps2,_rest$inputProps3;var label=props.label,_props$value=props.value,value=_props$value===void 0?"":_props$value,_props$onChangeText=props.onChangeText,onChangeText=_props$onChangeText===void 0?function(){}:_props$onChangeText,_props$onBlur=props.onBlur,_onBlur=_props$onBlur===void 0?function(){}:_props$onBlur,_props$errorMessage=props.errorMessage,errorMessage=_props$errorMessage===void 0?null:_props$errorMessage,PrefixIcon=props.PrefixIcon,SuffixIcon=props.SuffixIcon,_props$autoFocus=props.autoFocus,autoFocus=_props$autoFocus===void 0?false:_props$autoFocus,_props$disabled=props.disabled,disabled=_props$disabled===void 0?false:_props$disabled,_props$noBorder=props.noBorder,noBorder=_props$noBorder===void 0?false:_props$noBorder,_props$showInputAcces=props.showInputAccessoryView,showInputAccessoryView=_props$showInputAcces===void 0?true:_props$showInputAcces,_props$textAlignVerti=props.textAlignVertical,textAlignVertical=_props$textAlignVerti===void 0?"top":_props$textAlignVerti,rest=(0,_objectWithoutProperties2.default)(props,_excluded);var _useWindowDimensions=(0,_reactNative.useWindowDimensions)(),width=_useWindowDimensions.width;var colors=(0,_react.useContext)(_native.ThemeContext).colors;var inputRef=(0,_react.useRef)();var containerRef=(0,_react.useRef)();var animatedController=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;(0,_react.useEffect)(function(){if(autoFocus){handleLabelAnimation(true);}else{handleLabelAnimation(false);}},[autoFocus]);(0,_react.useEffect)(function(){if(value){if(Math.floor(animatedController._value)===0){handleLabelAnimation(true);}}else{handleLabelAnimation(false);}},[value]);var handleLabelAnimation=function handleLabelAnimation(isFocused){_reactNative.Animated.timing(animatedController,{toValue:!!isFocused||!!value?1:0,duration:300,useNativeDriver:false}).start();!!label&&inputRef.current&&inputRef.current.setNativeProps({style:{top:isFocused?10:0}});};var handleStyles=(0,_react.useCallback)(function(isFocused){containerRef.current&&containerRef.current.setNativeProps({borderColor:errorMessage?colors.border.danger:isFocused?colors.border.purple500:colors.border.grey400,borderWidth:errorMessage||isFocused?1.5:1});},[]);var labelStyles={fontSize:animatedController.interpolate({inputRange:[0,1],outputRange:[17,13]}),top:animatedController.interpolate({inputRange:[0,1],outputRange:[14,6]})};var handleFocusBlur=function handleFocusBlur(isFocused){if(label){if(!value)handleLabelAnimation(isFocused);if(!noBorder)handleStyles(isFocused);}};return _react.default.createElement(View,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:183,columnNumber:5}},_react.default.createElement(View,(0,_extends2.default)({ref:containerRef,borderRadius:8,borderWidth:noBorder?0:1,borderColor:errorMessage?"border.danger":"border.grey400",alignItems:"center",flexDirection:"row",justifyContent:"space-between"},!((_rest$inputProps=rest.inputProps)!=null&&_rest$inputProps.multiline)&&{height:58},{overflow:"hidden"},rest.containerProps,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:184,columnNumber:7}}),!!PrefixIcon&&_react.default.createElement(View,{pl:2,__self:_this,__source:{fileName:_jsxFileName,lineNumber:197,columnNumber:11}},_react.default.createElement(PrefixIcon,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:198,columnNumber:13}})),_react.default.createElement(View,{flex:1,left:10,__self:_this,__source:{fileName:_jsxFileName,lineNumber:201,columnNumber:9}},!!label&&_react.default.createElement(AnimatedLabel,{color:disabled?"font.grey400":"font.grey600",position:"absolute",zIndex:1,style:labelStyles,__self:_this,__source:{fileName:_jsxFileName,lineNumber:203,columnNumber:13}},label),_react.default.createElement(TextInput,(0,_extends2.default)({ref:inputRef,value:value,returnKeyType:(_rest$inputProps2=rest.inputProps)!=null&&_rest$inputProps2.multiline?"default":"done",onChangeText:onChangeText,autoFocus:autoFocus,editable:!disabled,onFocus:function onFocus(){handleFocusBlur(true);},onBlur:function onBlur(){_onBlur();handleFocusBlur(false);},inputAccessoryViewID:label,color:disabled?"font.grey500":"font.primary",fontSize:17,pr:3,top:0,zIndex:2,autoCapitalize:"none",mt:10,pb:3,pt:1,textAlignVertical:textAlignVertical},rest.inputProps,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:212,columnNumber:11}})),((_rest$inputProps3=rest.inputProps)==null?void 0:_rest$inputProps3.multiline)&&showInputAccessoryView&&_reactNative.Platform.OS==="ios"&&_react.default.createElement(_reactNative.InputAccessoryView,{nativeID:label,__self:_this,__source:{fileName:_jsxFileName,lineNumber:242,columnNumber:15}},_react.default.createElement(_.Container,{bg:"background.white",flexDirection:"row",p:2,width:width,justifyContent:"flex-end",alignItems:"center",pr:20,__self:_this,__source:{fileName:_jsxFileName,lineNumber:243,columnNumber:17}},_react.default.createElement(_.Button,{height:30,left:10,labelStyle:styles.doneButtonStyle,variant:"text",onPress:function onPress(){_reactNative.Keyboard.dismiss();},label:"Done",__self:_this,__source:{fileName:_jsxFileName,lineNumber:252,columnNumber:19}})))),!!SuffixIcon&&_react.default.createElement(View,{px:2,__self:_this,__source:{fileName:_jsxFileName,lineNumber:267,columnNumber:11}},_react.default.createElement(SuffixIcon,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:268,columnNumber:13}}))),!!errorMessage&&_react.default.createElement(Typography,{py:2,color:"font.danger",__self:_this,__source:{fileName:_jsxFileName,lineNumber:273,columnNumber:9}},errorMessage));};exports.Input=Input;Input.propTypes={label:_propTypes.default.string,value:_propTypes.default.string.isRequired,onChangeText:_propTypes.default.func.isRequired,onBlur:_propTypes.default.func,errorMessage:_propTypes.default.string,disabled:_propTypes.default.bool,autoFocus:_propTypes.default.bool,PrefixIcon:_propTypes.default.elementType,SuffixIcon:_propTypes.default.elementType,noBorder:_propTypes.default.bool,containerProps:_propTypes.default.object,textAlignVertical:_propTypes.default.oneOf(["auto","top","bottom","center"]),showInputAccessoryView:_propTypes.default.bool};var styles=_reactNative.StyleSheet.create({doneButtonStyle:{fontFamily:"sf700",color:_theme.theme.colors.font.base}});exports.styles=styles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.SearchBar=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _taggedTemplateLiteralLoose2=_interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteralLoose"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _styledSystem=require("styled-system");var _native=_interopRequireDefault(require("styled-components/native"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNativeRemixIcon=_interopRequireDefault(require("react-native-remix-icon"));var _=require("./");var _hooks=require("../hooks");var _theme=require("../theme");var _excluded=["placeholder","onChangeText","onCancel","debounceDelay","showCancelButton"];var _templateObject,_this=this,_jsxFileName="/home/runner/work/neeto-ui-rn/neeto-ui-rn/src/components/SearchBar.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 TextInput=_native.default.TextInput(_templateObject||(_templateObject=(0,_taggedTemplateLiteralLoose2.default)(["\n ","\n ","\n ","\n ","\n ","\n ","\n"])),_styledSystem.flexbox,_styledSystem.space,_styledSystem.border,_styledSystem.buttonStyle,_styledSystem.typography,_styledSystem.color);var SearchBar=function SearchBar(props){var _props$placeholder=props.placeholder,placeholder=_props$placeholder===void 0?"Search":_props$placeholder,_props$onChangeText=props.onChangeText,onChangeText=_props$onChangeText===void 0?function(){}:_props$onChangeText,_props$onCancel=props.onCancel,onCancel=_props$onCancel===void 0?function(){}:_props$onCancel,_props$debounceDelay=props.debounceDelay,debounceDelay=_props$debounceDelay===void 0?1000:_props$debounceDelay,_props$showCancelButt=props.showCancelButton,showCancelButton=_props$showCancelButt===void 0?true:_props$showCancelButt,rest=(0,_objectWithoutProperties2.default)(props,_excluded);var inputRef=(0,_react.useRef)();var _useState=(0,_react.useState)(""),_useState2=(0,_slicedToArray2.default)(_useState,2),searchText=_useState2[0],setSearchText=_useState2[1];var debouncedSearchTextValue=(0,_hooks.useDebounce)(searchText,Number(debounceDelay));var
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.SearchBar=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _taggedTemplateLiteralLoose2=_interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteralLoose"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _styledSystem=require("styled-system");var _native=_interopRequireDefault(require("styled-components/native"));var _propTypes=_interopRequireDefault(require("prop-types"));var _reactNativeRemixIcon=_interopRequireDefault(require("react-native-remix-icon"));var _=require("./");var _hooks=require("../hooks");var _theme=require("../theme");var _excluded=["placeholder","onChangeText","onCancel","debounceDelay","showCancelButton"];var _templateObject,_this=this,_jsxFileName="/home/runner/work/neeto-ui-rn/neeto-ui-rn/src/components/SearchBar.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 TextInput=_native.default.TextInput(_templateObject||(_templateObject=(0,_taggedTemplateLiteralLoose2.default)(["\n ","\n ","\n ","\n ","\n ","\n ","\n"])),_styledSystem.flexbox,_styledSystem.space,_styledSystem.border,_styledSystem.buttonStyle,_styledSystem.typography,_styledSystem.color);var SearchBar=function SearchBar(props){var _props$placeholder=props.placeholder,placeholder=_props$placeholder===void 0?"Search":_props$placeholder,_props$onChangeText=props.onChangeText,onChangeText=_props$onChangeText===void 0?function(){}:_props$onChangeText,_props$onCancel=props.onCancel,onCancel=_props$onCancel===void 0?function(){}:_props$onCancel,_props$debounceDelay=props.debounceDelay,debounceDelay=_props$debounceDelay===void 0?1000:_props$debounceDelay,_props$showCancelButt=props.showCancelButton,showCancelButton=_props$showCancelButt===void 0?true:_props$showCancelButt,rest=(0,_objectWithoutProperties2.default)(props,_excluded);var inputRef=(0,_react.useRef)();var _useState=(0,_react.useState)(""),_useState2=(0,_slicedToArray2.default)(_useState,2),searchText=_useState2[0],setSearchText=_useState2[1];var debouncedSearchTextValue=(0,_hooks.useDebounce)(searchText,Number(debounceDelay));var buttonWidthController=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;var buttonOpacityController=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;(0,_react.useEffect)(function(){onChangeText(debouncedSearchTextValue);},[debouncedSearchTextValue,onChangeText]);var animateSearchInput=function animateSearchInput(val){_reactNative.Animated.sequence([_reactNative.Animated.timing(buttonOpacityController,{toValue:val,duration:350,useNativeDriver:false}),_reactNative.Animated.timing(buttonWidthController,{toValue:val,duration:200,useNativeDriver:false})]).start();};var cancelButtonWidth=buttonWidthController.interpolate({inputRange:[0,1],outputRange:[0,60]});var onCancelHandle=function onCancelHandle(){animateSearchInput(0);setSearchText("");inputRef.current.blur();onCancel();};return _react.default.createElement(_.Container,{flexDirection:"row",alignItems:"center",__self:_this,__source:{fileName:_jsxFileName,lineNumber:96,columnNumber:5}},_react.default.createElement(_.Container,(0,_extends2.default)({height:42,flex:1,borderWidth:1,borderColor:_theme.theme.colors.border.grey400,borderRadius:8,flexDirection:"row",alignItems:"center"},rest.containerProps,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:97,columnNumber:7}}),_react.default.createElement(_.Container,{px:10,__self:_this,__source:{fileName:_jsxFileName,lineNumber:107,columnNumber:9}},_react.default.createElement(_reactNativeRemixIcon.default,{name:"ri-search-line",size:20,color:_theme.theme.colors.font.grey600,__self:_this,__source:{fileName:_jsxFileName,lineNumber:108,columnNumber:11}})),_react.default.createElement(TextInput,(0,_extends2.default)({ref:inputRef,value:searchText,onChangeText:setSearchText,onFocus:function onFocus(){animateSearchInput(1);},onBlur:function onBlur(){if(!searchText)animateSearchInput(0);},placeholder:placeholder,fontSize:16,flex:1,placeholderTextColor:_theme.theme.colors.font.grey600,color:"font.primary",autoCapitalize:"none",returnKeyType:"search"},rest.searchbarProps,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:114,columnNumber:9}}))),showCancelButton&&_react.default.createElement(_reactNative.Animated.View,{style:{opacity:buttonOpacityController,width:cancelButtonWidth,alignItems:"flex-end"},__self:_this,__source:{fileName:_jsxFileName,lineNumber:135,columnNumber:9}},_react.default.createElement(_.Button,{variant:"text",label:"Cancel",onPress:onCancelHandle,labelStyle:{mx:0},__self:_this,__source:{fileName:_jsxFileName,lineNumber:142,columnNumber:11}})));};exports.SearchBar=SearchBar;SearchBar.propTypes={placeholder:_propTypes.default.string,onChangeText:_propTypes.default.func.isRequired,debounceDelay:_propTypes.default.oneOfType([_propTypes.default.number,_propTypes.default.string]),searchbarProps:_propTypes.default.object,onCancel:_propTypes.default.func,showCancelButton:_propTypes.default.bool};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neetoui-rn",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.187",
|
|
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": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext, useEffect } from "react";
|
|
2
2
|
import Icon from "react-native-remix-icon";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { StyleSheet, Platform } from "react-native";
|
|
4
|
+
import { StyleSheet, Platform, TouchableWithoutFeedback } from "react-native";
|
|
5
5
|
import Animated, {
|
|
6
6
|
useSharedValue,
|
|
7
7
|
useAnimatedStyle,
|
|
@@ -9,6 +9,7 @@ import Animated, {
|
|
|
9
9
|
interpolate,
|
|
10
10
|
Extrapolation,
|
|
11
11
|
} from "react-native-reanimated";
|
|
12
|
+
|
|
12
13
|
import { Container, Typography } from "@components";
|
|
13
14
|
import { ThemeContext } from "styled-components/native";
|
|
14
15
|
|
|
@@ -113,29 +114,30 @@ function TabElement({
|
|
|
113
114
|
});
|
|
114
115
|
|
|
115
116
|
return (
|
|
116
|
-
<
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
>
|
|
123
|
-
<Container height={35} width={48} alignItems="center" mb={1}>
|
|
124
|
-
<Animated.View style={[styles.iconContainer, animatedStyles]}>
|
|
125
|
-
<Icon size={size} color={theme.colors.font.grey500} name={icon} />
|
|
126
|
-
</Animated.View>
|
|
127
|
-
<Animated.View style={[styles.iconContainer, animatedStyles2]}>
|
|
128
|
-
<Icon size={size} color={theme.colors.font.base} name={icon} />
|
|
129
|
-
</Animated.View>
|
|
130
|
-
</Container>
|
|
131
|
-
<Typography
|
|
132
|
-
color={isFocused ? tabBarActiveTintColor : tabBarInactiveTintColor}
|
|
133
|
-
fontFamily="sf500"
|
|
134
|
-
fontSize="4xs"
|
|
117
|
+
<TouchableWithoutFeedback onPress={onPress}>
|
|
118
|
+
<Container
|
|
119
|
+
flex={1}
|
|
120
|
+
alignItems="center"
|
|
121
|
+
borderTopWidth={1}
|
|
122
|
+
borderColor="background.grey200"
|
|
135
123
|
>
|
|
136
|
-
{
|
|
137
|
-
|
|
138
|
-
|
|
124
|
+
<Container height={35} width={48} alignItems="center" mb={1}>
|
|
125
|
+
<Animated.View style={[styles.iconContainer, animatedStyles]}>
|
|
126
|
+
<Icon size={size} color={theme.colors.font.grey500} name={icon} />
|
|
127
|
+
</Animated.View>
|
|
128
|
+
<Animated.View style={[styles.iconContainer, animatedStyles2]}>
|
|
129
|
+
<Icon size={size} color={theme.colors.font.base} name={icon} />
|
|
130
|
+
</Animated.View>
|
|
131
|
+
</Container>
|
|
132
|
+
<Typography
|
|
133
|
+
color={isFocused ? tabBarActiveTintColor : tabBarInactiveTintColor}
|
|
134
|
+
fontFamily="sf500"
|
|
135
|
+
fontSize="4xs"
|
|
136
|
+
>
|
|
137
|
+
{name}
|
|
138
|
+
</Typography>
|
|
139
|
+
</Container>
|
|
140
|
+
</TouchableWithoutFeedback>
|
|
139
141
|
);
|
|
140
142
|
}
|
|
141
143
|
|
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,
|
package/src/components/Input.js
CHANGED
|
@@ -101,6 +101,7 @@ export const Input = props => {
|
|
|
101
101
|
autoFocus = false,
|
|
102
102
|
disabled = false,
|
|
103
103
|
noBorder = false,
|
|
104
|
+
showInputAccessoryView = true,
|
|
104
105
|
textAlignVertical = "top",
|
|
105
106
|
...rest
|
|
106
107
|
} = props;
|
|
@@ -235,30 +236,32 @@ export const Input = props => {
|
|
|
235
236
|
textAlignVertical={textAlignVertical}
|
|
236
237
|
{...rest.inputProps}
|
|
237
238
|
/>
|
|
238
|
-
{rest.inputProps?.multiline &&
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
239
|
+
{rest.inputProps?.multiline &&
|
|
240
|
+
showInputAccessoryView &&
|
|
241
|
+
Platform.OS === "ios" && (
|
|
242
|
+
<InputAccessoryView nativeID={label}>
|
|
243
|
+
<Container
|
|
244
|
+
bg="background.white"
|
|
245
|
+
flexDirection="row"
|
|
246
|
+
p={2}
|
|
247
|
+
width={width}
|
|
248
|
+
justifyContent="flex-end"
|
|
249
|
+
alignItems="center"
|
|
250
|
+
pr={20}
|
|
251
|
+
>
|
|
252
|
+
<Button
|
|
253
|
+
height={30}
|
|
254
|
+
left={10}
|
|
255
|
+
labelStyle={styles.doneButtonStyle}
|
|
256
|
+
variant="text"
|
|
257
|
+
onPress={() => {
|
|
258
|
+
Keyboard.dismiss();
|
|
259
|
+
}}
|
|
260
|
+
label="Done"
|
|
261
|
+
/>
|
|
262
|
+
</Container>
|
|
263
|
+
</InputAccessoryView>
|
|
264
|
+
)}
|
|
262
265
|
</View>
|
|
263
266
|
{!!SuffixIcon && (
|
|
264
267
|
<View px={2}>
|
|
@@ -324,6 +327,10 @@ Input.propTypes = {
|
|
|
324
327
|
* Used to align the position of text in input.
|
|
325
328
|
*/
|
|
326
329
|
textAlignVertical: PropTypes.oneOf(["auto", "top", "bottom", "center"]),
|
|
330
|
+
/**
|
|
331
|
+
* Show Input AccessoryView on iOS
|
|
332
|
+
*/
|
|
333
|
+
showInputAccessoryView: PropTypes.bool,
|
|
327
334
|
};
|
|
328
335
|
|
|
329
336
|
export const styles = StyleSheet.create({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
-
import { Animated
|
|
2
|
+
import { Animated } from "react-native";
|
|
3
3
|
import {
|
|
4
4
|
flexbox,
|
|
5
5
|
space,
|
|
@@ -58,7 +58,7 @@ export const SearchBar = props => {
|
|
|
58
58
|
searchText,
|
|
59
59
|
Number(debounceDelay)
|
|
60
60
|
);
|
|
61
|
-
const
|
|
61
|
+
const buttonWidthController = useRef(new Animated.Value(0)).current;
|
|
62
62
|
const buttonOpacityController = useRef(new Animated.Value(0)).current;
|
|
63
63
|
|
|
64
64
|
useEffect(() => {
|
|
@@ -72,7 +72,7 @@ export const SearchBar = props => {
|
|
|
72
72
|
duration: 350,
|
|
73
73
|
useNativeDriver: false,
|
|
74
74
|
}),
|
|
75
|
-
Animated.timing(
|
|
75
|
+
Animated.timing(buttonWidthController, {
|
|
76
76
|
toValue: val,
|
|
77
77
|
duration: 200,
|
|
78
78
|
useNativeDriver: false,
|
|
@@ -80,7 +80,7 @@ export const SearchBar = props => {
|
|
|
80
80
|
]).start();
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
const cancelButtonWidth =
|
|
83
|
+
const cancelButtonWidth = buttonWidthController.interpolate({
|
|
84
84
|
inputRange: [0, 1],
|
|
85
85
|
outputRange: [0, 60],
|
|
86
86
|
});
|
|
@@ -93,11 +93,16 @@ export const SearchBar = props => {
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
return (
|
|
96
|
-
<Container flexDirection="row" alignItems="center"
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
96
|
+
<Container flexDirection="row" alignItems="center">
|
|
97
|
+
<Container
|
|
98
|
+
height={42}
|
|
99
|
+
flex={1}
|
|
100
|
+
borderWidth={1}
|
|
101
|
+
borderColor={theme.colors.border.grey400}
|
|
102
|
+
borderRadius={8}
|
|
103
|
+
flexDirection="row"
|
|
104
|
+
alignItems="center"
|
|
105
|
+
{...rest.containerProps}
|
|
101
106
|
>
|
|
102
107
|
<Container px={10}>
|
|
103
108
|
<Icon
|
|
@@ -125,39 +130,27 @@ export const SearchBar = props => {
|
|
|
125
130
|
returnKeyType="search"
|
|
126
131
|
{...rest.searchbarProps}
|
|
127
132
|
/>
|
|
128
|
-
</
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
</Container>
|
|
134
|
+
{showCancelButton && (
|
|
135
|
+
<Animated.View
|
|
136
|
+
style={{
|
|
137
|
+
opacity: buttonOpacityController,
|
|
138
|
+
width: cancelButtonWidth,
|
|
139
|
+
alignItems: "flex-end",
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
137
142
|
<Button
|
|
138
143
|
variant="text"
|
|
139
144
|
label="Cancel"
|
|
140
145
|
onPress={onCancelHandle}
|
|
141
146
|
labelStyle={{ mx: 0 }}
|
|
142
147
|
/>
|
|
143
|
-
|
|
144
|
-
|
|
148
|
+
</Animated.View>
|
|
149
|
+
)}
|
|
145
150
|
</Container>
|
|
146
151
|
);
|
|
147
152
|
};
|
|
148
153
|
|
|
149
|
-
const styles = StyleSheet.create({
|
|
150
|
-
inputContainerStyles: {
|
|
151
|
-
height: 42,
|
|
152
|
-
flex: 1,
|
|
153
|
-
borderWidth: 1,
|
|
154
|
-
borderColor: theme.colors.border.grey400,
|
|
155
|
-
borderRadius: 8,
|
|
156
|
-
flexDirection: "row",
|
|
157
|
-
alignItems: "center",
|
|
158
|
-
},
|
|
159
|
-
});
|
|
160
|
-
|
|
161
154
|
SearchBar.propTypes = {
|
|
162
155
|
/**
|
|
163
156
|
* Set the placeholder text
|