@bigbinary/neetoui-rn 0.0.268 → 0.0.270

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/package.json +2 -3
  2. package/src/components/Accordion.jsx +0 -266
  3. package/src/components/ActionIcon.jsx +0 -76
  4. package/src/components/Alert.jsx +0 -262
  5. package/src/components/AnimatedImage.jsx +0 -140
  6. package/src/components/Avatar.jsx +0 -144
  7. package/src/components/Badge.jsx +0 -97
  8. package/src/components/BottomSheet.jsx +0 -487
  9. package/src/components/BottomTabBar.jsx +0 -232
  10. package/src/components/Button.jsx +0 -275
  11. package/src/components/ButtonGroup.jsx +0 -120
  12. package/src/components/Calendar.jsx +0 -128
  13. package/src/components/Card.jsx +0 -90
  14. package/src/components/Carousel.jsx +0 -116
  15. package/src/components/ChatInput/AttachmentsView.jsx +0 -51
  16. package/src/components/ChatInput/Badge.jsx +0 -24
  17. package/src/components/ChatInput/ChatInput.jsx +0 -564
  18. package/src/components/ChatInput/EmailFields.jsx +0 -122
  19. package/src/components/ChatInput/IconButton.jsx +0 -34
  20. package/src/components/ChatInput/MentionsInputWrapper.jsx +0 -155
  21. package/src/components/CheckBox.jsx +0 -150
  22. package/src/components/Chip.jsx +0 -180
  23. package/src/components/Container.jsx +0 -31
  24. package/src/components/Divider.jsx +0 -79
  25. package/src/components/FAB.jsx +0 -113
  26. package/src/components/FlashList.jsx +0 -189
  27. package/src/components/FlatList.js +0 -10
  28. package/src/components/Input.jsx +0 -357
  29. package/src/components/InputEmailChip.jsx +0 -246
  30. package/src/components/LineLoader.jsx +0 -46
  31. package/src/components/ListItem.jsx +0 -68
  32. package/src/components/Loader.jsx +0 -122
  33. package/src/components/MultiSelect.jsx +0 -631
  34. package/src/components/NotificationIcon.jsx +0 -38
  35. package/src/components/NotificationPreferenceList.jsx +0 -208
  36. package/src/components/OnBoarding.jsx +0 -134
  37. package/src/components/OrganizationItem.jsx +0 -110
  38. package/src/components/OtpInputs.jsx +0 -194
  39. package/src/components/ParentView.jsx +0 -139
  40. package/src/components/Popover.jsx +0 -221
  41. package/src/components/RadioButton.jsx +0 -155
  42. package/src/components/RichTextEditor.jsx +0 -163
  43. package/src/components/Ripple.jsx +0 -281
  44. package/src/components/ScrollView.js +0 -14
  45. package/src/components/SearchBar.jsx +0 -207
  46. package/src/components/SegmentedTopBar/Indicator.jsx +0 -77
  47. package/src/components/SegmentedTopBar/Tab.jsx +0 -37
  48. package/src/components/SegmentedTopBar/index.jsx +0 -128
  49. package/src/components/SocialButton.jsx +0 -106
  50. package/src/components/Toast.jsx +0 -195
  51. package/src/components/ToggleSwitch.jsx +0 -112
  52. package/src/components/TopBar.jsx +0 -147
  53. package/src/components/Touchable.jsx +0 -133
  54. package/src/components/TouchableWithoutFeedback.jsx +0 -51
  55. package/src/components/Typography.jsx +0 -93
  56. package/src/components/index.js +0 -45
  57. package/src/config/index.js +0 -1
  58. package/src/config/toasterConfig.jsx +0 -142
  59. package/src/contexts/index.js +0 -3
  60. package/src/hooks/index.js +0 -3
  61. package/src/hooks/useDebounce.js +0 -17
  62. package/src/hooks/useKeyboard.js +0 -33
  63. package/src/hooks/useRefreshByUser.js +0 -20
  64. package/src/index.js +0 -2
  65. package/src/theme/index.js +0 -181
  66. package/src/utils/utils.js +0 -56
@@ -1,189 +0,0 @@
1
- import React, { useCallback, useContext, useEffect } from "react";
2
- import { Dimensions, RefreshControl } from "react-native";
3
-
4
- import { FlashList as ShopifyFlashList } from "@shopify/flash-list";
5
- import PropTypes from "prop-types";
6
- import ContentLoader, { Rect } from "react-content-loader/native";
7
- import Animated, {
8
- cancelAnimation,
9
- Extrapolation,
10
- interpolate,
11
- useAnimatedStyle,
12
- useSharedValue,
13
- withSequence,
14
- withTiming,
15
- } from "react-native-reanimated";
16
- import { moderateScale } from "react-native-size-matters";
17
- import { ThemeContext } from "styled-components/native";
18
-
19
- import { useRefreshByUser } from "@hooks";
20
-
21
- const { width } = Dimensions.get("screen");
22
- const Placeholder = () => {
23
- const theme = useContext(ThemeContext);
24
-
25
- return (
26
- <ContentLoader
27
- backgroundColor={theme.colors.lightgrey}
28
- foregroundColor={theme.colors.grey300}
29
- height={moderateScale(60)}
30
- marginHorizontal={moderateScale(15)}
31
- viewBox={`0 0 ${moderateScale(400)} ${moderateScale(50)}`}
32
- width={moderateScale(400)}
33
- >
34
- <Rect
35
- height={moderateScale(50)}
36
- rx={moderateScale(5)}
37
- ry={moderateScale(5)}
38
- width={width - moderateScale(30)}
39
- x="0"
40
- />
41
- </ContentLoader>
42
- );
43
- };
44
-
45
- export const FlashList = React.forwardRef(
46
- (
47
- {
48
- animationDuration = 2000,
49
- SkeletonComponent,
50
- placeHolderItemCount = 10,
51
- isLoading = false,
52
- data = [],
53
- onRefresh = () => {},
54
- onEndReached = () => {},
55
- keyExtractor,
56
- ...rest
57
- },
58
- ref
59
- ) => {
60
- const dummyData = Array.apply(null, Array(placeHolderItemCount));
61
-
62
- const { isRefetchingByUser, refetchByUser } = useRefreshByUser(onRefresh);
63
-
64
- return (
65
- <FadeInFlatList
66
- SkeletonComponent={SkeletonComponent}
67
- animationDuration={animationDuration}
68
- data={isLoading ? dummyData : data}
69
- extraData={{ isLoading, placeHolderItemCount }}
70
- isLoading={isLoading}
71
- key={isLoading}
72
- placeHolderItemCount={placeHolderItemCount}
73
- ref={ref}
74
- keyExtractor={(item, index) =>
75
- isLoading || !keyExtractor
76
- ? index.toString()
77
- : keyExtractor(item, index)
78
- }
79
- refreshControl={
80
- onRefresh && (
81
- <RefreshControl
82
- refreshing={isRefetchingByUser}
83
- onRefresh={refetchByUser}
84
- />
85
- )
86
- }
87
- {...rest}
88
- onEndReached={isLoading ? undefined : onEndReached}
89
- />
90
- );
91
- }
92
- );
93
-
94
- FlashList.displayName = "FlashList";
95
-
96
- const FadeInFlatList = React.forwardRef(
97
- (
98
- {
99
- renderItem: originalRenderItem,
100
- animationDuration,
101
- isLoading = false,
102
- SkeletonComponent,
103
- ...props
104
- },
105
- ref
106
- ) => {
107
- const value = useSharedValue(0);
108
-
109
- const FadeInComponent = useCallback(({ index, children }) => {
110
- const inputRange = [index - 1, index, index + 1, index + 2];
111
- // eslint-disable-next-line react-hooks/rules-of-hooks
112
- const animatedStyles = useAnimatedStyle(() => ({
113
- opacity: interpolate(
114
- value.value,
115
- inputRange,
116
- [0, 0.6, 1, 1],
117
- Extrapolation.CLAMP
118
- ),
119
- transform: [
120
- {
121
- translateX: interpolate(
122
- value.value,
123
- inputRange,
124
- [25, 15, 10, 0],
125
- Extrapolation.CLAMP
126
- ),
127
- },
128
- ],
129
- }));
130
-
131
- return <Animated.View style={animatedStyles}>{children}</Animated.View>;
132
- }, []);
133
-
134
- const Item = ({ item }) =>
135
- item?.extraData?.isLoading ? (
136
- <FadeInComponent index={item.index}>
137
- {SkeletonComponent || <Placeholder />}
138
- </FadeInComponent>
139
- ) : (
140
- <FadeInComponent index={item.index}>
141
- {originalRenderItem(item)}
142
- </FadeInComponent>
143
- );
144
-
145
- Item.propTypes = {
146
- item: PropTypes.object,
147
- };
148
-
149
- const renderItem = item =>
150
- isLoading || item.index < props.placeHolderItemCount ? (
151
- <Item item={item} />
152
- ) : (
153
- originalRenderItem(item)
154
- );
155
-
156
- useEffect(() => {
157
- value.value = 0;
158
- value.value = withSequence(
159
- withTiming(20, {
160
- duration: animationDuration,
161
- }),
162
- withTiming(10000, {
163
- duration: 0,
164
- })
165
- );
166
-
167
- return () => {
168
- cancelAnimation(value);
169
- };
170
- }, [animationDuration, value, isLoading]);
171
-
172
- return <ShopifyFlashList ref={ref} {...props} renderItem={renderItem} />;
173
- }
174
- );
175
-
176
- FadeInFlatList.displayName = "FadeInFlatList";
177
-
178
- FlashList.propTypes = {
179
- SkeletonComponent: PropTypes.element,
180
- animationDuration: PropTypes.number,
181
- data: PropTypes.array.isRequired,
182
- isLoading: PropTypes.bool,
183
- placeHolderItemCount: PropTypes.number,
184
- onRefresh: PropTypes.func,
185
- onEndReached: PropTypes.func,
186
- keyExtractor: PropTypes.func,
187
- };
188
-
189
- FadeInFlatList.propTypes = FlashList.propTypes;
@@ -1,10 +0,0 @@
1
- import styled from "styled-components/native";
2
- import { flexbox, space, border, color, layout } from "styled-system";
3
-
4
- export const FlatList = styled.FlatList`
5
- ${flexbox}
6
- ${space}
7
- ${border}
8
- ${color}
9
- ${layout}
10
- `;
@@ -1,357 +0,0 @@
1
- import React, { useCallback, useContext, useEffect, useRef } from "react";
2
- import {
3
- Animated,
4
- InputAccessoryView,
5
- Keyboard,
6
- StyleSheet,
7
- useWindowDimensions,
8
- Platform,
9
- TouchableWithoutFeedback,
10
- } from "react-native";
11
-
12
- import PropTypes from "prop-types";
13
- import { moderateScale as scaleItem } from "react-native-size-matters";
14
- import styled, { ThemeContext } from "styled-components/native";
15
- import {
16
- flexbox,
17
- space,
18
- border,
19
- buttonStyle,
20
- typography,
21
- textStyle,
22
- color,
23
- layout,
24
- system,
25
- position,
26
- } from "styled-system";
27
-
28
- import { Button, Container } from "@components";
29
-
30
- import { theme } from "../theme";
31
- import { isAndroid } from "../utils/utils";
32
-
33
- const TextInput = styled.TextInput`
34
- ${flexbox}
35
- ${space}
36
- ${border}
37
- ${buttonStyle}
38
- ${typography}
39
- ${color}
40
- `;
41
-
42
- const View = styled.View`
43
- ${flexbox}
44
- ${space}
45
- ${border}
46
- ${color}
47
- ${layout}
48
- `;
49
-
50
- const Typography = styled.Text`
51
- ${textStyle}
52
- ${space}
53
- ${layout}
54
- ${flexbox}
55
- ${typography}
56
- ${color}
57
- ${position}
58
- ${system({
59
- textDecoration: {
60
- property: "textDecoration",
61
- cssProperty: "textDecoration",
62
- },
63
- textTransform: { property: "textTransform", cssProperty: "textTransform" },
64
- })}
65
- `;
66
-
67
- const AnimatedLabel = Animated.createAnimatedComponent(Typography);
68
-
69
- /**
70
- * Input component allow users to input custom text entries with a keyboard.
71
- * This component supports below props categories from [styled-system ](/styled-system).
72
- * <ul>
73
- * <li>flexbox</li>
74
- * <li>space</li>
75
- * <li>border</li>
76
- * <li>buttonStyle</li>
77
- * <li>brandLeft</li>
78
- * <li>typography</li>
79
- * </ul>
80
- *
81
- * <div class="screenshots">
82
- * <img src="screenshots/inputs/inputs.png" />
83
- * </div>
84
- *
85
- * ## Usage
86
- * ```js
87
- * import * as React from 'react';
88
- * import { Input, Container } from '@bigbinary/neetoui-rn';
89
- *
90
- * export default function Main() {
91
- * return (
92
- * <Container>
93
- * <Input value="Oliver Smith" onChangeText={()=>{}} label="Name" />
94
- * </Container>
95
- * );
96
- * }
97
- * ```
98
- *
99
- */
100
-
101
- export const Input = ({
102
- label,
103
- value = "",
104
- onChangeText = () => {},
105
- onBlur = () => {},
106
- errorMessage = null,
107
- PrefixIcon,
108
- SuffixIcon,
109
- autoFocus = false,
110
- disabled = false,
111
- noBorder = false,
112
- showInputAccessoryView = true,
113
- textAlignVertical = "top",
114
- containerProps,
115
- ...rest
116
- }) => {
117
- const { width } = useWindowDimensions();
118
- const colors = useContext(ThemeContext).colors;
119
- const inputRef = useRef();
120
- const containerRef = useRef();
121
- const animatedController = useRef(new Animated.Value(0)).current;
122
-
123
- useEffect(() => {
124
- if (autoFocus) {
125
- handleLabelAnimation(true);
126
- } else {
127
- handleLabelAnimation(false);
128
- }
129
- }, [autoFocus]);
130
-
131
- useEffect(() => {
132
- if (value) {
133
- if (Math.floor(animatedController._value) === 0) {
134
- handleLabelAnimation(true);
135
- }
136
- } else {
137
- handleLabelAnimation(false);
138
- }
139
- }, [value]);
140
-
141
- const handleLabelAnimation = isFocused => {
142
- Animated.timing(animatedController, {
143
- toValue: !!isFocused || !!value ? 1 : 0,
144
- duration: 300,
145
- useNativeDriver: false,
146
- }).start();
147
- };
148
-
149
- const moderateScale = scaleFactor => Math.floor(scaleItem(scaleFactor));
150
-
151
- const handleStyles = useCallback(isFocused => {
152
- containerRef.current &&
153
- containerRef.current.setNativeProps({
154
- borderColor: errorMessage
155
- ? colors.border.danger
156
- : isFocused
157
- ? colors.border.purple500
158
- : colors.border.grey400,
159
- borderWidth:
160
- errorMessage || isFocused ? moderateScale(1.5) : moderateScale(1),
161
- });
162
- }, []);
163
-
164
- const labelStyles = {
165
- zIndex: 100,
166
- paddingLeft: isAndroid() ? moderateScale(4) : 0,
167
- fontSize: animatedController.interpolate({
168
- inputRange: [0, 1],
169
- outputRange: [moderateScale(17), moderateScale(13)],
170
- }),
171
- top: animatedController.interpolate({
172
- inputRange: [0, 1],
173
- outputRange: [moderateScale(15), moderateScale(6)],
174
- }),
175
- };
176
-
177
- const handleFocusBlur = isFocused => {
178
- if (label) {
179
- if (!value) handleLabelAnimation(isFocused);
180
-
181
- if (!noBorder) handleStyles(isFocused);
182
- }
183
- };
184
-
185
- return (
186
- <>
187
- <TouchableWithoutFeedback
188
- onPress={() => {
189
- if (!inputRef?.current?.isFocused()) {
190
- inputRef?.current?.focus();
191
- }
192
- }}
193
- >
194
- <View
195
- alignItems="center"
196
- borderColor={errorMessage ? "border.danger" : "border.grey400"}
197
- borderRadius={moderateScale(8)}
198
- borderWidth={noBorder ? 0 : moderateScale(1)}
199
- flexDirection="row"
200
- justifyContent="space-between"
201
- overflow="hidden"
202
- ref={containerRef}
203
- {...containerProps}
204
- >
205
- {!!PrefixIcon && (
206
- <View pl={moderateScale(10)}>
207
- <PrefixIcon />
208
- </View>
209
- )}
210
- <View flex={1} left={moderateScale(10)}>
211
- {!!label && (
212
- <AnimatedLabel
213
- color={disabled ? "font.grey400" : "font.grey600"}
214
- position="absolute"
215
- style={labelStyles}
216
- zIndex={1}
217
- >
218
- {label}
219
- </AnimatedLabel>
220
- )}
221
- <TextInput
222
- autoCapitalize="sentences"
223
- autoFocus={autoFocus}
224
- color={disabled ? "font.grey500" : "font.primary"}
225
- editable={!disabled}
226
- fontSize={moderateScale(17)}
227
- inputAccessoryViewID={label}
228
- paddingRight={moderateScale(20)}
229
- paddingVertical={0}
230
- pb={moderateScale(4)}
231
- pt={!label ? moderateScale(5) : 0}
232
- ref={inputRef}
233
- returnKeyType={rest.inputProps?.multiline ? "default" : "done"}
234
- textAlignVertical={textAlignVertical}
235
- top={0}
236
- value={value}
237
- zIndex={2}
238
- style={{
239
- marginTop: label ? moderateScale(22) : 0,
240
- marginBottom: rest.inputProps?.multiline
241
- ? moderateScale(10)
242
- : 0,
243
- }}
244
- onChangeText={onChangeText}
245
- onBlur={() => {
246
- onBlur();
247
- handleFocusBlur(false);
248
- }}
249
- onFocus={() => {
250
- handleFocusBlur(true);
251
- }}
252
- {...rest.inputProps}
253
- />
254
- {rest.inputProps?.multiline &&
255
- showInputAccessoryView &&
256
- Platform.OS === "ios" && (
257
- <InputAccessoryView nativeID={label}>
258
- <Container
259
- alignItems="center"
260
- bg="background.white"
261
- flexDirection="row"
262
- justifyContent="flex-end"
263
- p={moderateScale(2)}
264
- pr={moderateScale(20)}
265
- width={width}
266
- >
267
- <Button
268
- height={moderateScale(30)}
269
- label="Done"
270
- labelStyle={styles.doneButtonStyle}
271
- left={moderateScale(10)}
272
- variant="text"
273
- onPress={() => {
274
- Keyboard.dismiss();
275
- }}
276
- />
277
- </Container>
278
- </InputAccessoryView>
279
- )}
280
- </View>
281
- {!!SuffixIcon && (
282
- <View pr={moderateScale(10)}>
283
- <SuffixIcon />
284
- </View>
285
- )}
286
- </View>
287
- </TouchableWithoutFeedback>
288
- {!!errorMessage && (
289
- <Typography color="font.danger" pt={moderateScale(2)}>
290
- {errorMessage}
291
- </Typography>
292
- )}
293
- </>
294
- );
295
- };
296
-
297
- Input.propTypes = {
298
- /**
299
- * The text to use for the floating label.
300
- */
301
- label: PropTypes.string,
302
- /**
303
- * Holds the current value of the Input.
304
- */
305
- value: PropTypes.string.isRequired,
306
- /**
307
- * Func to set the current value.
308
- */
309
- onChangeText: PropTypes.func.isRequired,
310
- /**
311
- * Func which will get trigged onBlur.
312
- */
313
- onBlur: PropTypes.func,
314
- /**
315
- * To display error/info messages
316
- */
317
- errorMessage: PropTypes.string,
318
- /**
319
- * If true, user won't be able to interact with the component.
320
- */
321
- disabled: PropTypes.bool,
322
- /**
323
- * If true, shows border on focus.
324
- */
325
- autoFocus: PropTypes.bool,
326
- /**
327
- * Display Icon component to the left of input.
328
- */
329
- PrefixIcon: PropTypes.elementType,
330
- /**
331
- * Display Icon component to the Right of input.
332
- */
333
- SuffixIcon: PropTypes.elementType,
334
- /**
335
- * Takes a boolean value based on which border is hidden/shown.
336
- */
337
- noBorder: PropTypes.bool,
338
- /**
339
- * Used to pass custom styles to the wrapper component.
340
- */
341
- containerProps: PropTypes.object,
342
- /**
343
- * Used to align the position of text in input.
344
- */
345
- textAlignVertical: PropTypes.oneOf(["auto", "top", "bottom", "center"]),
346
- /**
347
- * Show Input AccessoryView on iOS
348
- */
349
- showInputAccessoryView: PropTypes.bool,
350
- };
351
-
352
- export const styles = StyleSheet.create({
353
- doneButtonStyle: {
354
- fontFamily: "sf700",
355
- color: theme.colors.font.base,
356
- },
357
- });