@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,281 +0,0 @@
1
- import React, { PureComponent } from "react";
2
- import {
3
- View,
4
- Animated,
5
- Easing,
6
- Platform,
7
- I18nManager,
8
- StyleSheet,
9
- } from "react-native";
10
-
11
- import PropTypes from "prop-types";
12
- import { moderateScale } from "react-native-size-matters";
13
-
14
- import TouchableWithoutFeedback from "./TouchableWithoutFeedback";
15
-
16
- const radius = moderateScale(10);
17
-
18
- export default class Ripple extends PureComponent {
19
- static defaultProps = {
20
- ...TouchableWithoutFeedback.defaultProps,
21
-
22
- rippleColor: "rgb(0, 0, 0)",
23
- rippleOpacity: 0.3,
24
- rippleDuration: 400,
25
- rippleSize: 0,
26
- rippleContainerBorderRadius: 0,
27
- rippleCentered: false,
28
- rippleSequential: false,
29
- rippleFades: true,
30
- rippleOutsideContainer: false,
31
- disabled: false,
32
-
33
- onRippleAnimation: (animation, onComplete) => animation.start(onComplete),
34
- };
35
-
36
- static propTypes = {
37
- ...Animated.View.propTypes,
38
- ...TouchableWithoutFeedback.propTypes,
39
-
40
- children: PropTypes.node.isRequired,
41
- rippleColor: PropTypes.string,
42
- rippleOpacity: PropTypes.number,
43
- rippleDuration: PropTypes.number,
44
- rippleSize: PropTypes.number,
45
- rippleContainerBorderRadius: PropTypes.number,
46
- rippleCentered: PropTypes.bool,
47
- rippleSequential: PropTypes.bool,
48
- rippleFades: PropTypes.bool,
49
- rippleOutsideContainer: PropTypes.bool,
50
- disabled: PropTypes.bool,
51
-
52
- onRippleAnimation: PropTypes.func,
53
- };
54
-
55
- constructor(props) {
56
- super(props);
57
-
58
- this.onLayout = this.onLayout.bind(this);
59
- this.onPress = this.onPress.bind(this);
60
- this.onPressIn = this.onPressIn.bind(this);
61
- this.onPressOut = this.onPressOut.bind(this);
62
- this.onLongPress = this.onLongPress.bind(this);
63
- this.onAnimationEnd = this.onAnimationEnd.bind(this);
64
-
65
- this.renderRipple = this.renderRipple.bind(this);
66
-
67
- this.unique = 0;
68
- this.mounted = false;
69
-
70
- this.state = {
71
- width: 0,
72
- height: 0,
73
- ripples: [],
74
- };
75
- }
76
-
77
- componentDidMount() {
78
- this.mounted = true;
79
- }
80
-
81
- componentWillUnmount() {
82
- this.mounted = false;
83
- }
84
-
85
- onLayout(event) {
86
- const { width, height } = event.nativeEvent.layout;
87
- const { onLayout } = this.props;
88
-
89
- if ("function" === typeof onLayout) {
90
- onLayout(event);
91
- }
92
-
93
- this.setState({ width, height });
94
- }
95
-
96
- onPress(event) {
97
- const { ripples } = this.state;
98
- const { onPress, rippleSequential } = this.props;
99
-
100
- if (!rippleSequential || !ripples.length) {
101
- if ("function" === typeof onPress) {
102
- requestAnimationFrame(() => onPress(event));
103
- }
104
-
105
- this.startRipple(event);
106
- }
107
- }
108
-
109
- onLongPress(event) {
110
- const { onLongPress } = this.props;
111
-
112
- if ("function" === typeof onLongPress) {
113
- requestAnimationFrame(() => onLongPress(event));
114
- }
115
-
116
- this.startRipple(event);
117
- }
118
-
119
- onPressIn(event) {
120
- const { onPressIn } = this.props;
121
-
122
- if ("function" === typeof onPressIn) {
123
- onPressIn(event);
124
- }
125
- }
126
-
127
- onPressOut(event) {
128
- const { onPressOut } = this.props;
129
-
130
- if ("function" === typeof onPressOut) {
131
- onPressOut(event);
132
- }
133
- }
134
-
135
- onAnimationEnd() {
136
- if (this.mounted) {
137
- this.setState(({ ripples }) => ({ ripples: ripples.slice(1) }));
138
- }
139
- }
140
-
141
- startRipple(event) {
142
- const { width, height } = this.state;
143
- const { rippleDuration, rippleCentered, rippleSize, onRippleAnimation } =
144
- this.props;
145
-
146
- const w2 = 0.5 * width;
147
- const h2 = 0.5 * height;
148
-
149
- const { locationX, locationY } = rippleCentered
150
- ? { locationX: w2, locationY: h2 }
151
- : event.nativeEvent;
152
-
153
- const offsetX = Math.abs(w2 - locationX);
154
- const offsetY = Math.abs(h2 - locationY);
155
-
156
- const size =
157
- rippleSize > 0
158
- ? 0.5 * rippleSize
159
- : Math.sqrt(Math.pow(w2 + offsetX, 2) + Math.pow(h2 + offsetY, 2));
160
-
161
- const ripple = {
162
- unique: this.unique++,
163
- progress: new Animated.Value(0),
164
- locationX,
165
- locationY,
166
- size,
167
- };
168
-
169
- const animation = Animated.timing(ripple.progress, {
170
- toValue: 1,
171
- easing: Easing.out(Easing.ease),
172
- duration: rippleDuration,
173
- useNativeDriver: true,
174
- });
175
-
176
- onRippleAnimation(animation, this.onAnimationEnd);
177
-
178
- this.setState(({ ripples }) => ({ ripples: ripples.concat(ripple) }));
179
- }
180
-
181
- renderRipple({ unique, progress, locationX, locationY, size }) {
182
- const { rippleColor, rippleOpacity, rippleFades } = this.props;
183
-
184
- const rippleStyle = {
185
- top: locationY - radius,
186
- [I18nManager.isRTL ? "right" : "left"]: locationX - radius,
187
- backgroundColor: rippleColor,
188
-
189
- transform: [
190
- {
191
- scale: progress.interpolate({
192
- inputRange: [0, 1],
193
- outputRange: [0.5 / radius, size / radius],
194
- }),
195
- },
196
- ],
197
-
198
- opacity: rippleFades
199
- ? progress.interpolate({
200
- inputRange: [0, 1],
201
- outputRange: [rippleOpacity, 0],
202
- })
203
- : rippleOpacity,
204
- };
205
-
206
- return <Animated.View key={unique} style={[styles.ripple, rippleStyle]} />;
207
- }
208
-
209
- render() {
210
- const { ripples } = this.state;
211
- const {
212
- delayLongPress,
213
- delayPressIn,
214
- delayPressOut,
215
- disabled,
216
- hitSlop,
217
- pressRetentionOffset,
218
- children,
219
- rippleContainerBorderRadius,
220
- rippleOutsideContainer,
221
- testID,
222
- nativeID,
223
- accessible,
224
- accessibilityHint,
225
- accessibilityLabel,
226
- ...props
227
- } = this.props;
228
-
229
- const touchableProps = {
230
- delayLongPress,
231
- delayPressIn,
232
- delayPressOut,
233
- disabled,
234
- hitSlop,
235
- pressRetentionOffset,
236
- testID,
237
- accessible,
238
- accessibilityHint,
239
- accessibilityLabel,
240
- onLayout: this.onLayout,
241
- onPress: this.onPress,
242
- onLongPress: this.onLongPress,
243
- onPressIn: this.onPressIn,
244
- onPressOut: this.onPressOut,
245
-
246
- ...("web" !== Platform.OS ? { nativeID } : null),
247
- };
248
-
249
- const containerStyle = {
250
- borderRadius: rippleContainerBorderRadius,
251
- };
252
-
253
- return (
254
- <TouchableWithoutFeedback {...touchableProps}>
255
- <Animated.View {...props} collapsable={false} pointerEvents="box-only">
256
- {children}
257
- <View
258
- style={[styles.container(rippleOutsideContainer), containerStyle]}
259
- >
260
- {ripples.map(this.renderRipple)}
261
- </View>
262
- </Animated.View>
263
- </TouchableWithoutFeedback>
264
- );
265
- }
266
- }
267
-
268
- const styles = StyleSheet.create({
269
- container: rippleOutsideContainer => ({
270
- ...StyleSheet.absoluteFillObject,
271
- backgroundColor: "transparent",
272
- overflow: rippleOutsideContainer ? "visible" : "hidden",
273
- }),
274
- ripple: {
275
- width: radius * 2,
276
- height: radius * 2,
277
- borderRadius: radius,
278
- overflow: "hidden",
279
- position: "absolute",
280
- },
281
- });
@@ -1,14 +0,0 @@
1
- import styled from "styled-components/native";
2
- import { flexbox, space, border, color, layout } from "styled-system";
3
-
4
- export const ScrollView = styled.ScrollView.attrs(() => ({
5
- keyboardShouldPersistTaps: "handled",
6
- showsVerticalScrollIndicator: false,
7
- contentContainerStyle: { flexGrow: 1 },
8
- }))`
9
- ${flexbox}
10
- ${space}
11
- ${border}
12
- ${color}
13
- ${layout}
14
- `;
@@ -1,207 +0,0 @@
1
- import React, { useEffect, useRef, useState } from "react";
2
- import { Dimensions, TouchableWithoutFeedback, StyleSheet } from "react-native";
3
-
4
- import { Search } from "@bigbinary/neeto-icons-rn";
5
- import PropTypes from "prop-types";
6
- import Animated, {
7
- Easing,
8
- interpolate,
9
- useAnimatedStyle,
10
- useSharedValue,
11
- withTiming,
12
- } from "react-native-reanimated";
13
- import { moderateScale } from "react-native-size-matters";
14
- import styled from "styled-components/native";
15
- import {
16
- flexbox,
17
- space,
18
- border,
19
- buttonStyle,
20
- typography,
21
- color,
22
- } from "styled-system";
23
-
24
- import { Container, Touchable, Typography } from "@components";
25
- import { useDebounce } from "@hooks";
26
- import { theme } from "@theme";
27
-
28
- const TextInput = styled.TextInput`
29
- ${flexbox}
30
- ${space}
31
- ${border}
32
- ${buttonStyle}
33
- ${typography}
34
- ${color}
35
- `;
36
-
37
- /**
38
- * SearchBars are used to search or filter items.
39
- *
40
- * <div class="screenshots">
41
- * <img src="screenshots/searchbar/searchbar.png" />
42
- * </div>
43
- *
44
- * ## Usage
45
- * ```js
46
- * import * as React from 'react';
47
- * import { Container, SearchBar } from '@bigbinary/neetoui-rn';
48
- *
49
- * export default function Main() {
50
- * return (
51
- * <Container>
52
- * <SearchBar placeholder="Search" onChangeText={() => {}} />
53
- * </Container>
54
- * );
55
- * }
56
- * ```
57
- */
58
-
59
- const { width: screenWidth } = Dimensions.get("window");
60
- const buttonSize = moderateScale(screenWidth * 0.19);
61
-
62
- export const SearchBar = ({
63
- placeholder = "Search",
64
- onChangeText = () => {},
65
- onCancel = () => {},
66
- debounceDelay = 1000,
67
- showCancelButton = true,
68
- containerProps,
69
- searchbarProps,
70
- }) => {
71
- const inputRef = useRef();
72
- const [searchText, setSearchText] = useState("");
73
- const debouncedSearchTextValue = useDebounce(
74
- searchText.trim(),
75
- Number(debounceDelay)
76
- );
77
- const buttonWidth = useSharedValue(0);
78
- const buttonOpacity = useSharedValue(0);
79
-
80
- useEffect(() => {
81
- onChangeText(debouncedSearchTextValue);
82
- }, [debouncedSearchTextValue, onChangeText]);
83
-
84
- const animateSearchInput = val => {
85
- buttonWidth.value = withTiming(val, {
86
- easing: Easing.linear,
87
- duration: 200,
88
- });
89
-
90
- buttonOpacity.value = withTiming(val, {
91
- easing: Easing.linear,
92
- duration: 100,
93
- });
94
- };
95
-
96
- const cancelButtonStyle = useAnimatedStyle(() => ({
97
- width: interpolate(buttonWidth.value, [0, 1], [0, buttonSize]),
98
- opacity: buttonOpacity.value,
99
- }));
100
-
101
- const onCancelHandle = () => {
102
- animateSearchInput(0);
103
- setSearchText("");
104
- inputRef.current.blur();
105
- onCancel();
106
- };
107
-
108
- return (
109
- <Container alignItems="center" flexDirection="row">
110
- <TouchableWithoutFeedback
111
- onPress={() => {
112
- if (!inputRef?.current?.isFocused()) {
113
- inputRef?.current?.focus();
114
- }
115
- }}
116
- >
117
- <Container
118
- alignItems="center"
119
- borderColor={theme.colors.border.grey400}
120
- borderRadius={moderateScale(8)}
121
- borderWidth={moderateScale(1)}
122
- flex={1}
123
- flexDirection="row"
124
- height={moderateScale(42)}
125
- {...containerProps}
126
- >
127
- <Container px={moderateScale(8)}>
128
- <Search
129
- color={theme.colors.font.grey600}
130
- size={moderateScale(22)}
131
- />
132
- </Container>
133
- <TextInput
134
- autoCapitalize="none"
135
- color="font.primary"
136
- flex={1}
137
- fontSize={moderateScale(16)}
138
- padding={0}
139
- placeholder={placeholder}
140
- placeholderTextColor={theme.colors.font.grey600}
141
- ref={inputRef}
142
- returnKeyType="search"
143
- value={searchText}
144
- onChangeText={setSearchText}
145
- onBlur={() => {
146
- if (!searchText) animateSearchInput(0);
147
- }}
148
- onFocus={() => {
149
- animateSearchInput(1);
150
- }}
151
- {...searchbarProps}
152
- />
153
- </Container>
154
- </TouchableWithoutFeedback>
155
- {showCancelButton && (
156
- <Animated.View style={[styles.cancelButtonWrapper, cancelButtonStyle]}>
157
- <Touchable
158
- flexGrow={1}
159
- height={moderateScale(42)}
160
- justifyContent="center"
161
- px={moderateScale(8)}
162
- onPress={onCancelHandle}
163
- >
164
- <Typography fontFamily={theme.fonts.sf500} numberOfLines={1}>
165
- Cancel
166
- </Typography>
167
- </Touchable>
168
- </Animated.View>
169
- )}
170
- </Container>
171
- );
172
- };
173
-
174
- const styles = StyleSheet.create({
175
- cancelButtonWrapper: {
176
- alignItems: "flex-end",
177
- justifyContent: "center",
178
- },
179
- });
180
-
181
- SearchBar.propTypes = {
182
- /**
183
- * Set the placeholder text
184
- */
185
- placeholder: PropTypes.string,
186
- /**
187
- * Method to fire when text is changed
188
- */
189
- onChangeText: PropTypes.func.isRequired,
190
- /**
191
- * Takes numeric value which is used to set the debounce delay
192
- */
193
- debounceDelay: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
194
- /**
195
- * Takes an object and accepts all the props accepted by TextInput component from React Native.
196
- */
197
- searchbarProps: PropTypes.object,
198
- /**
199
- * Method called when the cancel button is pressed.
200
- */
201
- onCancel: PropTypes.func,
202
- /**
203
- * option to hide the cancel button. Default is true
204
- */
205
- showCancelButton: PropTypes.bool,
206
- containerProps: PropTypes.object,
207
- };
@@ -1,77 +0,0 @@
1
- import React, { useEffect } from "react";
2
- import { StyleSheet } from "react-native";
3
-
4
- import PropTypes from "prop-types";
5
- import Animated, {
6
- cancelAnimation,
7
- useAnimatedStyle,
8
- useSharedValue,
9
- withSpring,
10
- } from "react-native-reanimated";
11
- import { moderateScale } from "react-native-size-matters";
12
-
13
- import { theme } from "@theme";
14
-
15
- const springConfig = {
16
- mass: 1,
17
- overshootClamping: true,
18
- restSpeedThreshold: 0.5,
19
- restDisplacementThreshold: 0.5,
20
- };
21
-
22
- const spacing = moderateScale(6);
23
-
24
- export const Indicator = ({ measure }) => {
25
- const { x, width, height } = measure;
26
-
27
- const translateX = useSharedValue(0);
28
- const animatedWidth = useSharedValue(0);
29
-
30
- useEffect(() => {
31
- cancelAnimation(translateX);
32
- cancelAnimation(animatedWidth);
33
-
34
- translateX.value = withSpring(x + spacing / 2, springConfig);
35
- animatedWidth.value = withSpring(width - spacing, springConfig);
36
- }, [animatedWidth, translateX, width, x]);
37
-
38
- const tabTranslateAnimatedStyles = useAnimatedStyle(() => ({
39
- transform: [{ translateX: translateX.value }],
40
- width: animatedWidth.value,
41
- }));
42
-
43
- return (
44
- <Animated.View
45
- style={[
46
- styles.movingSegmentStyle,
47
- { height: height - spacing },
48
- tabTranslateAnimatedStyles,
49
- ]}
50
- />
51
- );
52
- };
53
-
54
- const styles = StyleSheet.create({
55
- movingSegmentStyle: {
56
- position: "absolute",
57
- top: spacing / 2,
58
- borderRadius: moderateScale(6),
59
- backgroundColor: theme.colors.background.primary,
60
- shadowColor: theme.colors.background.grey,
61
- shadowOffset: {
62
- width: 0,
63
- height: 5,
64
- },
65
- shadowOpacity: 0.34,
66
- shadowRadius: 6.27,
67
- elevation: 10,
68
- },
69
- });
70
-
71
- Indicator.propTypes = {
72
- measure: PropTypes.shape({
73
- x: PropTypes.number.isRequired,
74
- width: PropTypes.number.isRequired,
75
- height: PropTypes.number.isRequired,
76
- }).isRequired,
77
- };
@@ -1,37 +0,0 @@
1
- import React, { forwardRef, useCallback } from "react";
2
- import { View } from "react-native";
3
-
4
- import PropTypes from "prop-types";
5
-
6
- import { Typography, Touchable } from "@components";
7
-
8
- export const Tab = forwardRef(({ label, value, navigation, flex }, ref) => {
9
- const handleOnPress = useCallback(
10
- () => navigation.navigate(value),
11
- [navigation, value]
12
- );
13
-
14
- return (
15
- <View ref={ref} style={{ flex }}>
16
- <Touchable flex={1} justifyContent="center" onPress={handleOnPress}>
17
- <Typography
18
- fontFamily="sf500"
19
- fontSize="xs"
20
- numberOfLines={1}
21
- textAlign="center"
22
- >
23
- {label}
24
- </Typography>
25
- </Touchable>
26
- </View>
27
- );
28
- });
29
-
30
- Tab.displayName = "Tab";
31
-
32
- Tab.propTypes = {
33
- flex: PropTypes.number,
34
- label: PropTypes.string.isRequired,
35
- value: PropTypes.string.isRequired,
36
- navigation: PropTypes.object,
37
- };