@bigbinary/neetoui-rn 0.0.223 → 0.0.225
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/lib/components/Accordion.js +1 -1
- package/lib/components/Alert.js +1 -1
- package/lib/components/AnimatedImage.js +1 -1
- package/lib/components/Avatar.js +1 -1
- package/lib/components/Badge.js +1 -1
- package/lib/components/BottomSheet.js +1 -1
- package/lib/components/BottomTabBar.js +1 -1
- package/lib/components/Button.js +1 -1
- package/lib/components/ButtonGroup.js +1 -1
- package/lib/components/Calendar.js +1 -1
- package/lib/components/Card.js +1 -1
- package/lib/components/Carousel.js +1 -1
- package/lib/components/CheckBox.js +1 -1
- package/lib/components/Chip.js +1 -1
- package/lib/components/Container.js +1 -1
- package/lib/components/Divider.js +1 -1
- package/lib/components/FAB.js +1 -1
- package/lib/components/FlashList.js +1 -1
- package/lib/components/FlatList.js +1 -1
- package/lib/components/Input.js +1 -1
- package/lib/components/ListItem.js +1 -1
- package/lib/components/Loader.js +1 -1
- package/lib/components/MultiSelect.js +1 -1
- package/lib/components/NotificationPreferenceList.js +1 -1
- package/lib/components/OnBoarding.js +1 -1
- package/lib/components/OrganizationItem.js +1 -1
- package/lib/components/OtpInputs.js +1 -1
- package/lib/components/ParentView.js +1 -1
- package/lib/components/Popover.js +1 -1
- package/lib/components/RadioButton.js +1 -1
- package/lib/components/RichTextEditor.js +1 -1
- package/lib/components/ScrollView.js +1 -1
- package/lib/components/SearchBar.js +1 -1
- package/lib/components/SegmentedTopBar.js +1 -1
- package/lib/components/Select.js +1 -1
- package/lib/components/SocialButton.js +1 -1
- package/lib/components/Toast.js +1 -1
- package/lib/components/ToggleSwitch.js +1 -1
- package/lib/components/TopBar.js +1 -1
- package/lib/components/Touchable.js +1 -1
- package/lib/components/Typography.js +1 -1
- package/lib/config/toasterConfig.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +10 -7
- package/src/components/{Accordion.js → Accordion.jsx} +11 -12
- package/src/components/{Alert.js → Alert.jsx} +30 -29
- package/src/components/{AnimatedImage.js → AnimatedImage.jsx} +52 -55
- package/src/components/{Avatar.js → Avatar.jsx} +36 -39
- package/src/components/{Badge.js → Badge.jsx} +19 -20
- package/src/components/{BottomSheet.js → BottomSheet.jsx} +81 -87
- package/src/components/{BottomTabBar.js → BottomTabBar.jsx} +71 -77
- package/src/components/{Button.js → Button.jsx} +18 -15
- package/src/components/{ButtonGroup.js → ButtonGroup.jsx} +35 -38
- package/src/components/{Calendar.js → Calendar.jsx} +3 -2
- package/src/components/{Card.js → Card.jsx} +5 -2
- package/src/components/{Carousel.js → Carousel.jsx} +6 -6
- package/src/components/{CheckBox.js → CheckBox.jsx} +12 -8
- package/src/components/{Chip.js → Chip.jsx} +30 -31
- package/src/components/{Container.js → Container.jsx} +6 -5
- package/src/components/{Divider.js → Divider.jsx} +3 -2
- package/src/components/{FAB.js → FAB.jsx} +3 -2
- package/src/components/{FlashList.js → FlashList.jsx} +54 -53
- package/src/components/FlatList.js +1 -1
- package/src/components/{Input.js → Input.jsx} +43 -43
- package/src/components/{ListItem.js → ListItem.jsx} +24 -25
- package/src/components/{Loader.js → Loader.jsx} +11 -9
- package/src/components/{MultiSelect.js → MultiSelect.jsx} +62 -68
- package/src/components/{NotificationPreferenceList.js → NotificationPreferenceList.jsx} +43 -43
- package/src/components/{OnBoarding.js → OnBoarding.jsx} +24 -27
- package/src/components/OrganizationItem.jsx +107 -0
- package/src/components/{OtpInputs.js → OtpInputs.jsx} +35 -34
- package/src/components/{ParentView.js → ParentView.jsx} +5 -3
- package/src/components/{Popover.js → Popover.jsx} +21 -22
- package/src/components/{RadioButton.js → RadioButton.jsx} +10 -6
- package/src/components/{RichTextEditor.js → RichTextEditor.jsx} +32 -34
- package/src/components/ScrollView.js +1 -1
- package/src/components/{SearchBar.js → SearchBar.jsx} +22 -22
- package/src/components/{SegmentedTopBar.js → SegmentedTopBar.jsx} +15 -17
- package/src/components/{Select.js → Select.jsx} +33 -30
- package/src/components/{SocialButton.js → SocialButton.jsx} +9 -8
- package/src/components/{Toast.js → Toast.jsx} +25 -22
- package/src/components/{ToggleSwitch.js → ToggleSwitch.jsx} +12 -11
- package/src/components/{TopBar.js → TopBar.jsx} +4 -4
- package/src/components/{Touchable.js → Touchable.jsx} +9 -4
- package/src/components/{Typography.js → Typography.jsx} +6 -5
- package/src/config/{toasterConfig.js → toasterConfig.jsx} +23 -24
- package/src/hooks/useDebounce.js +1 -0
- package/src/hooks/useKeyboard.js +1 -0
- package/src/index.js +2 -2
- package/src/theme/index.js +1 -1
- package/src/utils/utils.js +2 -1
- package/src/components/OrganizationItem.js +0 -116
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
/* eslint-disable react/display-name */
|
|
2
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 styled, { ThemeContext } from "styled-components/native";
|
|
3
14
|
import {
|
|
4
15
|
flexbox,
|
|
5
16
|
space,
|
|
@@ -12,19 +23,10 @@ import {
|
|
|
12
23
|
system,
|
|
13
24
|
position,
|
|
14
25
|
} from "styled-system";
|
|
15
|
-
|
|
16
|
-
Animated,
|
|
17
|
-
InputAccessoryView,
|
|
18
|
-
Keyboard,
|
|
19
|
-
StyleSheet,
|
|
20
|
-
useWindowDimensions,
|
|
21
|
-
Platform,
|
|
22
|
-
TouchableWithoutFeedback,
|
|
23
|
-
} from "react-native";
|
|
24
|
-
import styled, { ThemeContext } from "styled-components/native";
|
|
25
|
-
import PropTypes from "prop-types";
|
|
26
|
+
|
|
26
27
|
import { Button, Container } from "@components";
|
|
27
|
-
|
|
28
|
+
|
|
29
|
+
import { theme } from "../theme";
|
|
28
30
|
|
|
29
31
|
const TextInput = styled.TextInput`
|
|
30
32
|
${flexbox}
|
|
@@ -122,7 +124,6 @@ export const Input = ({
|
|
|
122
124
|
} else {
|
|
123
125
|
handleLabelAnimation(false);
|
|
124
126
|
}
|
|
125
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
126
127
|
}, [autoFocus]);
|
|
127
128
|
|
|
128
129
|
useEffect(() => {
|
|
@@ -133,7 +134,6 @@ export const Input = ({
|
|
|
133
134
|
} else {
|
|
134
135
|
handleLabelAnimation(false);
|
|
135
136
|
}
|
|
136
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
137
137
|
}, [value]);
|
|
138
138
|
|
|
139
139
|
const handleLabelAnimation = isFocused => {
|
|
@@ -162,7 +162,6 @@ export const Input = ({
|
|
|
162
162
|
: colors.border.grey400,
|
|
163
163
|
borderWidth: errorMessage || isFocused ? 1.5 : 1,
|
|
164
164
|
});
|
|
165
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
166
165
|
}, []);
|
|
167
166
|
|
|
168
167
|
const labelStyles = {
|
|
@@ -179,6 +178,7 @@ export const Input = ({
|
|
|
179
178
|
const handleFocusBlur = isFocused => {
|
|
180
179
|
if (label) {
|
|
181
180
|
if (!value) handleLabelAnimation(isFocused);
|
|
181
|
+
|
|
182
182
|
if (!noBorder) handleStyles(isFocused);
|
|
183
183
|
}
|
|
184
184
|
};
|
|
@@ -193,13 +193,13 @@ export const Input = ({
|
|
|
193
193
|
}}
|
|
194
194
|
>
|
|
195
195
|
<View
|
|
196
|
-
|
|
196
|
+
alignItems="center"
|
|
197
|
+
borderColor={errorMessage ? "border.danger" : "border.grey400"}
|
|
197
198
|
borderRadius={8}
|
|
198
199
|
borderWidth={noBorder ? 0 : 1}
|
|
199
|
-
borderColor={errorMessage ? "border.danger" : "border.grey400"}
|
|
200
|
-
alignItems="center"
|
|
201
200
|
flexDirection="row"
|
|
202
201
|
justifyContent="space-between"
|
|
202
|
+
ref={containerRef}
|
|
203
203
|
{...(!rest.inputProps?.multiline && { height: 58 })}
|
|
204
204
|
overflow="hidden"
|
|
205
205
|
{...containerProps}
|
|
@@ -214,37 +214,37 @@ export const Input = ({
|
|
|
214
214
|
<AnimatedLabel
|
|
215
215
|
color={disabled ? "font.grey400" : "font.grey600"}
|
|
216
216
|
position="absolute"
|
|
217
|
-
zIndex={1}
|
|
218
217
|
style={labelStyles}
|
|
218
|
+
zIndex={1}
|
|
219
219
|
>
|
|
220
220
|
{label}
|
|
221
221
|
</AnimatedLabel>
|
|
222
222
|
)}
|
|
223
223
|
<TextInput
|
|
224
|
-
|
|
225
|
-
value={value}
|
|
226
|
-
returnKeyType={rest.inputProps?.multiline ? "default" : "done"}
|
|
227
|
-
onChangeText={onChangeText}
|
|
224
|
+
autoCapitalize="none"
|
|
228
225
|
autoFocus={autoFocus}
|
|
229
|
-
editable={!disabled}
|
|
230
|
-
onFocus={() => {
|
|
231
|
-
handleFocusBlur(true);
|
|
232
|
-
}}
|
|
233
|
-
onBlur={() => {
|
|
234
|
-
onBlur();
|
|
235
|
-
handleFocusBlur(false);
|
|
236
|
-
}}
|
|
237
|
-
inputAccessoryViewID={label}
|
|
238
226
|
color={disabled ? "font.grey500" : "font.primary"}
|
|
227
|
+
editable={!disabled}
|
|
239
228
|
fontSize={17}
|
|
240
|
-
|
|
241
|
-
top={0}
|
|
242
|
-
zIndex={2}
|
|
243
|
-
autoCapitalize="none"
|
|
229
|
+
inputAccessoryViewID={label}
|
|
244
230
|
mt={10}
|
|
245
231
|
pb={3}
|
|
232
|
+
pr={3}
|
|
246
233
|
pt={1}
|
|
234
|
+
ref={inputRef}
|
|
235
|
+
returnKeyType={rest.inputProps?.multiline ? "default" : "done"}
|
|
247
236
|
textAlignVertical={textAlignVertical}
|
|
237
|
+
top={0}
|
|
238
|
+
value={value}
|
|
239
|
+
zIndex={2}
|
|
240
|
+
onChangeText={onChangeText}
|
|
241
|
+
onBlur={() => {
|
|
242
|
+
onBlur();
|
|
243
|
+
handleFocusBlur(false);
|
|
244
|
+
}}
|
|
245
|
+
onFocus={() => {
|
|
246
|
+
handleFocusBlur(true);
|
|
247
|
+
}}
|
|
248
248
|
{...rest.inputProps}
|
|
249
249
|
/>
|
|
250
250
|
{rest.inputProps?.multiline &&
|
|
@@ -252,23 +252,23 @@ export const Input = ({
|
|
|
252
252
|
Platform.OS === "ios" && (
|
|
253
253
|
<InputAccessoryView nativeID={label}>
|
|
254
254
|
<Container
|
|
255
|
+
alignItems="center"
|
|
255
256
|
bg="background.white"
|
|
256
257
|
flexDirection="row"
|
|
257
|
-
p={2}
|
|
258
|
-
width={width}
|
|
259
258
|
justifyContent="flex-end"
|
|
260
|
-
|
|
259
|
+
p={2}
|
|
261
260
|
pr={20}
|
|
261
|
+
width={width}
|
|
262
262
|
>
|
|
263
263
|
<Button
|
|
264
264
|
height={30}
|
|
265
|
-
|
|
265
|
+
label="Done"
|
|
266
266
|
labelStyle={styles.doneButtonStyle}
|
|
267
|
+
left={10}
|
|
267
268
|
variant="text"
|
|
268
269
|
onPress={() => {
|
|
269
270
|
Keyboard.dismiss();
|
|
270
271
|
}}
|
|
271
|
-
label="Done"
|
|
272
272
|
/>
|
|
273
273
|
</Container>
|
|
274
274
|
</InputAccessoryView>
|
|
@@ -282,7 +282,7 @@ export const Input = ({
|
|
|
282
282
|
</View>
|
|
283
283
|
</TouchableWithoutFeedback>
|
|
284
284
|
{!!errorMessage && (
|
|
285
|
-
<Typography
|
|
285
|
+
<Typography color="font.danger" pt={2}>
|
|
286
286
|
{errorMessage}
|
|
287
287
|
</Typography>
|
|
288
288
|
)}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import propTypes from "@styled-system/prop-types";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
4
5
|
|
|
5
6
|
import { Typography, Container } from "@components";
|
|
6
7
|
|
|
@@ -30,31 +31,29 @@ import { Typography, Container } from "@components";
|
|
|
30
31
|
* ```
|
|
31
32
|
*/
|
|
32
33
|
|
|
33
|
-
export const ListItem = ({ LeftComponent, label, RightComponent, ...rest }) =>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
</Typography>
|
|
51
|
-
</Container>
|
|
52
|
-
<Container width="50%" alignItems="flex-end">
|
|
53
|
-
<RightComponent />
|
|
54
|
-
</Container>
|
|
34
|
+
export const ListItem = ({ LeftComponent, label, RightComponent, ...rest }) => (
|
|
35
|
+
<Container
|
|
36
|
+
alignItems="center"
|
|
37
|
+
bg="background.secondary"
|
|
38
|
+
borderRadius={6}
|
|
39
|
+
flexDirection="row"
|
|
40
|
+
justifyContent="space-between"
|
|
41
|
+
px={16}
|
|
42
|
+
py={12}
|
|
43
|
+
width="100%"
|
|
44
|
+
{...rest}
|
|
45
|
+
>
|
|
46
|
+
<Container alignItems="center" flexDirection="row" width="50%">
|
|
47
|
+
{LeftComponent && <LeftComponent />}
|
|
48
|
+
<Typography color="font.grey800" fontFamily="sf500" fontSize="l">
|
|
49
|
+
{label}
|
|
50
|
+
</Typography>
|
|
55
51
|
</Container>
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
<Container alignItems="flex-end" width="50%">
|
|
53
|
+
<RightComponent />
|
|
54
|
+
</Container>
|
|
55
|
+
</Container>
|
|
56
|
+
);
|
|
58
57
|
|
|
59
58
|
ListItem.propTypes = {
|
|
60
59
|
...propTypes.flexbox,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* eslint-disable @bigbinary/neeto/no-dangling-constants */
|
|
2
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
3
1
|
import React, { useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
4
|
import Animated, {
|
|
5
5
|
useSharedValue,
|
|
6
6
|
withTiming,
|
|
@@ -11,10 +11,11 @@ import Animated, {
|
|
|
11
11
|
interpolate,
|
|
12
12
|
} from "react-native-reanimated";
|
|
13
13
|
import Svg, { Circle } from "react-native-svg";
|
|
14
|
-
|
|
15
|
-
import { theme } from "@theme";
|
|
14
|
+
|
|
16
15
|
import { Container } from "@components";
|
|
16
|
+
import { theme } from "@theme";
|
|
17
17
|
|
|
18
|
+
// eslint-disable-next-line @bigbinary/neeto/no-dangling-constants
|
|
18
19
|
const LOADER_WIDTH = {
|
|
19
20
|
s: 24,
|
|
20
21
|
m: 36,
|
|
@@ -73,28 +74,29 @@ export const Loader = ({ color, size }) => {
|
|
|
73
74
|
|
|
74
75
|
const animatedStyles = useAnimatedStyle(() => {
|
|
75
76
|
const scale = interpolate(progress.value, [0, 2], [0, 420]);
|
|
77
|
+
|
|
76
78
|
return {
|
|
77
|
-
width
|
|
79
|
+
width,
|
|
78
80
|
height: width,
|
|
79
81
|
alignItems: "center",
|
|
80
82
|
justifyContent: "center",
|
|
81
|
-
transform: [{ rotate: scale
|
|
83
|
+
transform: [{ rotate: `${scale}deg` }],
|
|
82
84
|
};
|
|
83
85
|
});
|
|
84
86
|
|
|
85
87
|
return (
|
|
86
88
|
<Container alignItems="center" justifyContent="center">
|
|
87
89
|
<Animated.View style={animatedStyles}>
|
|
88
|
-
<Svg
|
|
90
|
+
<Svg height={width} width={width}>
|
|
89
91
|
<AnimatedCircle
|
|
92
|
+
animatedProps={animatedProps}
|
|
90
93
|
cx={width / 2}
|
|
91
94
|
cy={width / 2}
|
|
92
95
|
r={radius}
|
|
93
|
-
strokeWidth={stroke_width}
|
|
94
96
|
stroke={color}
|
|
95
97
|
strokeDasharray={circumference}
|
|
96
|
-
animatedProps={animatedProps}
|
|
97
98
|
strokeLinecap="round"
|
|
99
|
+
strokeWidth={stroke_width}
|
|
98
100
|
/>
|
|
99
101
|
</Svg>
|
|
100
102
|
</Animated.View>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/* eslint-disable react-native/no-inline-styles */
|
|
2
1
|
import React, { useContext, useEffect, useState } from "react";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
2
|
import { Keyboard, TouchableWithoutFeedback } from "react-native";
|
|
3
|
+
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
5
|
import Animated, {
|
|
6
6
|
interpolate,
|
|
7
7
|
useAnimatedStyle,
|
|
@@ -80,21 +80,21 @@ const MultiSelectItem = ({
|
|
|
80
80
|
|
|
81
81
|
return (
|
|
82
82
|
<Container
|
|
83
|
+
alignItems="center"
|
|
83
84
|
bg="background.secondary"
|
|
84
85
|
borderRadius={12}
|
|
85
86
|
flexDirection="row"
|
|
86
|
-
alignItems="center"
|
|
87
87
|
justifyContent="space-between"
|
|
88
|
+
m={1}
|
|
88
89
|
px={2}
|
|
89
90
|
py={1}
|
|
90
|
-
m={1}
|
|
91
91
|
{...multiSelectedItemContainerStyle}
|
|
92
92
|
>
|
|
93
93
|
<Typography
|
|
94
|
+
color="font.grey800"
|
|
94
95
|
fontFamily="sf400"
|
|
95
96
|
fontSize="s"
|
|
96
97
|
mr={2}
|
|
97
|
-
color="font.grey800"
|
|
98
98
|
{...multiSelectedItemLabelStyle}
|
|
99
99
|
>
|
|
100
100
|
{label}
|
|
@@ -105,9 +105,9 @@ const MultiSelectItem = ({
|
|
|
105
105
|
onPress={handleItemUnSelection}
|
|
106
106
|
>
|
|
107
107
|
<Icon
|
|
108
|
+
color={theme.colors.font.grey800}
|
|
108
109
|
name="ri-close-line"
|
|
109
110
|
size="20"
|
|
110
|
-
color={theme.colors.font.grey800}
|
|
111
111
|
/>
|
|
112
112
|
</TouchableWithoutFeedback>
|
|
113
113
|
)}
|
|
@@ -222,11 +222,13 @@ export const MultiSelect = ({
|
|
|
222
222
|
selectedItem => valueExtractor(selectedItem) === optionValue
|
|
223
223
|
)
|
|
224
224
|
);
|
|
225
|
+
|
|
225
226
|
return !isItemAlreadySelected;
|
|
226
227
|
})
|
|
227
228
|
.filter((item, index) => {
|
|
228
229
|
const optionLabel = labelExtractor(item, index);
|
|
229
230
|
if (searchQuery.length === 0) return true;
|
|
231
|
+
|
|
230
232
|
return formatStr(optionLabel).includes(formatStr(searchQuery));
|
|
231
233
|
});
|
|
232
234
|
|
|
@@ -250,13 +252,11 @@ export const MultiSelect = ({
|
|
|
250
252
|
? emptySearchedOptionsHeight
|
|
251
253
|
: 0);
|
|
252
254
|
|
|
253
|
-
const getValue = (item, index) =>
|
|
254
|
-
|
|
255
|
-
};
|
|
255
|
+
const getValue = (item, index) =>
|
|
256
|
+
item?.value || valueExtractor(item, index) || item;
|
|
256
257
|
|
|
257
|
-
const getLabel = (item, index) =>
|
|
258
|
-
|
|
259
|
-
};
|
|
258
|
+
const getLabel = (item, index) =>
|
|
259
|
+
item?.label || labelExtractor(item, index) || item;
|
|
260
260
|
|
|
261
261
|
const handleCheckbox = item => {
|
|
262
262
|
const oldData = [...value];
|
|
@@ -280,10 +280,10 @@ export const MultiSelect = ({
|
|
|
280
280
|
return (
|
|
281
281
|
<Container py={12}>
|
|
282
282
|
<CheckBox
|
|
283
|
-
disabled={disabled}
|
|
284
283
|
checked={itemIndex !== -1}
|
|
285
|
-
|
|
284
|
+
disabled={disabled}
|
|
286
285
|
label={item?.label || labelExtractor(item, index) || item}
|
|
286
|
+
onSelect={onPress}
|
|
287
287
|
/>
|
|
288
288
|
</Container>
|
|
289
289
|
);
|
|
@@ -295,6 +295,7 @@ export const MultiSelect = ({
|
|
|
295
295
|
if (!showDropdown) {
|
|
296
296
|
setShowDropdown(true);
|
|
297
297
|
}
|
|
298
|
+
|
|
298
299
|
if (showDropdown) {
|
|
299
300
|
dropdownAnimatedHeight.value = 0;
|
|
300
301
|
}
|
|
@@ -315,14 +316,12 @@ export const MultiSelect = ({
|
|
|
315
316
|
duration: 250,
|
|
316
317
|
}
|
|
317
318
|
);
|
|
318
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
319
319
|
}, [value, showDropdown]);
|
|
320
320
|
|
|
321
321
|
useEffect(() => {
|
|
322
322
|
if (showDropdown) {
|
|
323
323
|
dropdownAnimatedHeight.value = dropdownHeight;
|
|
324
324
|
}
|
|
325
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
326
325
|
}, [showDropdown, dropdownHeight]);
|
|
327
326
|
|
|
328
327
|
CheckBoxContent.propTypes = {
|
|
@@ -331,13 +330,11 @@ export const MultiSelect = ({
|
|
|
331
330
|
index: PropTypes.number,
|
|
332
331
|
};
|
|
333
332
|
|
|
334
|
-
const animatedStyles = useAnimatedStyle(() => {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
};
|
|
340
|
-
});
|
|
333
|
+
const animatedStyles = useAnimatedStyle(() => ({
|
|
334
|
+
top: interpolate(animatedLabelValue.value, [0, 1], [7, -5]),
|
|
335
|
+
fontSize: interpolate(animatedLabelValue.value, [0, 1], [17, 13]),
|
|
336
|
+
color: "font.grey600",
|
|
337
|
+
}));
|
|
341
338
|
|
|
342
339
|
return (
|
|
343
340
|
<Container {...containerStyle}>
|
|
@@ -346,62 +343,60 @@ export const MultiSelect = ({
|
|
|
346
343
|
onPress={handleOpenDropdown}
|
|
347
344
|
>
|
|
348
345
|
<Container
|
|
346
|
+
borderColor={showDropdown ? "border.base" : "border.grey400"}
|
|
349
347
|
borderRadius={12}
|
|
350
348
|
borderWidth={1}
|
|
351
|
-
|
|
349
|
+
minHeight={58}
|
|
352
350
|
p={2}
|
|
353
351
|
pr={2}
|
|
354
|
-
minHeight={58}
|
|
355
352
|
{...inputContainerStyle}
|
|
356
353
|
{...rest}
|
|
357
354
|
>
|
|
358
355
|
<Container
|
|
356
|
+
alignItems="center"
|
|
359
357
|
flexDirection="row"
|
|
360
358
|
justifyContent="space-between"
|
|
361
|
-
alignItems="center"
|
|
362
359
|
>
|
|
363
360
|
<AnimatedLabel
|
|
364
361
|
position="absolute"
|
|
365
|
-
zIndex={1}
|
|
366
362
|
style={[animatedStyles, { marginLeft: 5, ...labelStyle }]}
|
|
363
|
+
zIndex={1}
|
|
367
364
|
>
|
|
368
365
|
{label}
|
|
369
366
|
</AnimatedLabel>
|
|
370
367
|
{!multipleOptionsSelected && <Container />}
|
|
371
368
|
{multipleOptionsSelected && (
|
|
372
369
|
<Container
|
|
373
|
-
flexWrap="wrap"
|
|
374
370
|
flexDirection="row"
|
|
371
|
+
flexWrap="wrap"
|
|
375
372
|
maxWidth="85%"
|
|
376
|
-
onStartShouldSetResponder={() => true}
|
|
377
373
|
mt={3}
|
|
374
|
+
onStartShouldSetResponder={() => true}
|
|
378
375
|
>
|
|
379
|
-
{value?.slice(0, maxItemSize).map((item, index) =>
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
);
|
|
393
|
-
})}
|
|
376
|
+
{value?.slice(0, maxItemSize).map((item, index) => (
|
|
377
|
+
<MultiSelectItem
|
|
378
|
+
confirmationAlertObj={confirmationAlertObj}
|
|
379
|
+
disabled={disabled}
|
|
380
|
+
key={index}
|
|
381
|
+
label={getLabel(item)}
|
|
382
|
+
multiSelectedItemLabelStyle={multiSelectedItemLabelStyle}
|
|
383
|
+
multiSelectedItemContainerStyle={
|
|
384
|
+
multiSelectedItemContainerStyle
|
|
385
|
+
}
|
|
386
|
+
onUnselect={() => handleUnSelection(item)}
|
|
387
|
+
/>
|
|
388
|
+
))}
|
|
394
389
|
{value?.length > maxItemSize &&
|
|
395
390
|
(!MoreItemComponent ? (
|
|
396
391
|
<Container
|
|
392
|
+
alignItems="center"
|
|
397
393
|
bg="background.secondary"
|
|
398
394
|
borderRadius={12}
|
|
399
395
|
flexDirection="row"
|
|
400
|
-
alignItems="center"
|
|
401
396
|
justifyContent="space-between"
|
|
397
|
+
m={1}
|
|
402
398
|
px={2}
|
|
403
399
|
py={1}
|
|
404
|
-
m={1}
|
|
405
400
|
{...moreItemLabelContainerStyle}
|
|
406
401
|
>
|
|
407
402
|
<Typography {...moreItemLabelStyle}>
|
|
@@ -418,44 +413,43 @@ export const MultiSelect = ({
|
|
|
418
413
|
<Loader color={theme.colors.background.base} />
|
|
419
414
|
) : (
|
|
420
415
|
<Icon
|
|
416
|
+
color="grey"
|
|
421
417
|
name={`arrow-${showDropdown ? "up" : "down"}-s-line`}
|
|
422
418
|
size="20"
|
|
423
|
-
color="grey"
|
|
424
419
|
/>
|
|
425
420
|
)}
|
|
426
421
|
</Container>
|
|
427
422
|
</Container>
|
|
428
423
|
</Container>
|
|
429
424
|
</TouchableWithoutFeedback>
|
|
430
|
-
|
|
431
425
|
<BottomSheet
|
|
432
|
-
title={label}
|
|
433
|
-
onItemPress={({ item }) => {
|
|
434
|
-
handleCheckbox(item);
|
|
435
|
-
selectedValue(item);
|
|
436
|
-
}}
|
|
437
|
-
disabled={disabled}
|
|
438
|
-
onDonePress={onDonePress}
|
|
439
|
-
isVisible={showDropdown}
|
|
440
|
-
hide={() => setShowDropdown(false)}
|
|
441
|
-
canSearch={isSearchable}
|
|
442
|
-
data={options}
|
|
443
|
-
contentType="checkbox"
|
|
444
426
|
ContentRow={CheckBoxContent}
|
|
445
|
-
showCreateOption={showCreateOption}
|
|
446
427
|
CreateItemComponent={CreateItemComponent}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
428
|
+
NoResultsComponent={NoResultsComponent}
|
|
429
|
+
canSearch={isSearchable}
|
|
430
|
+
contentType="checkbox"
|
|
450
431
|
createSearchedOptionContainerStyle={createSearchedOptionContainerStyle}
|
|
432
|
+
createSearchedOptionLabelStyle={createSearchedOptionLabelStyle}
|
|
433
|
+
data={options}
|
|
434
|
+
disabled={disabled}
|
|
435
|
+
hide={() => setShowDropdown(false)}
|
|
436
|
+
isVisible={showDropdown}
|
|
437
|
+
labelExtractor={labelExtractor}
|
|
438
|
+
noResultsLabel={noResultsLabel}
|
|
451
439
|
noResultsLabelContainerStyle={noResultsLabelContainerStyle}
|
|
452
440
|
noResultsLabelStyle={noResultsLabelStyle}
|
|
453
|
-
|
|
454
|
-
|
|
441
|
+
searchBarProps={searchBarProps}
|
|
442
|
+
showCreateOption={showCreateOption}
|
|
443
|
+
showCreateOptionLoader={showCreateOptionLoader}
|
|
444
|
+
title={label}
|
|
455
445
|
valueExtractor={valueExtractor}
|
|
456
|
-
labelExtractor={labelExtractor}
|
|
457
446
|
onBackdropPress={onBackdropPress}
|
|
458
|
-
|
|
447
|
+
onDonePress={onDonePress}
|
|
448
|
+
onPressCreateOption={onPressCreateOption}
|
|
449
|
+
onItemPress={({ item }) => {
|
|
450
|
+
handleCheckbox(item);
|
|
451
|
+
selectedValue(item);
|
|
452
|
+
}}
|
|
459
453
|
/>
|
|
460
454
|
</Container>
|
|
461
455
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
|
|
2
3
|
import PropTypes from "prop-types";
|
|
3
4
|
|
|
4
5
|
import { Container, Typography, Divider, ToggleSwitch } from "@components";
|
|
@@ -81,55 +82,54 @@ export const NotificationPreferenceList = ({
|
|
|
81
82
|
labelContainerProps,
|
|
82
83
|
labelProps,
|
|
83
84
|
...rest
|
|
84
|
-
}) =>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
}) => (
|
|
86
|
+
<Container bg="background.secondary" borderRadius={8} {...rest}>
|
|
87
|
+
{data?.map((item, index) => {
|
|
88
|
+
const { label, enabled, onSwitch, LeftIcon } = item;
|
|
89
|
+
const isLastItem = index === data.length - 1;
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<Container key={index} px={12} {...itemWrapperProps}>
|
|
93
|
+
<Container
|
|
94
|
+
alignItems="center"
|
|
95
|
+
flexDirection="row"
|
|
96
|
+
justifyContent="space-between"
|
|
97
|
+
py={15}
|
|
98
|
+
{...itemContainerProps}
|
|
99
|
+
>
|
|
92
100
|
<Container
|
|
93
|
-
py={15}
|
|
94
|
-
flexDirection="row"
|
|
95
101
|
alignItems="center"
|
|
96
|
-
|
|
97
|
-
{
|
|
102
|
+
flexDirection="row"
|
|
103
|
+
pr={15}
|
|
104
|
+
width="85%"
|
|
105
|
+
{...labelContainerProps}
|
|
98
106
|
>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
107
|
+
{LeftIcon && (
|
|
108
|
+
<Container mr={10}>
|
|
109
|
+
<LeftIcon />
|
|
110
|
+
</Container>
|
|
111
|
+
)}
|
|
112
|
+
<Typography
|
|
113
|
+
color="font.grey800"
|
|
114
|
+
fontFamily="sf400"
|
|
115
|
+
fontSize="l"
|
|
116
|
+
{...labelProps}
|
|
105
117
|
>
|
|
106
|
-
{
|
|
107
|
-
|
|
108
|
-
<LeftIcon />
|
|
109
|
-
</Container>
|
|
110
|
-
)}
|
|
111
|
-
<Typography
|
|
112
|
-
color="font.grey800"
|
|
113
|
-
fontSize="l"
|
|
114
|
-
fontFamily="sf400"
|
|
115
|
-
{...labelProps}
|
|
116
|
-
>
|
|
117
|
-
{label}
|
|
118
|
-
</Typography>
|
|
119
|
-
</Container>
|
|
120
|
-
<ToggleSwitch
|
|
121
|
-
value={enabled}
|
|
122
|
-
onValueChange={() => onSwitch(item, index)}
|
|
123
|
-
mt={4}
|
|
124
|
-
/>
|
|
118
|
+
{label}
|
|
119
|
+
</Typography>
|
|
125
120
|
</Container>
|
|
126
|
-
|
|
121
|
+
<ToggleSwitch
|
|
122
|
+
mt={4}
|
|
123
|
+
value={enabled}
|
|
124
|
+
onValueChange={() => onSwitch(item, index)}
|
|
125
|
+
/>
|
|
127
126
|
</Container>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
{!isLastItem && <Divider bg="background.grey300" />}
|
|
128
|
+
</Container>
|
|
129
|
+
);
|
|
130
|
+
})}
|
|
131
|
+
</Container>
|
|
132
|
+
);
|
|
133
133
|
|
|
134
134
|
NotificationPreferenceList.propTypes = {
|
|
135
135
|
/**
|