@bigbinary/neetoui-rn 0.0.269 → 0.0.271

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 (125) hide show
  1. package/lib/components/Accordion.js +1 -1
  2. package/lib/components/ActionIcon.js +1 -1
  3. package/lib/components/Alert.js +1 -1
  4. package/lib/components/AnimatedImage.js +1 -1
  5. package/lib/components/Avatar.js +1 -1
  6. package/lib/components/Badge.js +1 -1
  7. package/lib/components/BottomSheet.js +1 -1
  8. package/lib/components/BottomTabBar.js +1 -1
  9. package/lib/components/Button.js +1 -1
  10. package/lib/components/ButtonGroup.js +1 -1
  11. package/lib/components/Calendar.js +1 -1
  12. package/lib/components/Card.js +1 -1
  13. package/lib/components/Carousel.js +1 -1
  14. package/lib/components/ChatInput/AttachmentsView.js +1 -1
  15. package/lib/components/ChatInput/Badge.js +1 -1
  16. package/lib/components/ChatInput/ChatInput.js +1 -1
  17. package/lib/components/ChatInput/EmailFields.js +1 -1
  18. package/lib/components/ChatInput/IconButton.js +1 -1
  19. package/lib/components/ChatInput/MentionsInputWrapper.js +1 -1
  20. package/lib/components/CheckBox.js +1 -1
  21. package/lib/components/Chip.js +1 -1
  22. package/lib/components/Container.js +1 -1
  23. package/lib/components/Divider.js +1 -1
  24. package/lib/components/FAB.js +1 -1
  25. package/lib/components/FlashList.js +1 -1
  26. package/lib/components/FlatList.js +1 -1
  27. package/lib/components/Input.js +1 -1
  28. package/lib/components/InputEmailChip.js +1 -1
  29. package/lib/components/LineLoader.js +1 -1
  30. package/lib/components/ListItem.js +1 -1
  31. package/lib/components/Loader.js +1 -1
  32. package/lib/components/MultiSelect.js +1 -1
  33. package/lib/components/NotificationIcon.js +1 -1
  34. package/lib/components/NotificationPreferenceList.js +1 -1
  35. package/lib/components/OnBoarding.js +1 -1
  36. package/lib/components/OrganizationItem.js +1 -1
  37. package/lib/components/OtpInputs.js +1 -1
  38. package/lib/components/ParentView.js +1 -1
  39. package/lib/components/Popover.js +1 -1
  40. package/lib/components/RadioButton.js +1 -1
  41. package/lib/components/RichTextEditor.js +1 -1
  42. package/lib/components/Ripple.js +1 -1
  43. package/lib/components/ScrollView.js +1 -1
  44. package/lib/components/SearchBar.js +1 -1
  45. package/lib/components/SegmentedTopBar/Indicator.js +1 -1
  46. package/lib/components/SegmentedTopBar/Tab.js +1 -1
  47. package/lib/components/SegmentedTopBar/index.js +1 -1
  48. package/lib/components/SocialButton.js +1 -1
  49. package/lib/components/Toast.js +1 -1
  50. package/lib/components/ToggleSwitch.js +1 -1
  51. package/lib/components/TopBar.js +1 -1
  52. package/lib/components/Touchable.js +1 -1
  53. package/lib/components/TouchableWithoutFeedback.js +1 -1
  54. package/lib/components/Typography.js +1 -1
  55. package/lib/components/index.js +1 -1
  56. package/lib/config/toasterConfig.js +1 -1
  57. package/lib/contexts/index.js +1 -1
  58. package/lib/theme/index.js +1 -1
  59. package/lib/utils/utils.js +1 -1
  60. package/package.json +22 -15
  61. package/src/components/Accordion.jsx +0 -266
  62. package/src/components/ActionIcon.jsx +0 -76
  63. package/src/components/Alert.jsx +0 -262
  64. package/src/components/AnimatedImage.jsx +0 -140
  65. package/src/components/Avatar.jsx +0 -144
  66. package/src/components/Badge.jsx +0 -97
  67. package/src/components/BottomSheet.jsx +0 -487
  68. package/src/components/BottomTabBar.jsx +0 -232
  69. package/src/components/Button.jsx +0 -275
  70. package/src/components/ButtonGroup.jsx +0 -120
  71. package/src/components/Calendar.jsx +0 -128
  72. package/src/components/Card.jsx +0 -90
  73. package/src/components/Carousel.jsx +0 -116
  74. package/src/components/ChatInput/AttachmentsView.jsx +0 -51
  75. package/src/components/ChatInput/Badge.jsx +0 -24
  76. package/src/components/ChatInput/ChatInput.jsx +0 -564
  77. package/src/components/ChatInput/EmailFields.jsx +0 -122
  78. package/src/components/ChatInput/IconButton.jsx +0 -34
  79. package/src/components/ChatInput/MentionsInputWrapper.jsx +0 -155
  80. package/src/components/CheckBox.jsx +0 -150
  81. package/src/components/Chip.jsx +0 -180
  82. package/src/components/Container.jsx +0 -31
  83. package/src/components/Divider.jsx +0 -79
  84. package/src/components/FAB.jsx +0 -113
  85. package/src/components/FlashList.jsx +0 -189
  86. package/src/components/FlatList.js +0 -10
  87. package/src/components/Input.jsx +0 -357
  88. package/src/components/InputEmailChip.jsx +0 -246
  89. package/src/components/LineLoader.jsx +0 -46
  90. package/src/components/ListItem.jsx +0 -68
  91. package/src/components/Loader.jsx +0 -122
  92. package/src/components/MultiSelect.jsx +0 -631
  93. package/src/components/NotificationIcon.jsx +0 -38
  94. package/src/components/NotificationPreferenceList.jsx +0 -208
  95. package/src/components/OnBoarding.jsx +0 -134
  96. package/src/components/OrganizationItem.jsx +0 -110
  97. package/src/components/OtpInputs.jsx +0 -194
  98. package/src/components/ParentView.jsx +0 -139
  99. package/src/components/Popover.jsx +0 -221
  100. package/src/components/RadioButton.jsx +0 -155
  101. package/src/components/RichTextEditor.jsx +0 -163
  102. package/src/components/Ripple.jsx +0 -281
  103. package/src/components/ScrollView.js +0 -14
  104. package/src/components/SearchBar.jsx +0 -207
  105. package/src/components/SegmentedTopBar/Indicator.jsx +0 -77
  106. package/src/components/SegmentedTopBar/Tab.jsx +0 -37
  107. package/src/components/SegmentedTopBar/index.jsx +0 -128
  108. package/src/components/SocialButton.jsx +0 -106
  109. package/src/components/Toast.jsx +0 -195
  110. package/src/components/ToggleSwitch.jsx +0 -112
  111. package/src/components/TopBar.jsx +0 -147
  112. package/src/components/Touchable.jsx +0 -133
  113. package/src/components/TouchableWithoutFeedback.jsx +0 -51
  114. package/src/components/Typography.jsx +0 -93
  115. package/src/components/index.js +0 -45
  116. package/src/config/index.js +0 -1
  117. package/src/config/toasterConfig.jsx +0 -142
  118. package/src/contexts/index.js +0 -3
  119. package/src/hooks/index.js +0 -3
  120. package/src/hooks/useDebounce.js +0 -17
  121. package/src/hooks/useKeyboard.js +0 -33
  122. package/src/hooks/useRefreshByUser.js +0 -20
  123. package/src/index.js +0 -2
  124. package/src/theme/index.js +0 -181
  125. package/src/utils/utils.js +0 -56
@@ -1,246 +0,0 @@
1
- import React, { useContext, useRef, useState } from "react";
2
- import { Platform, StyleSheet, TextInput } from "react-native";
3
-
4
- import PropTypes from "prop-types";
5
- import { moderateScale } from "react-native-size-matters";
6
- import { ThemeContext } from "styled-components/native";
7
-
8
- import { Container, Chip, Input, Typography } from "@components";
9
-
10
- import { endsWithChars, trimChars, isValidEmail } from "../utils/utils";
11
-
12
- const gap = moderateScale(4);
13
-
14
- const chipWrapperStyle = {
15
- pt: gap,
16
- };
17
-
18
- const getChipContainerStyle = isReadyForDeletion => ({
19
- borderColor: isReadyForDeletion ? "border.danger" : "border.grey200",
20
- });
21
-
22
- export const InputEmailChip = ({
23
- disabled,
24
- label,
25
- emails = [],
26
- onUpdate,
27
- delimiters = [" ", ","],
28
- ...rest
29
- }) => {
30
- const theme = useContext(ThemeContext);
31
- const inputRef = useRef();
32
-
33
- const [textValue, setTextValue] = useState("");
34
- const [shouldShowInput, setShouldShowInput] = useState(false);
35
- const [emailIndexForDeletion, setEmailIndexForDeletion] = useState(-1);
36
-
37
- const handleKeyPress = event => {
38
- const { key } = event.nativeEvent || {};
39
-
40
- if (!(textValue === "" && key === "Backspace" && emails.length > 0)) return;
41
-
42
- if (emailIndexForDeletion === -1) {
43
- setEmailIndexForDeletion(emails.length - 1);
44
- } else {
45
- removeEmail({ lastOne: true });
46
- setEmailIndexForDeletion(-1);
47
- }
48
- };
49
-
50
- const handleSubmitEditing = event => {
51
- const { text } = event.nativeEvent || {};
52
- setEmailIndexForDeletion(-1);
53
- checkAndUpdateEmails(text);
54
- };
55
-
56
- const handleTextChange = text => {
57
- if (!endsWithChars(text, delimiters)) {
58
- setEmailIndexForDeletion(-1);
59
- setTextValue(text);
60
-
61
- return;
62
- }
63
-
64
- checkAndUpdateEmails(text);
65
- };
66
-
67
- const handleInputTouchStart = () => setEmailIndexForDeletion(-1);
68
-
69
- const handleTouchStart = () => {
70
- if (!inputRef.current?.isFocused()) {
71
- inputRef.current?.focus();
72
- }
73
- };
74
-
75
- const handleOnFocus = () => setShouldShowInput(true);
76
-
77
- const handleOnBlur = () => {
78
- if (textValue.trim() === "") {
79
- setShouldShowInput(false);
80
- }
81
- };
82
-
83
- const handleOnEndEditing = event => {
84
- checkAndUpdateEmails(event.nativeEvent.text);
85
- };
86
-
87
- const checkAndUpdateEmails = text => {
88
- const emailCandidate = trimChars(text, delimiters);
89
-
90
- if (
91
- emailCandidate !== "" && // Non empty email
92
- isValidEmail(emailCandidate) && // Valid email
93
- !emails.includes(emailCandidate) // Unique email
94
- ) {
95
- const _emails = [...emails, emailCandidate];
96
- setTextValue("");
97
- onUpdate && onUpdate(_emails);
98
- } else {
99
- setTextValue(text);
100
- }
101
- };
102
-
103
- const removeEmail = ({ email, lastOne = false }) => {
104
- const indexOfEmail = lastOne ? emails.length - 1 : emails.indexOf(email);
105
-
106
- if (indexOfEmail !== -1) {
107
- const _emails = [...emails];
108
- _emails.splice(indexOfEmail, 1);
109
- onUpdate && onUpdate(_emails);
110
- }
111
- };
112
-
113
- const inputProps = {
114
- autoCorrect: false,
115
- fontSize: "xs",
116
- returnKeyType: "done",
117
- autoCapitalize: "none",
118
- keyboardType: "email-address",
119
- padding: 0,
120
- minHeight: moderateScale(26),
121
- selectionColor:
122
- emailIndexForDeletion === -1 ? theme.colors.font.base : "transparent",
123
- };
124
-
125
- return (
126
- <Container
127
- flexDirection="row"
128
- minHeight={moderateScale(30)}
129
- py={moderateScale(2)}
130
- width="100%"
131
- {...rest}
132
- >
133
- {!!label && (
134
- <Typography
135
- color={disabled ? "font.grey400" : "font.grey600"}
136
- fontSize="xs"
137
- textAlign="left"
138
- width={moderateScale(40)}
139
- mt={Platform.select({
140
- android: moderateScale(10),
141
- ios: moderateScale(8),
142
- })}
143
- >
144
- {label}
145
- </Typography>
146
- )}
147
- <Container
148
- alignItems="center"
149
- flex={1}
150
- flexDirection="row"
151
- flexWrap="wrap"
152
- >
153
- {emails.map((email, index) => (
154
- <Container key={email} {...chipWrapperStyle}>
155
- <Chip
156
- isDisabled={disabled}
157
- label={email}
158
- containerStyle={{
159
- ...getChipContainerStyle(index === emailIndexForDeletion),
160
- height: moderateScale(25),
161
- }}
162
- onClose={disabled ? null : () => removeEmail({ email })}
163
- />
164
- </Container>
165
- ))}
166
- {!disabled && (
167
- <Container
168
- alignItems="center"
169
- flex={1}
170
- justifyContent="center"
171
- minWidth={moderateScale(160)}
172
- paddingTop={Platform.select({
173
- ios: gap,
174
- android: moderateScale(7),
175
- })}
176
- {...(shouldShowInput || emails.length === 0 ? {} : { height: 0 })}
177
- >
178
- <Input
179
- noBorder
180
- disabled={disabled}
181
- value={textValue}
182
- containerProps={{
183
- borderRadius: 0,
184
- }}
185
- inputProps={{
186
- ...inputProps,
187
- ref: inputRef,
188
- onKeyPress: handleKeyPress,
189
- onSubmitEditing: handleSubmitEditing,
190
- onTouchStart: handleInputTouchStart,
191
- onFocus: handleOnFocus,
192
- onBlur: handleOnBlur,
193
- onEndEditing: handleOnEndEditing,
194
- borderBottomWidth: moderateScale(2),
195
- borderColor: "background.grey200",
196
- }}
197
- onChangeText={handleTextChange}
198
- />
199
- </Container>
200
- )}
201
- </Container>
202
- {!disabled && (
203
- <TextInput
204
- editable={false}
205
- pointerEvents={shouldShowInput ? "box-none" : "auto"}
206
- style={styles.touchableTextInputWrapper}
207
- onTouchStart={handleTouchStart}
208
- />
209
- )}
210
- </Container>
211
- );
212
- };
213
-
214
- const styles = StyleSheet.create({
215
- touchableTextInputWrapper: {
216
- position: "absolute",
217
- top: 0,
218
- bottom: 0,
219
- left: 0,
220
- right: 0,
221
- },
222
- });
223
-
224
- InputEmailChip.propTypes = {
225
- /**
226
- * Disable input component
227
- */
228
- disabled: PropTypes.bool,
229
- /**
230
- * Label for the input field
231
- */
232
- label: PropTypes.string,
233
- /**
234
- * Array of emails to be set
235
- */
236
- emails: PropTypes.arrayOf(PropTypes.string),
237
- /**
238
- * Characters to be used for separating emails while entering
239
- * By default `,`, ` ` and enter/done triggers chip creation for the entered email.
240
- */
241
- delimiters: PropTypes.arrayOf(PropTypes.string),
242
- /**
243
- * Callback containing the emails. It is triggered when an email is added or removed.
244
- */
245
- onUpdate: PropTypes.func,
246
- };
@@ -1,46 +0,0 @@
1
- import React from "react";
2
-
3
- import PropTypes from "prop-types";
4
- import ContentLoader, { Rect } from "react-content-loader/native";
5
- import { moderateScale } from "react-native-size-matters";
6
-
7
- import { theme } from "../theme";
8
-
9
- export const LineLoader = ({
10
- isLoading,
11
- backgroundColor = theme.colors.background.primary,
12
- foregroundColor = theme.colors.background.base,
13
- height = moderateScale(3),
14
- }) => (
15
- <ContentLoader
16
- animate={isLoading}
17
- backgroundColor={backgroundColor}
18
- foregroundColor={foregroundColor}
19
- height={height}
20
- interval={0}
21
- key={isLoading}
22
- speed={1}
23
- width="100%"
24
- >
25
- <Rect height={height} width="100%" x={0} y={0} />
26
- </ContentLoader>
27
- );
28
-
29
- LineLoader.propTypes = {
30
- /**
31
- * Shows loader when true.
32
- */
33
- isLoading: PropTypes.bool,
34
- /**
35
- * Custom background color of loader.
36
- */
37
- backgroundColor: PropTypes.string,
38
- /**
39
- * Custom foreground color of loader.
40
- */
41
- foregroundColor: PropTypes.string,
42
- /**
43
- * Height of loader.
44
- */
45
- height: PropTypes.number,
46
- };
@@ -1,68 +0,0 @@
1
- import * as React from "react";
2
-
3
- import propTypes from "@styled-system/prop-types";
4
- import PropTypes from "prop-types";
5
- import { moderateScale } from "react-native-size-matters";
6
-
7
- import { Typography, Container } from "@components";
8
-
9
- /**
10
- * ListItems are components that displays a label with different values like string, toggle, button etc.
11
- *
12
- * <div class="screenshots">
13
- * <img src="screenshots/listitem/listItemStyles.png" />
14
- * </div>
15
- *
16
- * ## Usage
17
- * ```js
18
- * import * as React from 'react';
19
- * import { Container, ListItem, Typography } from '@bigbinary/neetoui-rn';
20
- *
21
- * export default function Main() {
22
- * return (
23
- * <Container>
24
- * <ListItem
25
- * LeftComponent={() => <Typography mr={moderateScale(2)}>📣</Typography>}
26
- * label="Organization"
27
- * value={() => <Typography>Bigbinary</Typography>}
28
- * />
29
- * </Container>
30
- * );
31
- * }
32
- * ```
33
- */
34
-
35
- export const ListItem = ({ LeftComponent, label, RightComponent, ...rest }) => (
36
- <Container
37
- alignItems="center"
38
- bg="background.secondary"
39
- borderRadius={moderateScale(6)}
40
- flexDirection="row"
41
- justifyContent="space-between"
42
- px={moderateScale(16)}
43
- py={moderateScale(12)}
44
- width="100%"
45
- {...rest}
46
- >
47
- <Container alignItems="center" flexDirection="row" width="50%">
48
- {LeftComponent && <LeftComponent />}
49
- <Typography color="font.grey800" fontFamily="sf500" fontSize="l">
50
- {label}
51
- </Typography>
52
- </Container>
53
- <Container alignItems="flex-end" width="50%">
54
- <RightComponent />
55
- </Container>
56
- </Container>
57
- );
58
-
59
- ListItem.propTypes = {
60
- ...propTypes.flexbox,
61
- ...propTypes.space,
62
- ...propTypes.border,
63
- ...propTypes.color,
64
- ...propTypes.layout,
65
- LeftComponent: PropTypes.elementType,
66
- label: PropTypes.string.isRequired,
67
- RightComponent: PropTypes.elementType.isRequired,
68
- };
@@ -1,122 +0,0 @@
1
- import React, { useEffect } from "react";
2
-
3
- import PropTypes from "prop-types";
4
- import Animated, {
5
- useSharedValue,
6
- withTiming,
7
- useAnimatedProps,
8
- withRepeat,
9
- Easing,
10
- useAnimatedStyle,
11
- interpolate,
12
- } from "react-native-reanimated";
13
- import { moderateScale } from "react-native-size-matters";
14
- import Svg, { Circle } from "react-native-svg";
15
-
16
- import { Container } from "@components";
17
- import { theme } from "@theme";
18
-
19
- // eslint-disable-next-line @bigbinary/neeto/no-dangling-constants
20
- const LOADER_WIDTH = {
21
- s: parseInt(moderateScale(18)),
22
- m: parseInt(moderateScale(24)),
23
- l: parseInt(moderateScale(36)),
24
- };
25
-
26
- const AnimatedCircle = Animated.createAnimatedComponent(Circle);
27
-
28
- /**
29
- ** Component is used to show a loading indication to user.
30
- *
31
- * * <div class="screenshots">
32
- * <img src="screenshots/loaders/loaders.png" />
33
- * </div>
34
- *
35
- * ## Usage
36
- * ```js
37
- * import * as React from 'react';
38
- * import { Container, Loader } from '@bigbinary/neetoui-rn';
39
- * export default function Main() {
40
- * return (
41
- * <Container>
42
- * <Loader size='l'/>
43
- * </Container>
44
- * )
45
- * }
46
- * ```
47
- *
48
- */
49
-
50
- export const Loader = ({ color, size }) => {
51
- const progress = useSharedValue(0);
52
- const width = LOADER_WIDTH[size];
53
- const stroke_width = width * 0.15;
54
- const radius = (width - stroke_width) / 2;
55
- const circumference = 2 * Math.PI * radius;
56
-
57
- useEffect(() => {
58
- progress.value = withRepeat(
59
- withTiming(2, {
60
- duration: 1500,
61
- easing: Easing.linear,
62
- }),
63
- -1,
64
- false
65
- );
66
- }, []);
67
-
68
- const animatedProps = useAnimatedProps(() => ({
69
- strokeDashoffset: -interpolate(
70
- progress.value,
71
- [0, 1, 2],
72
- [0, circumference, circumference * 2]
73
- ),
74
- }));
75
-
76
- const animatedStyles = useAnimatedStyle(() => {
77
- const scale = interpolate(progress.value, [0, 2], [0, 420]);
78
-
79
- return {
80
- width,
81
- height: width,
82
- alignItems: "center",
83
- justifyContent: "center",
84
- transform: [{ rotate: `${scale}deg` }],
85
- };
86
- });
87
-
88
- return (
89
- <Container alignItems="center" justifyContent="center">
90
- <Animated.View style={animatedStyles}>
91
- <Svg height={width} width={width}>
92
- <AnimatedCircle
93
- animatedProps={animatedProps}
94
- cx={width / 2}
95
- cy={width / 2}
96
- r={radius}
97
- stroke={color}
98
- strokeDasharray={circumference}
99
- strokeLinecap="round"
100
- strokeWidth={stroke_width}
101
- />
102
- </Svg>
103
- </Animated.View>
104
- </Container>
105
- );
106
- };
107
-
108
- Loader.propTypes = {
109
- /**
110
- * Size variant to select the width of the loader.
111
- */
112
- size: PropTypes.oneOf(["s", "m", "l"]),
113
- /**
114
- * Color variant to select the color from the available options.
115
- */
116
- color: PropTypes.string,
117
- };
118
-
119
- Loader.defaultProps = {
120
- size: "s",
121
- color: theme.colors.background.lightBlue400,
122
- };