@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.
- package/package.json +2 -3
- package/src/components/Accordion.jsx +0 -266
- package/src/components/ActionIcon.jsx +0 -76
- package/src/components/Alert.jsx +0 -262
- package/src/components/AnimatedImage.jsx +0 -140
- package/src/components/Avatar.jsx +0 -144
- package/src/components/Badge.jsx +0 -97
- package/src/components/BottomSheet.jsx +0 -487
- package/src/components/BottomTabBar.jsx +0 -232
- package/src/components/Button.jsx +0 -275
- package/src/components/ButtonGroup.jsx +0 -120
- package/src/components/Calendar.jsx +0 -128
- package/src/components/Card.jsx +0 -90
- package/src/components/Carousel.jsx +0 -116
- package/src/components/ChatInput/AttachmentsView.jsx +0 -51
- package/src/components/ChatInput/Badge.jsx +0 -24
- package/src/components/ChatInput/ChatInput.jsx +0 -564
- package/src/components/ChatInput/EmailFields.jsx +0 -122
- package/src/components/ChatInput/IconButton.jsx +0 -34
- package/src/components/ChatInput/MentionsInputWrapper.jsx +0 -155
- package/src/components/CheckBox.jsx +0 -150
- package/src/components/Chip.jsx +0 -180
- package/src/components/Container.jsx +0 -31
- package/src/components/Divider.jsx +0 -79
- package/src/components/FAB.jsx +0 -113
- package/src/components/FlashList.jsx +0 -189
- package/src/components/FlatList.js +0 -10
- package/src/components/Input.jsx +0 -357
- package/src/components/InputEmailChip.jsx +0 -246
- package/src/components/LineLoader.jsx +0 -46
- package/src/components/ListItem.jsx +0 -68
- package/src/components/Loader.jsx +0 -122
- package/src/components/MultiSelect.jsx +0 -631
- package/src/components/NotificationIcon.jsx +0 -38
- package/src/components/NotificationPreferenceList.jsx +0 -208
- package/src/components/OnBoarding.jsx +0 -134
- package/src/components/OrganizationItem.jsx +0 -110
- package/src/components/OtpInputs.jsx +0 -194
- package/src/components/ParentView.jsx +0 -139
- package/src/components/Popover.jsx +0 -221
- package/src/components/RadioButton.jsx +0 -155
- package/src/components/RichTextEditor.jsx +0 -163
- package/src/components/Ripple.jsx +0 -281
- package/src/components/ScrollView.js +0 -14
- package/src/components/SearchBar.jsx +0 -207
- package/src/components/SegmentedTopBar/Indicator.jsx +0 -77
- package/src/components/SegmentedTopBar/Tab.jsx +0 -37
- package/src/components/SegmentedTopBar/index.jsx +0 -128
- package/src/components/SocialButton.jsx +0 -106
- package/src/components/Toast.jsx +0 -195
- package/src/components/ToggleSwitch.jsx +0 -112
- package/src/components/TopBar.jsx +0 -147
- package/src/components/Touchable.jsx +0 -133
- package/src/components/TouchableWithoutFeedback.jsx +0 -51
- package/src/components/Typography.jsx +0 -93
- package/src/components/index.js +0 -45
- package/src/config/index.js +0 -1
- package/src/config/toasterConfig.jsx +0 -142
- package/src/contexts/index.js +0 -3
- package/src/hooks/index.js +0 -3
- package/src/hooks/useDebounce.js +0 -17
- package/src/hooks/useKeyboard.js +0 -33
- package/src/hooks/useRefreshByUser.js +0 -20
- package/src/index.js +0 -2
- package/src/theme/index.js +0 -181
- package/src/utils/utils.js +0 -56
|
@@ -1,631 +0,0 @@
|
|
|
1
|
-
import React, { useContext, useEffect, useState } from "react";
|
|
2
|
-
import { Keyboard, TouchableWithoutFeedback } from "react-native";
|
|
3
|
-
|
|
4
|
-
import { Close, Up, Down } from "@bigbinary/neeto-icons-rn";
|
|
5
|
-
import PropTypes from "prop-types";
|
|
6
|
-
import Animated, {
|
|
7
|
-
interpolate,
|
|
8
|
-
useAnimatedStyle,
|
|
9
|
-
useSharedValue,
|
|
10
|
-
withTiming,
|
|
11
|
-
} from "react-native-reanimated";
|
|
12
|
-
import { moderateScale } from "react-native-size-matters";
|
|
13
|
-
import styled, { ThemeContext } from "styled-components/native";
|
|
14
|
-
import {
|
|
15
|
-
flexbox,
|
|
16
|
-
space,
|
|
17
|
-
typography,
|
|
18
|
-
textStyle,
|
|
19
|
-
color,
|
|
20
|
-
layout,
|
|
21
|
-
system,
|
|
22
|
-
position,
|
|
23
|
-
} from "styled-system";
|
|
24
|
-
|
|
25
|
-
import { BottomSheet, CheckBox, Container, Alert, Loader } from "@components";
|
|
26
|
-
|
|
27
|
-
const Typography = styled.Text`
|
|
28
|
-
${textStyle}
|
|
29
|
-
${space}
|
|
30
|
-
${layout}
|
|
31
|
-
${flexbox}
|
|
32
|
-
${typography}
|
|
33
|
-
${color}
|
|
34
|
-
${position}
|
|
35
|
-
${system({
|
|
36
|
-
textDecoration: {
|
|
37
|
-
property: "textDecoration",
|
|
38
|
-
cssProperty: "textDecoration",
|
|
39
|
-
},
|
|
40
|
-
textTransform: { property: "textTransform", cssProperty: "textTransform" },
|
|
41
|
-
})}
|
|
42
|
-
`;
|
|
43
|
-
|
|
44
|
-
const MultiSelectItem = ({
|
|
45
|
-
label,
|
|
46
|
-
onUnselect,
|
|
47
|
-
multiSelectedItemContainerStyle,
|
|
48
|
-
multiSelectedItemLabelStyle,
|
|
49
|
-
disabled,
|
|
50
|
-
confirmationAlertObj = {},
|
|
51
|
-
}) => {
|
|
52
|
-
const theme = useContext(ThemeContext);
|
|
53
|
-
const {
|
|
54
|
-
alertTitle = "Delete tag",
|
|
55
|
-
alertDescription = `Are you sure you want to delete tag: ${label}? This action cannot be undone.`,
|
|
56
|
-
alertConfirmButtonLabel = "Proceed",
|
|
57
|
-
showDeleteAlertConfirmation = true,
|
|
58
|
-
} = confirmationAlertObj;
|
|
59
|
-
|
|
60
|
-
const handleItemUnSelection = () => {
|
|
61
|
-
showDeleteAlertConfirmation
|
|
62
|
-
? Alert.show({
|
|
63
|
-
title: alertTitle,
|
|
64
|
-
description: alertDescription,
|
|
65
|
-
buttons: [
|
|
66
|
-
{
|
|
67
|
-
label: alertConfirmButtonLabel,
|
|
68
|
-
variant: "danger",
|
|
69
|
-
onPress: () => {
|
|
70
|
-
onUnselect();
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
label: "Cancel",
|
|
75
|
-
onPress: () => {},
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
})
|
|
79
|
-
: onUnselect();
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<Container
|
|
84
|
-
alignItems="center"
|
|
85
|
-
bg="background.secondary"
|
|
86
|
-
borderRadius={moderateScale(12)}
|
|
87
|
-
flexDirection="row"
|
|
88
|
-
justifyContent="space-between"
|
|
89
|
-
mr={moderateScale(4)}
|
|
90
|
-
mt={moderateScale(4)}
|
|
91
|
-
px={moderateScale(10)}
|
|
92
|
-
py={moderateScale(4)}
|
|
93
|
-
{...multiSelectedItemContainerStyle}
|
|
94
|
-
>
|
|
95
|
-
<Typography
|
|
96
|
-
color="font.grey800"
|
|
97
|
-
fontFamily="sf400"
|
|
98
|
-
fontSize="s"
|
|
99
|
-
mr={moderateScale(2)}
|
|
100
|
-
{...multiSelectedItemLabelStyle}
|
|
101
|
-
>
|
|
102
|
-
{label}
|
|
103
|
-
</Typography>
|
|
104
|
-
{!disabled && (
|
|
105
|
-
<TouchableWithoutFeedback
|
|
106
|
-
disabled={disabled}
|
|
107
|
-
onPress={handleItemUnSelection}
|
|
108
|
-
>
|
|
109
|
-
<Close
|
|
110
|
-
color={theme.colors.font.grey800}
|
|
111
|
-
size={moderateScale(18)}
|
|
112
|
-
viewBox="0 0 25 20"
|
|
113
|
-
/>
|
|
114
|
-
</TouchableWithoutFeedback>
|
|
115
|
-
)}
|
|
116
|
-
</Container>
|
|
117
|
-
);
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
MultiSelectItem.propTypes = {
|
|
121
|
-
label: PropTypes.string,
|
|
122
|
-
onUnselect: PropTypes.func,
|
|
123
|
-
multiSelectedItemContainerStyle: PropTypes.object,
|
|
124
|
-
multiSelectedItemLabelStyle: PropTypes.object,
|
|
125
|
-
disabled: PropTypes.bool,
|
|
126
|
-
confirmationAlertObj: PropTypes.object,
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const AnimatedLabel = Animated.createAnimatedComponent(Typography);
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
*
|
|
133
|
-
* MultiSelect can be used to select multiple options from a list of options.
|
|
134
|
-
*
|
|
135
|
-
* <div class="screenshots">
|
|
136
|
-
* <img src="screenshots/multiSelect/multiSelect.png" />
|
|
137
|
-
* </div>
|
|
138
|
-
*
|
|
139
|
-
* ## Usage
|
|
140
|
-
*
|
|
141
|
-
* ### Import and use MultiSelect component.
|
|
142
|
-
*
|
|
143
|
-
* ```js
|
|
144
|
-
* import * as React, { useState } from 'react';
|
|
145
|
-
* import { MultiSelect, Container } from '@bigbinary/neetoui-rn';
|
|
146
|
-
*
|
|
147
|
-
* const OPTIONS = [
|
|
148
|
-
* {
|
|
149
|
-
* label: "Option 1",
|
|
150
|
-
* value: "option_1"
|
|
151
|
-
* },
|
|
152
|
-
* {
|
|
153
|
-
* label: "Option 2",
|
|
154
|
-
* value: "option_2"
|
|
155
|
-
* },
|
|
156
|
-
* ]
|
|
157
|
-
*
|
|
158
|
-
* export default function Main() {
|
|
159
|
-
* const [selectedOptions, setSelectedOptions] = useState([])
|
|
160
|
-
*
|
|
161
|
-
* return (
|
|
162
|
-
* <MultiSelect
|
|
163
|
-
* label="Select"
|
|
164
|
-
* options={OPTIONS}
|
|
165
|
-
* value={selectedOptions}
|
|
166
|
-
* onSelect={setSelectedOptions}
|
|
167
|
-
* />
|
|
168
|
-
* );
|
|
169
|
-
* }
|
|
170
|
-
* ```
|
|
171
|
-
*/
|
|
172
|
-
|
|
173
|
-
export const MultiSelect = ({
|
|
174
|
-
options,
|
|
175
|
-
label,
|
|
176
|
-
value,
|
|
177
|
-
labelExtractor,
|
|
178
|
-
valueExtractor,
|
|
179
|
-
onSelect,
|
|
180
|
-
deletedValue,
|
|
181
|
-
isLoading,
|
|
182
|
-
isSearchable,
|
|
183
|
-
showCreateOption,
|
|
184
|
-
labelStyle,
|
|
185
|
-
containerStyle,
|
|
186
|
-
inputContainerStyle,
|
|
187
|
-
dropdownContainerStyle,
|
|
188
|
-
itemContainerStyle,
|
|
189
|
-
multiSelectedItemContainerStyle,
|
|
190
|
-
multiSelectedItemLabelStyle,
|
|
191
|
-
selectedValue,
|
|
192
|
-
CreateItemComponent,
|
|
193
|
-
showCreateOptionLoader,
|
|
194
|
-
createSearchedOptionLabelStyle,
|
|
195
|
-
onPressCreateOption,
|
|
196
|
-
createSearchedOptionContainerStyle,
|
|
197
|
-
onDonePress,
|
|
198
|
-
disabled,
|
|
199
|
-
noResultsLabelContainerStyle,
|
|
200
|
-
noResultsLabelStyle,
|
|
201
|
-
noResultsLabel,
|
|
202
|
-
NoResultsComponent,
|
|
203
|
-
maxItemSize,
|
|
204
|
-
moreItemLabelContainerStyle,
|
|
205
|
-
moreItemLabelStyle,
|
|
206
|
-
MoreItemComponent,
|
|
207
|
-
onBackdropPress,
|
|
208
|
-
searchBarProps,
|
|
209
|
-
confirmationAlertObj,
|
|
210
|
-
...rest
|
|
211
|
-
}) => {
|
|
212
|
-
const theme = useContext(ThemeContext);
|
|
213
|
-
const [showDropdown, setShowDropdown] = useState(false);
|
|
214
|
-
const [searchQuery, setSearchQuery] = useState("");
|
|
215
|
-
const dropdownAnimatedHeight = useSharedValue(0);
|
|
216
|
-
const animatedLabelValue = useSharedValue(0);
|
|
217
|
-
|
|
218
|
-
const formatStr = str => str?.toLowerCase()?.trim();
|
|
219
|
-
const filteredOptions = options
|
|
220
|
-
.filter((item, index) => {
|
|
221
|
-
const optionValue = valueExtractor(item, index);
|
|
222
|
-
const isItemAlreadySelected = Boolean(
|
|
223
|
-
value?.find(
|
|
224
|
-
selectedItem => valueExtractor(selectedItem) === optionValue
|
|
225
|
-
)
|
|
226
|
-
);
|
|
227
|
-
|
|
228
|
-
return !isItemAlreadySelected;
|
|
229
|
-
})
|
|
230
|
-
.filter((item, index) => {
|
|
231
|
-
const optionLabel = labelExtractor(item, index);
|
|
232
|
-
if (searchQuery.length === 0) return true;
|
|
233
|
-
|
|
234
|
-
return formatStr(optionLabel).includes(formatStr(searchQuery));
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
const isOptionsEmpty = !options || options?.length === 0;
|
|
238
|
-
const isSearchedOptionsEmpty =
|
|
239
|
-
searchQuery.length > 0 && filteredOptions.length === 0;
|
|
240
|
-
const emptyOptionsPlaceholderHeight = moderateScale(40);
|
|
241
|
-
const emptySearchedOptionsHeight = moderateScale(40);
|
|
242
|
-
const searchInputHeight = moderateScale(35);
|
|
243
|
-
const multipleOptionsSelected = value?.length > 0;
|
|
244
|
-
const defaultDropdownItemHeight =
|
|
245
|
-
itemContainerStyle?.height || moderateScale(32);
|
|
246
|
-
|
|
247
|
-
const dropdownHeight =
|
|
248
|
-
dropdownContainerStyle?.height ||
|
|
249
|
-
dropdownContainerStyle?.maxHeight ||
|
|
250
|
-
defaultDropdownItemHeight * Math.min(filteredOptions?.length, 6) +
|
|
251
|
-
(isSearchable ? searchInputHeight + moderateScale(10) : 0) +
|
|
252
|
-
(isOptionsEmpty && !(isSearchedOptionsEmpty && showCreateOption)
|
|
253
|
-
? emptyOptionsPlaceholderHeight
|
|
254
|
-
: 0) +
|
|
255
|
-
(isSearchedOptionsEmpty && showCreateOption
|
|
256
|
-
? emptySearchedOptionsHeight
|
|
257
|
-
: 0);
|
|
258
|
-
|
|
259
|
-
const getValue = (item, index) =>
|
|
260
|
-
item?.value || valueExtractor(item, index) || item;
|
|
261
|
-
|
|
262
|
-
const getLabel = (item, index) =>
|
|
263
|
-
item?.label || labelExtractor(item, index) || item;
|
|
264
|
-
|
|
265
|
-
const handleCheckbox = item => {
|
|
266
|
-
const oldData = [...value];
|
|
267
|
-
const index = value.findIndex(
|
|
268
|
-
(data, index) => getValue(data, index) === getValue(item)
|
|
269
|
-
);
|
|
270
|
-
|
|
271
|
-
if (index === -1) {
|
|
272
|
-
oldData.push(item);
|
|
273
|
-
} else {
|
|
274
|
-
oldData.splice(index, 1);
|
|
275
|
-
}
|
|
276
|
-
onSelect(oldData);
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
const CheckBoxContent = ({ onPress, item, index }) => {
|
|
280
|
-
const itemIndex = value.findIndex(
|
|
281
|
-
(data, i) => getValue(data, i) === getValue(item, index)
|
|
282
|
-
);
|
|
283
|
-
|
|
284
|
-
return (
|
|
285
|
-
<CheckBox
|
|
286
|
-
checked={itemIndex !== -1}
|
|
287
|
-
disabled={disabled}
|
|
288
|
-
label={item?.label || labelExtractor(item, index) || item}
|
|
289
|
-
onSelect={onPress}
|
|
290
|
-
/>
|
|
291
|
-
);
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
const handleOpenDropdown = () => {
|
|
295
|
-
Keyboard.dismiss();
|
|
296
|
-
setSearchQuery("");
|
|
297
|
-
if (!showDropdown) {
|
|
298
|
-
setShowDropdown(true);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (showDropdown) {
|
|
302
|
-
dropdownAnimatedHeight.value = 0;
|
|
303
|
-
}
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
const handleUnSelection = item => {
|
|
307
|
-
const newValue = value.filter(
|
|
308
|
-
selectedItem => valueExtractor(selectedItem) !== valueExtractor(item)
|
|
309
|
-
);
|
|
310
|
-
onSelect(newValue);
|
|
311
|
-
deletedValue(item);
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
useEffect(() => {
|
|
315
|
-
animatedLabelValue.value = withTiming(
|
|
316
|
-
value.length || showDropdown ? 1 : 0,
|
|
317
|
-
{
|
|
318
|
-
duration: 250,
|
|
319
|
-
}
|
|
320
|
-
);
|
|
321
|
-
}, [value, showDropdown]);
|
|
322
|
-
|
|
323
|
-
useEffect(() => {
|
|
324
|
-
if (showDropdown) {
|
|
325
|
-
dropdownAnimatedHeight.value = dropdownHeight;
|
|
326
|
-
}
|
|
327
|
-
}, [showDropdown, dropdownHeight]);
|
|
328
|
-
|
|
329
|
-
CheckBoxContent.propTypes = {
|
|
330
|
-
onPress: PropTypes.func,
|
|
331
|
-
item: PropTypes.object,
|
|
332
|
-
index: PropTypes.number,
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
const animatedStyles = useAnimatedStyle(() => ({
|
|
336
|
-
top: interpolate(animatedLabelValue.value, [0, 1], [7, -5]),
|
|
337
|
-
fontSize: interpolate(animatedLabelValue.value, [0, 1], [17, 13]),
|
|
338
|
-
}));
|
|
339
|
-
|
|
340
|
-
const OpenCloseIcon = showDropdown ? Up : Down;
|
|
341
|
-
|
|
342
|
-
return (
|
|
343
|
-
<Container {...containerStyle}>
|
|
344
|
-
<TouchableWithoutFeedback
|
|
345
|
-
disabled={isLoading}
|
|
346
|
-
onPress={handleOpenDropdown}
|
|
347
|
-
>
|
|
348
|
-
<Container
|
|
349
|
-
borderColor={showDropdown ? "border.base" : "border.grey400"}
|
|
350
|
-
borderRadius={moderateScale(12)}
|
|
351
|
-
borderWidth={moderateScale(1)}
|
|
352
|
-
minHeight={moderateScale(58)}
|
|
353
|
-
p={moderateScale(10)}
|
|
354
|
-
pr={moderateScale(8)}
|
|
355
|
-
pt={moderateScale(12)}
|
|
356
|
-
{...inputContainerStyle}
|
|
357
|
-
{...rest}
|
|
358
|
-
>
|
|
359
|
-
<Container
|
|
360
|
-
alignItems="center"
|
|
361
|
-
flexDirection="row"
|
|
362
|
-
justifyContent="space-between"
|
|
363
|
-
>
|
|
364
|
-
<AnimatedLabel
|
|
365
|
-
color="font.grey600"
|
|
366
|
-
position="absolute"
|
|
367
|
-
zIndex={1}
|
|
368
|
-
style={[
|
|
369
|
-
animatedStyles,
|
|
370
|
-
{ marginLeft: moderateScale(2), ...labelStyle },
|
|
371
|
-
]}
|
|
372
|
-
>
|
|
373
|
-
{label}
|
|
374
|
-
</AnimatedLabel>
|
|
375
|
-
{!multipleOptionsSelected && <Container />}
|
|
376
|
-
{multipleOptionsSelected && (
|
|
377
|
-
<Container
|
|
378
|
-
flexDirection="row"
|
|
379
|
-
flexWrap="wrap"
|
|
380
|
-
maxWidth="85%"
|
|
381
|
-
mt={moderateScale(16)}
|
|
382
|
-
onStartShouldSetResponder={() => true}
|
|
383
|
-
>
|
|
384
|
-
{value?.slice(0, maxItemSize).map((item, index) => (
|
|
385
|
-
<MultiSelectItem
|
|
386
|
-
confirmationAlertObj={confirmationAlertObj}
|
|
387
|
-
disabled={disabled}
|
|
388
|
-
key={index}
|
|
389
|
-
label={getLabel(item)}
|
|
390
|
-
multiSelectedItemLabelStyle={multiSelectedItemLabelStyle}
|
|
391
|
-
multiSelectedItemContainerStyle={
|
|
392
|
-
multiSelectedItemContainerStyle
|
|
393
|
-
}
|
|
394
|
-
onUnselect={() => handleUnSelection(item)}
|
|
395
|
-
/>
|
|
396
|
-
))}
|
|
397
|
-
{value?.length > maxItemSize &&
|
|
398
|
-
(!MoreItemComponent ? (
|
|
399
|
-
<Container
|
|
400
|
-
alignItems="center"
|
|
401
|
-
bg="background.secondary"
|
|
402
|
-
borderRadius={moderateScale(12)}
|
|
403
|
-
flexDirection="row"
|
|
404
|
-
justifyContent="space-between"
|
|
405
|
-
mr={moderateScale(4)}
|
|
406
|
-
mt={moderateScale(4)}
|
|
407
|
-
px={moderateScale(10)}
|
|
408
|
-
py={moderateScale(4)}
|
|
409
|
-
{...moreItemLabelContainerStyle}
|
|
410
|
-
>
|
|
411
|
-
<Typography {...moreItemLabelStyle}>
|
|
412
|
-
+{value?.length - maxItemSize} More
|
|
413
|
-
</Typography>
|
|
414
|
-
</Container>
|
|
415
|
-
) : (
|
|
416
|
-
<MoreItemComponent />
|
|
417
|
-
))}
|
|
418
|
-
</Container>
|
|
419
|
-
)}
|
|
420
|
-
<Container mt={moderateScale(10)}>
|
|
421
|
-
{isLoading ? (
|
|
422
|
-
<Loader color={theme.colors.background.base} />
|
|
423
|
-
) : (
|
|
424
|
-
<OpenCloseIcon color="grey" size={moderateScale(20)} />
|
|
425
|
-
)}
|
|
426
|
-
</Container>
|
|
427
|
-
</Container>
|
|
428
|
-
</Container>
|
|
429
|
-
</TouchableWithoutFeedback>
|
|
430
|
-
<BottomSheet
|
|
431
|
-
ContentRow={CheckBoxContent}
|
|
432
|
-
CreateItemComponent={CreateItemComponent}
|
|
433
|
-
NoResultsComponent={NoResultsComponent}
|
|
434
|
-
canSearch={isSearchable}
|
|
435
|
-
contentType="checkbox"
|
|
436
|
-
createSearchedOptionContainerStyle={createSearchedOptionContainerStyle}
|
|
437
|
-
createSearchedOptionLabelStyle={createSearchedOptionLabelStyle}
|
|
438
|
-
data={options}
|
|
439
|
-
disabled={disabled}
|
|
440
|
-
hide={() => setShowDropdown(false)}
|
|
441
|
-
isVisible={showDropdown}
|
|
442
|
-
labelExtractor={labelExtractor}
|
|
443
|
-
noResultsLabel={noResultsLabel}
|
|
444
|
-
noResultsLabelContainerStyle={noResultsLabelContainerStyle}
|
|
445
|
-
noResultsLabelStyle={noResultsLabelStyle}
|
|
446
|
-
searchBarProps={searchBarProps}
|
|
447
|
-
showCreateOption={showCreateOption}
|
|
448
|
-
showCreateOptionLoader={showCreateOptionLoader}
|
|
449
|
-
title={label}
|
|
450
|
-
valueExtractor={valueExtractor}
|
|
451
|
-
onBackdropPress={onBackdropPress}
|
|
452
|
-
onDonePress={onDonePress}
|
|
453
|
-
onPressCreateOption={onPressCreateOption}
|
|
454
|
-
onItemPress={({ item }) => {
|
|
455
|
-
handleCheckbox(item);
|
|
456
|
-
selectedValue(item);
|
|
457
|
-
}}
|
|
458
|
-
/>
|
|
459
|
-
</Container>
|
|
460
|
-
);
|
|
461
|
-
};
|
|
462
|
-
|
|
463
|
-
MultiSelect.propTypes = {
|
|
464
|
-
/**
|
|
465
|
-
* The text to use for the floating label.
|
|
466
|
-
*/
|
|
467
|
-
label: PropTypes.string,
|
|
468
|
-
/**
|
|
469
|
-
* options to populate the options dropdown.
|
|
470
|
-
*/
|
|
471
|
-
options: PropTypes.oneOfType([
|
|
472
|
-
PropTypes.arrayOf(PropTypes.string),
|
|
473
|
-
PropTypes.arrayOf(PropTypes.object),
|
|
474
|
-
]),
|
|
475
|
-
/**
|
|
476
|
-
* Use custom key as label.
|
|
477
|
-
*/
|
|
478
|
-
labelExtractor: PropTypes.func,
|
|
479
|
-
/**
|
|
480
|
-
* Use custom key as value.
|
|
481
|
-
*/
|
|
482
|
-
valueExtractor: PropTypes.func,
|
|
483
|
-
/**
|
|
484
|
-
* The selected value to show for the Select input.
|
|
485
|
-
*/
|
|
486
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
487
|
-
/**
|
|
488
|
-
* Callback function when an option is selected, receives an array of object of options selected.
|
|
489
|
-
*/
|
|
490
|
-
onSelect: PropTypes.func,
|
|
491
|
-
/**
|
|
492
|
-
* Callback function when an option is selected, receives the selected option object.
|
|
493
|
-
*/
|
|
494
|
-
selectedValue: PropTypes.func,
|
|
495
|
-
/**
|
|
496
|
-
* Callback function when an option is selected, receives the deleted option object.
|
|
497
|
-
*/
|
|
498
|
-
deletedValue: PropTypes.func,
|
|
499
|
-
/**
|
|
500
|
-
* Used to show if the dropdown is loading state, while loading Select input will be disabled.
|
|
501
|
-
*/
|
|
502
|
-
isLoading: PropTypes.bool,
|
|
503
|
-
/**
|
|
504
|
-
* Toggle Search bar within the options dropdown to search through the options.
|
|
505
|
-
*/
|
|
506
|
-
isSearchable: PropTypes.bool,
|
|
507
|
-
/**
|
|
508
|
-
* Callback that will be called on Done button press
|
|
509
|
-
*/
|
|
510
|
-
onDonePress: PropTypes.func,
|
|
511
|
-
/**
|
|
512
|
-
* Show option to create the searched label if not present in the options list
|
|
513
|
-
*/
|
|
514
|
-
showCreateOption: PropTypes.bool,
|
|
515
|
-
/**
|
|
516
|
-
* Show loader while creating a searched option not present in the options list
|
|
517
|
-
*/
|
|
518
|
-
showCreateOptionLoader: PropTypes.bool,
|
|
519
|
-
/**
|
|
520
|
-
* Callback when create searched option is pressed
|
|
521
|
-
*/
|
|
522
|
-
onPressCreateOption: PropTypes.func,
|
|
523
|
-
/**
|
|
524
|
-
* To customise floating label styles.
|
|
525
|
-
*/
|
|
526
|
-
labelStyle: PropTypes.object,
|
|
527
|
-
/**
|
|
528
|
-
* To customise outermost container style.
|
|
529
|
-
*/
|
|
530
|
-
containerStyle: PropTypes.object,
|
|
531
|
-
/**
|
|
532
|
-
* To customise Select input container styles.
|
|
533
|
-
*/
|
|
534
|
-
inputContainerStyle: PropTypes.object,
|
|
535
|
-
/**
|
|
536
|
-
* To customise dropdown container styles.
|
|
537
|
-
*/
|
|
538
|
-
dropdownContainerStyle: PropTypes.object,
|
|
539
|
-
/**
|
|
540
|
-
* To customise dropdown item container styles.
|
|
541
|
-
*/
|
|
542
|
-
itemContainerStyle: PropTypes.object,
|
|
543
|
-
/**
|
|
544
|
-
* To customise item container styles for multi selected items.
|
|
545
|
-
*/
|
|
546
|
-
multiSelectedItemContainerStyle: PropTypes.object,
|
|
547
|
-
/**
|
|
548
|
-
* To customise item text styles for multi selected item.
|
|
549
|
-
*/
|
|
550
|
-
multiSelectedItemLabelStyle: PropTypes.object,
|
|
551
|
-
/**
|
|
552
|
-
* To customise confirmation alert popup.
|
|
553
|
-
*/
|
|
554
|
-
confirmationAlertObj: PropTypes.object,
|
|
555
|
-
/**
|
|
556
|
-
* To customise empty options placeholder container style.
|
|
557
|
-
*/
|
|
558
|
-
createSearchedOptionContainerStyle: PropTypes.object,
|
|
559
|
-
/**
|
|
560
|
-
* To customise empty options placeholder text style.
|
|
561
|
-
*/
|
|
562
|
-
createSearchedOptionLabelStyle: PropTypes.object,
|
|
563
|
-
/**
|
|
564
|
-
* Component that renders when searched item doesn't exists
|
|
565
|
-
*/
|
|
566
|
-
CreateItemComponent: PropTypes.func,
|
|
567
|
-
/**
|
|
568
|
-
* Flag will disable the selection of the item
|
|
569
|
-
*/
|
|
570
|
-
disabled: PropTypes.bool,
|
|
571
|
-
/**
|
|
572
|
-
* To customize no results container style
|
|
573
|
-
*/
|
|
574
|
-
noResultsLabelContainerStyle: PropTypes.object,
|
|
575
|
-
/**
|
|
576
|
-
* To customize no results label style
|
|
577
|
-
*/
|
|
578
|
-
noResultsLabelStyle: PropTypes.object,
|
|
579
|
-
/**
|
|
580
|
-
* To customize no results label
|
|
581
|
-
*/
|
|
582
|
-
noResultsLabel: PropTypes.string,
|
|
583
|
-
/**
|
|
584
|
-
* To customize no results component
|
|
585
|
-
*/
|
|
586
|
-
NoResultsComponent: PropTypes.node,
|
|
587
|
-
/**
|
|
588
|
-
* Maximum number of items to render in the list
|
|
589
|
-
*/
|
|
590
|
-
maxItemSize: PropTypes.number,
|
|
591
|
-
/**
|
|
592
|
-
* Container style for the more item label
|
|
593
|
-
*/
|
|
594
|
-
moreItemLabelContainerStyle: PropTypes.object,
|
|
595
|
-
/**
|
|
596
|
-
* More item label style
|
|
597
|
-
*/
|
|
598
|
-
moreItemLabelStyle: PropTypes.object,
|
|
599
|
-
/**
|
|
600
|
-
* Custom component to render more item message
|
|
601
|
-
*/
|
|
602
|
-
MoreItemComponent: PropTypes.node,
|
|
603
|
-
/**
|
|
604
|
-
* Function to customize back drop press
|
|
605
|
-
*/
|
|
606
|
-
onBackdropPress: PropTypes.func,
|
|
607
|
-
/**
|
|
608
|
-
* Object to update the searchbar component
|
|
609
|
-
*/
|
|
610
|
-
searchBarProps: PropTypes.object,
|
|
611
|
-
};
|
|
612
|
-
|
|
613
|
-
MultiSelect.defaultProps = {
|
|
614
|
-
label: null,
|
|
615
|
-
labelExtractor: option => option?.label,
|
|
616
|
-
valueExtractor: option => option?.value,
|
|
617
|
-
value: null,
|
|
618
|
-
onSelect: () => {},
|
|
619
|
-
selectedValue: () => {},
|
|
620
|
-
deletedValue: () => {},
|
|
621
|
-
isLoading: false,
|
|
622
|
-
isSearchable: false,
|
|
623
|
-
showCreateOption: false,
|
|
624
|
-
showCreateOptionLoader: false,
|
|
625
|
-
onPressCreateOption: () => {},
|
|
626
|
-
onDonePress: () => {},
|
|
627
|
-
maxItemSize: 5,
|
|
628
|
-
onBackdropPress: () => {},
|
|
629
|
-
searchBarProps: {},
|
|
630
|
-
confirmationAlertObj: {},
|
|
631
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
import { Notification } from "@bigbinary/neeto-icons-rn";
|
|
4
|
-
import PropTypes from "prop-types";
|
|
5
|
-
|
|
6
|
-
import { ActionIcon } from "./ActionIcon";
|
|
7
|
-
import { Container } from "./Container";
|
|
8
|
-
|
|
9
|
-
export const NotificationIcon = ({ unreadCount = 0, onPress = () => {} }) => (
|
|
10
|
-
<Container>
|
|
11
|
-
<ActionIcon icon={Notification} {...{ onPress }} />
|
|
12
|
-
{unreadCount > 0 && (
|
|
13
|
-
<Container
|
|
14
|
-
bg="background.danger"
|
|
15
|
-
borderRadius={5}
|
|
16
|
-
height={10}
|
|
17
|
-
position="absolute"
|
|
18
|
-
px={2}
|
|
19
|
-
py={1}
|
|
20
|
-
right={10}
|
|
21
|
-
top={7}
|
|
22
|
-
width={10}
|
|
23
|
-
zIndex={1}
|
|
24
|
-
/>
|
|
25
|
-
)}
|
|
26
|
-
</Container>
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
NotificationIcon.propTypes = {
|
|
30
|
-
/**
|
|
31
|
-
* The unread notifications count to show red indicator
|
|
32
|
-
*/
|
|
33
|
-
unreadCount: PropTypes.number,
|
|
34
|
-
/**
|
|
35
|
-
* Func which will be triggered on click of the notification icon.
|
|
36
|
-
*/
|
|
37
|
-
onPress: PropTypes.func,
|
|
38
|
-
};
|