react-native-input-select 2.1.5 → 2.1.7
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/README.md +14 -0
- package/lib/commonjs/asset/close.png +0 -0
- package/lib/commonjs/components/Dropdown/Dropdown.js +26 -11
- package/lib/commonjs/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/commonjs/components/Dropdown/DropdownSelectedItem.js +53 -0
- package/lib/commonjs/components/Dropdown/DropdownSelectedItem.js.map +1 -0
- package/lib/commonjs/components/Dropdown/{DropdownSelectedItemsView.js → DropdownSelectedItemsContainer.js} +41 -46
- package/lib/commonjs/components/Dropdown/DropdownSelectedItemsContainer.js.map +1 -0
- package/lib/commonjs/components/List/DropdownFlatList.js +1 -1
- package/lib/commonjs/components/List/DropdownListItem.js.map +1 -0
- package/lib/commonjs/components/List/DropdownSectionList.js +1 -1
- package/lib/commonjs/hooks/use-selection-handler.js +13 -7
- package/lib/commonjs/hooks/use-selection-handler.js.map +1 -1
- package/lib/commonjs/index.js +14 -7
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/styles/colors.js.map +1 -1
- package/lib/commonjs/styles/input.js.map +1 -1
- package/lib/commonjs/utils/index.js +30 -13
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/asset/close.png +0 -0
- package/lib/module/components/Dropdown/Dropdown.js +27 -12
- package/lib/module/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/module/components/Dropdown/DropdownSelectedItem.js +46 -0
- package/lib/module/components/Dropdown/DropdownSelectedItem.js.map +1 -0
- package/lib/module/components/Dropdown/{DropdownSelectedItemsView.js → DropdownSelectedItemsContainer.js} +42 -47
- package/lib/module/components/Dropdown/DropdownSelectedItemsContainer.js.map +1 -0
- package/lib/module/components/List/DropdownFlatList.js +1 -1
- package/lib/module/components/List/DropdownFlatList.js.map +1 -1
- package/lib/module/components/List/DropdownListItem.js.map +1 -0
- package/lib/module/components/List/DropdownSectionList.js +1 -1
- package/lib/module/components/List/DropdownSectionList.js.map +1 -1
- package/lib/module/hooks/use-selection-handler.js +13 -7
- package/lib/module/hooks/use-selection-handler.js.map +1 -1
- package/lib/module/index.js +15 -8
- package/lib/module/index.js.map +1 -1
- package/lib/module/styles/colors.js.map +1 -1
- package/lib/module/styles/input.js.map +1 -1
- package/lib/module/utils/index.js +27 -11
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/src/components/Dropdown/Dropdown.d.ts +3 -1
- package/lib/typescript/src/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/lib/typescript/src/components/Dropdown/DropdownSelectedItem.d.ts +16 -0
- package/lib/typescript/src/components/Dropdown/DropdownSelectedItem.d.ts.map +1 -0
- package/lib/typescript/src/components/Dropdown/DropdownSelectedItemsContainer.d.ts +16 -0
- package/lib/typescript/src/components/Dropdown/DropdownSelectedItemsContainer.d.ts.map +1 -0
- package/lib/typescript/src/components/List/DropdownListItem.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-selection-handler.d.ts +2 -1
- package/lib/typescript/src/hooks/use-selection-handler.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/styles/colors.d.ts +10 -1
- package/lib/typescript/src/styles/colors.d.ts.map +1 -1
- package/lib/typescript/src/styles/input.d.ts +23 -1
- package/lib/typescript/src/styles/input.d.ts.map +1 -1
- package/lib/typescript/src/types/index.types.d.ts +13 -6
- package/lib/typescript/src/types/index.types.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +5 -4
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/asset/close.png +0 -0
- package/src/components/Dropdown/Dropdown.tsx +29 -10
- package/src/components/Dropdown/DropdownSelectedItem.tsx +78 -0
- package/src/components/Dropdown/DropdownSelectedItemsContainer.tsx +164 -0
- package/src/components/List/DropdownFlatList.tsx +1 -1
- package/src/components/List/DropdownSectionList.tsx +1 -1
- package/src/hooks/use-selection-handler.ts +20 -7
- package/src/index.tsx +30 -23
- package/src/styles/colors.ts +1 -1
- package/src/styles/input.ts +1 -1
- package/src/types/index.types.ts +14 -6
- package/src/utils/index.ts +55 -23
- package/lib/commonjs/components/Dropdown/DropdownListItem.js.map +0 -1
- package/lib/commonjs/components/Dropdown/DropdownSelectedItemsView.js.map +0 -1
- package/lib/module/components/Dropdown/DropdownListItem.js.map +0 -1
- package/lib/module/components/Dropdown/DropdownSelectedItemsView.js.map +0 -1
- package/lib/typescript/src/components/Dropdown/DropdownListItem.d.ts.map +0 -1
- package/lib/typescript/src/components/Dropdown/DropdownSelectedItemsView.d.ts +0 -4
- package/lib/typescript/src/components/Dropdown/DropdownSelectedItemsView.d.ts.map +0 -1
- package/src/components/Dropdown/DropdownSelectedItemsView.tsx +0 -134
- /package/lib/commonjs/components/{Dropdown → List}/DropdownListItem.js +0 -0
- /package/lib/module/components/{Dropdown → List}/DropdownListItem.js +0 -0
- /package/lib/typescript/src/components/{Dropdown → List}/DropdownListItem.d.ts +0 -0
- /package/src/components/{Dropdown → List}/DropdownListItem.tsx +0 -0
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Pressable,
|
|
5
|
+
ScrollView,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
TextStyle,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import { colors } from '../../styles/colors';
|
|
10
|
+
import { inputStyles } from '../../styles/input';
|
|
11
|
+
import DropdownSelectedItem from './DropdownSelectedItem';
|
|
12
|
+
import {
|
|
13
|
+
TDropdownInputProps,
|
|
14
|
+
TFlatListItem,
|
|
15
|
+
TSelectedItem,
|
|
16
|
+
TSelectedItemsControls,
|
|
17
|
+
TSelectedItemWithReactComponent,
|
|
18
|
+
} from 'src/types/index.types';
|
|
19
|
+
|
|
20
|
+
export interface DropdownSelectedItemsContainerProps {
|
|
21
|
+
openModal: () => void;
|
|
22
|
+
selectedItem: TSelectedItemWithReactComponent;
|
|
23
|
+
selectedItems: TSelectedItemWithReactComponent[];
|
|
24
|
+
optionLabel: string;
|
|
25
|
+
optionValue: string;
|
|
26
|
+
setIndexOfSelectedItem: (label: string) => void;
|
|
27
|
+
selectedItemsControls?: TSelectedItemsControls;
|
|
28
|
+
selectionData: TFlatListItem | TFlatListItem[];
|
|
29
|
+
handleMultipleSelections?: (value: TSelectedItem) => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const DropdownSelectedItemsContainer = ({
|
|
33
|
+
placeholder,
|
|
34
|
+
error,
|
|
35
|
+
selectionData = [],
|
|
36
|
+
openModal,
|
|
37
|
+
isMultiple,
|
|
38
|
+
selectedItem,
|
|
39
|
+
selectedItems,
|
|
40
|
+
optionLabel,
|
|
41
|
+
optionValue,
|
|
42
|
+
dropdownStyle,
|
|
43
|
+
placeholderStyle = {},
|
|
44
|
+
selectedItemStyle = {},
|
|
45
|
+
multipleSelectedItemStyle = {},
|
|
46
|
+
dropdownErrorStyle,
|
|
47
|
+
primaryColor,
|
|
48
|
+
disabled = false,
|
|
49
|
+
setIndexOfSelectedItem,
|
|
50
|
+
selectedItemsControls,
|
|
51
|
+
handleMultipleSelections,
|
|
52
|
+
}: TDropdownInputProps & DropdownSelectedItemsContainerProps) => {
|
|
53
|
+
const openActions = (label: string) => {
|
|
54
|
+
openModal();
|
|
55
|
+
setIndexOfSelectedItem(label); // immediately scrolls to list item with the specified label when modal
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Pressable
|
|
60
|
+
onPress={() => openModal()}
|
|
61
|
+
style={({ pressed }) => [
|
|
62
|
+
pressed && {
|
|
63
|
+
...inputStyles.inputFocusState,
|
|
64
|
+
borderColor: primaryColor,
|
|
65
|
+
},
|
|
66
|
+
{ ...inputStyles.input, ...dropdownStyle },
|
|
67
|
+
error && //this must be last
|
|
68
|
+
error !== '' &&
|
|
69
|
+
!pressed && {
|
|
70
|
+
...inputStyles.inputFocusErrorState,
|
|
71
|
+
...dropdownErrorStyle,
|
|
72
|
+
},
|
|
73
|
+
]}
|
|
74
|
+
disabled={disabled}
|
|
75
|
+
aria-disabled={disabled}
|
|
76
|
+
testID="react-native-input-select-dropdown-input-container"
|
|
77
|
+
>
|
|
78
|
+
<ScrollView
|
|
79
|
+
horizontal
|
|
80
|
+
alwaysBounceHorizontal
|
|
81
|
+
showsHorizontalScrollIndicator={false}
|
|
82
|
+
>
|
|
83
|
+
<View
|
|
84
|
+
style={styles.selectedItemsContainer}
|
|
85
|
+
onStartShouldSetResponder={() => true}
|
|
86
|
+
>
|
|
87
|
+
{isMultiple ? (
|
|
88
|
+
(selectionData as TFlatListItem[])?.map((data, i) => {
|
|
89
|
+
const label = data[optionLabel];
|
|
90
|
+
const value = data[optionValue];
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<DropdownSelectedItem
|
|
94
|
+
onPress={() => openActions(label as string)}
|
|
95
|
+
key={`react-native-input-select-list-item-${Math.random()}-${i}`}
|
|
96
|
+
style={[
|
|
97
|
+
styles.selectedItems,
|
|
98
|
+
{ backgroundColor: primaryColor },
|
|
99
|
+
multipleSelectedItemStyle,
|
|
100
|
+
]}
|
|
101
|
+
closeIconStyles={{
|
|
102
|
+
tintColor:
|
|
103
|
+
(multipleSelectedItemStyle as TextStyle)?.color ||
|
|
104
|
+
styles.selectedItems.color,
|
|
105
|
+
}}
|
|
106
|
+
label={label}
|
|
107
|
+
disabled={disabled || (data.disabled as boolean)}
|
|
108
|
+
showRemoveIcon={selectedItemsControls?.showRemoveIcon || true}
|
|
109
|
+
removeItemIcon={selectedItemsControls?.removeItemIcon}
|
|
110
|
+
onRemoveItem={() => {
|
|
111
|
+
handleMultipleSelections?.(value as TSelectedItem);
|
|
112
|
+
selectedItemsControls?.onRemoveItem?.(); //user defined control
|
|
113
|
+
}}
|
|
114
|
+
testId={`${i}`}
|
|
115
|
+
/>
|
|
116
|
+
);
|
|
117
|
+
})
|
|
118
|
+
) : (
|
|
119
|
+
<DropdownSelectedItem
|
|
120
|
+
onPress={() =>
|
|
121
|
+
openActions(
|
|
122
|
+
String((selectionData as TFlatListItem)?.[optionLabel] ?? '')
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
style={[styles.blackText, selectedItemStyle]}
|
|
126
|
+
label={(selectionData as TFlatListItem)[optionLabel] as string}
|
|
127
|
+
disabled={disabled}
|
|
128
|
+
/>
|
|
129
|
+
)}
|
|
130
|
+
|
|
131
|
+
{/* Placeholder */}
|
|
132
|
+
{selectedItem === '' && selectedItems?.length === 0 && (
|
|
133
|
+
<DropdownSelectedItem
|
|
134
|
+
onPress={() => openModal()}
|
|
135
|
+
style={[styles.blackText, placeholderStyle]}
|
|
136
|
+
label={placeholder ?? 'Select an option'}
|
|
137
|
+
disabled={disabled}
|
|
138
|
+
/>
|
|
139
|
+
)}
|
|
140
|
+
</View>
|
|
141
|
+
</ScrollView>
|
|
142
|
+
</Pressable>
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const styles = StyleSheet.create({
|
|
147
|
+
selectedItemsContainer: {
|
|
148
|
+
flexDirection: 'row',
|
|
149
|
+
flexWrap: 'nowrap',
|
|
150
|
+
alignItems: 'center',
|
|
151
|
+
},
|
|
152
|
+
selectedItems: {
|
|
153
|
+
color: colors.white,
|
|
154
|
+
paddingHorizontal: 10,
|
|
155
|
+
paddingVertical: 5,
|
|
156
|
+
borderRadius: 10,
|
|
157
|
+
backgroundColor: colors.primary,
|
|
158
|
+
marginRight: 10,
|
|
159
|
+
overflow: 'hidden',
|
|
160
|
+
},
|
|
161
|
+
blackText: { color: colors.black },
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
export default DropdownSelectedItemsContainer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable react-native/no-inline-styles */
|
|
2
2
|
import React, { useEffect, useRef } from 'react';
|
|
3
3
|
import { FlatList, FlatListProps, StyleSheet } from 'react-native';
|
|
4
|
-
import DropdownListItem from '
|
|
4
|
+
import DropdownListItem from './DropdownListItem';
|
|
5
5
|
import { ItemSeparatorComponent, ListEmptyComponent } from '../Others';
|
|
6
6
|
import { TFlatList } from '../../types/index.types';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable react-native/no-inline-styles */
|
|
2
2
|
import React, { useEffect, useState, useRef } from 'react';
|
|
3
3
|
import { SectionList, StyleSheet } from 'react-native';
|
|
4
|
-
import DropdownListItem from '
|
|
4
|
+
import DropdownListItem from './DropdownListItem';
|
|
5
5
|
import {
|
|
6
6
|
ItemSeparatorComponent,
|
|
7
7
|
ListEmptyComponent,
|
|
@@ -4,6 +4,7 @@ import { TSelectedItem } from '../types/index.types';
|
|
|
4
4
|
interface UseSelectionHandlerProps {
|
|
5
5
|
initialSelectedValue: TSelectedItem | TSelectedItem[]; // Can be a single value or an array
|
|
6
6
|
isMultiple: boolean;
|
|
7
|
+
minSelectableItems?: number;
|
|
7
8
|
maxSelectableItems?: number;
|
|
8
9
|
onValueChange: (selectedItems: TSelectedItem | TSelectedItem[]) => void;
|
|
9
10
|
closeModal: () => void;
|
|
@@ -13,12 +14,13 @@ interface UseSelectionHandlerProps {
|
|
|
13
14
|
export const useSelectionHandler = ({
|
|
14
15
|
initialSelectedValue,
|
|
15
16
|
isMultiple,
|
|
17
|
+
minSelectableItems = 0,
|
|
16
18
|
maxSelectableItems,
|
|
17
19
|
onValueChange,
|
|
18
20
|
closeModal,
|
|
19
21
|
autoCloseOnSelect,
|
|
20
22
|
}: UseSelectionHandlerProps) => {
|
|
21
|
-
// Initialize state based on whether it
|
|
23
|
+
// Initialize state based on whether it is multiple selection or not
|
|
22
24
|
const [selectedItem, setSelectedItem] = useState<TSelectedItem>(
|
|
23
25
|
isMultiple ? '' : (initialSelectedValue as TSelectedItem)
|
|
24
26
|
);
|
|
@@ -29,8 +31,11 @@ export const useSelectionHandler = ({
|
|
|
29
31
|
const handleSingleSelection = useCallback(
|
|
30
32
|
(value: TSelectedItem) => {
|
|
31
33
|
if (selectedItem === value) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
// Deselect item if minSelectableItems is not reached
|
|
35
|
+
if (minSelectableItems === 0) {
|
|
36
|
+
setSelectedItem('');
|
|
37
|
+
onValueChange(''); // Send null to parent when deselected
|
|
38
|
+
}
|
|
34
39
|
} else {
|
|
35
40
|
setSelectedItem(value);
|
|
36
41
|
onValueChange(value); // Send selected value to parent
|
|
@@ -40,7 +45,13 @@ export const useSelectionHandler = ({
|
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
47
|
},
|
|
43
|
-
[
|
|
48
|
+
[
|
|
49
|
+
selectedItem,
|
|
50
|
+
minSelectableItems,
|
|
51
|
+
onValueChange,
|
|
52
|
+
autoCloseOnSelect,
|
|
53
|
+
closeModal,
|
|
54
|
+
]
|
|
44
55
|
);
|
|
45
56
|
|
|
46
57
|
const handleMultipleSelections = useCallback(
|
|
@@ -49,8 +60,10 @@ export const useSelectionHandler = ({
|
|
|
49
60
|
let selectedValues = [...prevVal];
|
|
50
61
|
|
|
51
62
|
if (selectedValues.includes(value)) {
|
|
52
|
-
//
|
|
53
|
-
|
|
63
|
+
// Only remove item if it doesn't drop below the minimum required
|
|
64
|
+
if (selectedValues.length > minSelectableItems) {
|
|
65
|
+
selectedValues = selectedValues.filter((item) => item !== value);
|
|
66
|
+
}
|
|
54
67
|
} else {
|
|
55
68
|
// Add item
|
|
56
69
|
if (
|
|
@@ -66,7 +79,7 @@ export const useSelectionHandler = ({
|
|
|
66
79
|
return selectedValues;
|
|
67
80
|
});
|
|
68
81
|
},
|
|
69
|
-
[maxSelectableItems, onValueChange]
|
|
82
|
+
[minSelectableItems, maxSelectableItems, onValueChange]
|
|
70
83
|
);
|
|
71
84
|
|
|
72
85
|
// Return the relevant state and handlers
|
package/src/index.tsx
CHANGED
|
@@ -18,7 +18,11 @@ import type {
|
|
|
18
18
|
DropdownSelectHandle,
|
|
19
19
|
TSelectedItem,
|
|
20
20
|
} from './types/index.types';
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
extractPropertyFromArray,
|
|
23
|
+
getSelectionsData,
|
|
24
|
+
removeDisabledItems,
|
|
25
|
+
} from './utils';
|
|
22
26
|
import {
|
|
23
27
|
useSelectionHandler,
|
|
24
28
|
useModal,
|
|
@@ -63,7 +67,9 @@ export const DropdownSelect = forwardRef<DropdownSelectHandle, DropdownProps>(
|
|
|
63
67
|
searchControls,
|
|
64
68
|
modalControls,
|
|
65
69
|
checkboxControls,
|
|
70
|
+
selectedItemsControls,
|
|
66
71
|
autoCloseOnSelect = true,
|
|
72
|
+
minSelectableItems,
|
|
67
73
|
maxSelectableItems,
|
|
68
74
|
...rest
|
|
69
75
|
},
|
|
@@ -138,6 +144,7 @@ export const DropdownSelect = forwardRef<DropdownSelectHandle, DropdownProps>(
|
|
|
138
144
|
} = useSelectionHandler({
|
|
139
145
|
initialSelectedValue: selectedValue,
|
|
140
146
|
isMultiple,
|
|
147
|
+
minSelectableItems,
|
|
141
148
|
maxSelectableItems,
|
|
142
149
|
onValueChange,
|
|
143
150
|
closeModal: () => closeModal(),
|
|
@@ -149,14 +156,9 @@ export const DropdownSelect = forwardRef<DropdownSelectHandle, DropdownProps>(
|
|
|
149
156
|
? setSelectedItems(selectedValue as TSelectedItem[])
|
|
150
157
|
: setSelectedItem(selectedValue as TSelectedItem);
|
|
151
158
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
setSelectedItems,
|
|
156
|
-
setSelectedItem,
|
|
157
|
-
isMultiple,
|
|
158
|
-
onValueChange,
|
|
159
|
-
]);
|
|
159
|
+
// setSelectedItems already updates selectedValue, so omit it from dependency array to avoid infinite loop
|
|
160
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
161
|
+
}, [setSelectedItems, setSelectedItem, isMultiple, onValueChange]);
|
|
160
162
|
|
|
161
163
|
/*===========================================
|
|
162
164
|
* List type
|
|
@@ -198,18 +200,19 @@ export const DropdownSelect = forwardRef<DropdownSelectHandle, DropdownProps>(
|
|
|
198
200
|
placeholder={placeholder}
|
|
199
201
|
helperText={helperText}
|
|
200
202
|
error={error}
|
|
201
|
-
|
|
203
|
+
selectionData={getSelectionsData({
|
|
202
204
|
isMultiple,
|
|
203
|
-
optionLabel,
|
|
204
205
|
optionValue,
|
|
205
206
|
selectedItem,
|
|
206
207
|
selectedItems,
|
|
207
208
|
modifiedOptions,
|
|
208
209
|
})}
|
|
210
|
+
optionLabel={optionLabel}
|
|
211
|
+
optionValue={optionValue}
|
|
209
212
|
selectedItem={selectedItem}
|
|
210
213
|
selectedItems={selectedItems}
|
|
214
|
+
selectedItemsControls={selectedItemsControls}
|
|
211
215
|
openModal={() => openModal()}
|
|
212
|
-
closeModal={() => closeModal()}
|
|
213
216
|
labelStyle={labelStyle}
|
|
214
217
|
dropdownIcon={dropdownIcon}
|
|
215
218
|
dropdownStyle={dropdownStyle}
|
|
@@ -225,6 +228,7 @@ export const DropdownSelect = forwardRef<DropdownSelectHandle, DropdownProps>(
|
|
|
225
228
|
disabled={disabled}
|
|
226
229
|
placeholderStyle={placeholderStyle}
|
|
227
230
|
setIndexOfSelectedItem={setIndexOfSelectedItem}
|
|
231
|
+
handleMultipleSelections={handleMultipleSelections}
|
|
228
232
|
{...rest}
|
|
229
233
|
/>
|
|
230
234
|
<CustomModal
|
|
@@ -259,17 +263,20 @@ export const DropdownSelect = forwardRef<DropdownSelectHandle, DropdownProps>(
|
|
|
259
263
|
modifiedOptions?.length > 1 && (
|
|
260
264
|
<View style={styles.optionsContainerStyle}>
|
|
261
265
|
<TouchableOpacity accessible={false}>
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
selectAll
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
266
|
+
{/* only show this if all the items in the list are not disabled */}
|
|
267
|
+
{removeDisabledItems(modifiedOptions)?.length !== 0 && (
|
|
268
|
+
<CheckBox
|
|
269
|
+
value={selectAll}
|
|
270
|
+
label={
|
|
271
|
+
selectAll
|
|
272
|
+
? listControls?.unselectAllText || 'Clear all'
|
|
273
|
+
: listControls?.selectAllText || 'Select all'
|
|
274
|
+
}
|
|
275
|
+
onChange={() => handleSelectAll()}
|
|
276
|
+
primaryColor={primaryColor}
|
|
277
|
+
checkboxControls={checkboxControls}
|
|
278
|
+
/>
|
|
279
|
+
)}
|
|
273
280
|
</TouchableOpacity>
|
|
274
281
|
</View>
|
|
275
282
|
)}
|
package/src/styles/colors.ts
CHANGED
package/src/styles/input.ts
CHANGED
package/src/types/index.types.ts
CHANGED
|
@@ -13,18 +13,19 @@ export type DropdownProps = CommonDropdownProps &
|
|
|
13
13
|
TListProps;
|
|
14
14
|
|
|
15
15
|
export type CommonDropdownProps = {
|
|
16
|
-
testID?: string;
|
|
17
|
-
label?: string;
|
|
18
16
|
options: TFlatList | TSectionList;
|
|
19
|
-
optionLabel?: string;
|
|
20
|
-
optionValue?: string;
|
|
21
17
|
onValueChange: (selectedItems: TSelectedItem | TSelectedItem[]) => void;
|
|
22
18
|
selectedValue: TSelectedItem | TSelectedItem[];
|
|
19
|
+
optionLabel?: string;
|
|
20
|
+
optionValue?: string;
|
|
23
21
|
autoCloseOnSelect?: boolean;
|
|
22
|
+
minSelectableItems?: number;
|
|
24
23
|
maxSelectableItems?: number;
|
|
25
24
|
};
|
|
26
25
|
|
|
27
26
|
export type TDropdownInputProps = {
|
|
27
|
+
testID?: string;
|
|
28
|
+
label?: string;
|
|
28
29
|
placeholder?: string;
|
|
29
30
|
error?: string;
|
|
30
31
|
helperText?: string;
|
|
@@ -38,8 +39,8 @@ export type TDropdownInputProps = {
|
|
|
38
39
|
dropdownErrorStyle?: ViewStyle;
|
|
39
40
|
dropdownErrorTextStyle?: TextStyle;
|
|
40
41
|
dropdownHelperTextStyle?: TextStyle;
|
|
41
|
-
selectedItemStyle?: TextStyle;
|
|
42
|
-
multipleSelectedItemStyle?: TextStyle;
|
|
42
|
+
selectedItemStyle?: TextStyle | ViewStyle;
|
|
43
|
+
multipleSelectedItemStyle?: TextStyle | ViewStyle;
|
|
43
44
|
primaryColor?: ColorValue;
|
|
44
45
|
disabled?: boolean;
|
|
45
46
|
placeholderStyle?: TextStyle;
|
|
@@ -50,6 +51,7 @@ type TControls = {
|
|
|
50
51
|
checkboxControls?: TCheckboxControls;
|
|
51
52
|
modalControls?: TCustomModalControls;
|
|
52
53
|
listControls?: TListControls;
|
|
54
|
+
selectedItemsControls?: TSelectedItemsControls;
|
|
53
55
|
};
|
|
54
56
|
|
|
55
57
|
type TSearchControls = {
|
|
@@ -95,6 +97,12 @@ type TListControls = {
|
|
|
95
97
|
keyboardShouldPersistTaps?: 'always' | 'never' | 'handled';
|
|
96
98
|
};
|
|
97
99
|
|
|
100
|
+
export type TSelectedItemsControls = {
|
|
101
|
+
showRemoveIcon?: boolean;
|
|
102
|
+
removeItemIcon?: React.ReactNode;
|
|
103
|
+
onRemoveItem?: () => void;
|
|
104
|
+
};
|
|
105
|
+
|
|
98
106
|
export type TSelectedItem = string | number | boolean | undefined;
|
|
99
107
|
export type TSelectedItemWithReactComponent =
|
|
100
108
|
| TSelectedItem
|
package/src/utils/index.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
+
import { TextStyle, ViewStyle } from 'react-native';
|
|
1
2
|
import { TSelectedItem } from '../types/index.types';
|
|
2
|
-
import {
|
|
3
|
-
TFlatList,
|
|
4
|
-
TFlatListItem,
|
|
5
|
-
TSectionList,
|
|
6
|
-
TSelectedItemWithReactComponent,
|
|
7
|
-
} from '../types/index.types';
|
|
3
|
+
import { TFlatList, TFlatListItem, TSectionList } from '../types/index.types';
|
|
8
4
|
|
|
9
5
|
export const extractPropertyFromArray = (arr: any[], property: string) => {
|
|
10
6
|
let extractedValue = arr?.map((item: any) => item[property]);
|
|
@@ -31,40 +27,76 @@ export const isSectionList = (options: TFlatList | TSectionList): boolean => {
|
|
|
31
27
|
* @description get the labels of the items that were selected from the options array for either multiple or single selections
|
|
32
28
|
* @returns
|
|
33
29
|
*/
|
|
34
|
-
export const
|
|
30
|
+
export const getSelectionsData = ({
|
|
35
31
|
isMultiple,
|
|
36
|
-
optionLabel,
|
|
37
32
|
optionValue,
|
|
38
33
|
selectedItem,
|
|
39
34
|
selectedItems,
|
|
40
35
|
modifiedOptions,
|
|
41
36
|
}: {
|
|
42
37
|
isMultiple: boolean;
|
|
43
|
-
optionLabel: string;
|
|
44
38
|
optionValue: string;
|
|
45
39
|
selectedItem: TSelectedItem;
|
|
46
40
|
selectedItems: TSelectedItem[];
|
|
47
41
|
modifiedOptions: TFlatList;
|
|
48
|
-
}) => {
|
|
42
|
+
}): TFlatListItem | TFlatListItem[] => {
|
|
49
43
|
// Multiple select
|
|
50
|
-
if (isMultiple
|
|
51
|
-
let
|
|
44
|
+
if (isMultiple) {
|
|
45
|
+
let currentSelections: TFlatListItem[] = [];
|
|
52
46
|
|
|
53
|
-
selectedItems
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
Array.isArray(selectedItems) &&
|
|
48
|
+
selectedItems.forEach((element: TSelectedItem) => {
|
|
49
|
+
const currentSelection = modifiedOptions?.find(
|
|
50
|
+
(item: TFlatListItem) => item[optionValue] === element
|
|
51
|
+
);
|
|
57
52
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
// Only push if currentSelection is defined and is of the correct type
|
|
54
|
+
if (currentSelection) {
|
|
55
|
+
currentSelections.push(currentSelection);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return currentSelections;
|
|
63
60
|
}
|
|
64
61
|
|
|
65
62
|
// Single select
|
|
66
|
-
let
|
|
63
|
+
let current = modifiedOptions?.find(
|
|
67
64
|
(item: TFlatListItem) => item[optionValue] === selectedItem
|
|
68
65
|
);
|
|
69
|
-
return
|
|
66
|
+
return current ? current : {};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const textStyleKeys = [
|
|
70
|
+
'color',
|
|
71
|
+
'fontSize',
|
|
72
|
+
'fontFamily',
|
|
73
|
+
'fontWeight',
|
|
74
|
+
'fontStyle',
|
|
75
|
+
'textAlign',
|
|
76
|
+
'lineHeight',
|
|
77
|
+
'textDecorationLine',
|
|
78
|
+
'textDecorationStyle',
|
|
79
|
+
'textDecorationColor',
|
|
80
|
+
'textShadowColor',
|
|
81
|
+
'textShadowOffset',
|
|
82
|
+
'textShadowRadius',
|
|
83
|
+
'letterSpacing',
|
|
84
|
+
'textTransform',
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
export const extractTextStylesFromArray = (
|
|
88
|
+
styleArray: (ViewStyle & TextStyle)[] = []
|
|
89
|
+
) => {
|
|
90
|
+
const extractedStyles: Record<string, any> = {};
|
|
91
|
+
for (const styleObject of styleArray) {
|
|
92
|
+
if (styleObject && typeof styleObject === 'object') {
|
|
93
|
+
// Ensure it's a valid style object
|
|
94
|
+
for (const prop in styleObject) {
|
|
95
|
+
if (textStyleKeys.includes(prop)) {
|
|
96
|
+
extractedStyles[prop] = (styleObject as Record<string, any>)[prop];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return extractedStyles;
|
|
70
102
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_CheckBox","_interopRequireDefault","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DropdownListItem","item","optionLabel","optionValue","isMultiple","selectedOption","onChange","primaryColor","checkboxControls","createElement","TouchableOpacity","style","styles","listItemContainerStyle","onPress","disabled","value","includes","label","StyleSheet","create","paddingHorizontal","paddingVertical","flexDirection","alignItems","_default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AC,OAAA,CAAA5C,OAAA,gBAEY,IAAA6C,WAAI,EAAC3B,gBAAgB,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_colors","_input","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","DropdownSelectedItemsView","placeholder","error","labelsOfSelectedItems","openModal","isMultiple","selectedItem","selectedItems","dropdownIcon","dropdownStyle","dropdownIconStyle","selectedItemStyle","placeholderStyle","multipleSelectedItemStyle","dropdownErrorStyle","primaryColor","disabled","setIndexOfSelectedItem","openActions","label","createElement","Pressable","onPress","style","pressed","inputStyles","inputFocusState","borderColor","input","inputFocusErrorState","testID","ScrollView","horizontal","alwaysBounceHorizontal","showsHorizontalScrollIndicator","View","styles","selectedItemsContainer","onStartShouldSetResponder","map","i","DropdownContent","key","Math","random","backgroundColor","blackText","iconStyle","Image","source","rest","TouchableOpacity","Text","StyleSheet","create","position","right","top","flexDirection","flexWrap","alignItems","color","colors","white","paddingHorizontal","paddingVertical","borderRadius","primary","marginRight","overflow","black","_default","exports"],"sourceRoot":"../../../../src","sources":["components/Dropdown/DropdownSelectedItemsView.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AASA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAiD,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CA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,EAAEC,cAAM,CAACQ;EAAM;AACnC,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAArF,OAAA,GAEYa,yBAAyB","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","memo","TouchableOpacity","StyleSheet","CheckBox","DropdownListItem","item","optionLabel","optionValue","isMultiple","selectedOption","onChange","primaryColor","checkboxControls","createElement","style","styles","listItemContainerStyle","onPress","disabled","value","includes","label","create","paddingHorizontal","paddingVertical","flexDirection","alignItems"],"sourceRoot":"../../../../src","sources":["components/Dropdown/DropdownListItem.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,cAAc;AAC3D,OAAOC,QAAQ,MAAM,aAAa;AAElC,MAAMC,gBAAgB,GAAGA,CAAC;EACxBC,IAAI;EACJC,WAAW;EACXC,WAAW;EACXC,UAAU;EACVC,cAAc;EACdC,QAAQ;EACRC,YAAY;EACZC;AACG,CAAC,KAAK;EACT,oBACEb,KAAA,CAAAc,aAAA,CAACZ,gBAAgB;IACfa,KAAK,EAAEC,MAAM,CAACC,sBAAuB;IACrCC,OAAO,EAAEZ,IAAI,CAACa,QAAQ,GAAG,MAAM,CAAC,CAAC,GAAG,MAAMR,QAAQ,CAACL,IAAI,CAACE,WAAW,CAAC;EAAE,gBAEtER,KAAA,CAAAc,aAAA,CAACV,QAAQ;IACPgB,KAAK,EACHX,UAAU,GACNC,cAAc,CAACW,QAAQ,CAACf,IAAI,CAACE,WAAW,CAAC,CAAC,GAC1C,CAACE,cAAc,CAAC,CAACW,QAAQ,CAACf,IAAI,CAACE,WAAW,CAAC,CAChD;IACDc,KAAK,EAAEhB,IAAI,CAACC,WAAW,CAAE;IACzBI,QAAQ,EAAEA,CAAA,KAAMA,QAAQ,CAACL,IAAI,CAACE,WAAW,CAAC,CAAE;IAC5CI,YAAY,EAAEA,YAAa;IAC3BC,gBAAgB,EAAEA,gBAAiB;IACnCM,QAAQ,EAAEb,IAAI,CAACa;EAAS,CACzB,CACe,CAAC;AAEvB,CAAC;AAED,MAAMH,MAAM,GAAGb,UAAU,CAACoB,MAAM,CAAC;EAC/BN,sBAAsB,EAAE;IACtBO,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,EAAE;IACnBC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEF,4BAAe1B,IAAI,CAACI,gBAAgB,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","Text","Pressable","ScrollView","StyleSheet","Image","TouchableOpacity","colors","inputStyles","DropdownSelectedItemsView","placeholder","error","labelsOfSelectedItems","openModal","isMultiple","selectedItem","selectedItems","dropdownIcon","dropdownStyle","dropdownIconStyle","selectedItemStyle","placeholderStyle","multipleSelectedItemStyle","dropdownErrorStyle","primaryColor","disabled","setIndexOfSelectedItem","openActions","label","createElement","onPress","style","pressed","inputFocusState","borderColor","input","inputFocusErrorState","testID","horizontal","alwaysBounceHorizontal","showsHorizontalScrollIndicator","styles","selectedItemsContainer","onStartShouldSetResponder","map","i","DropdownContent","key","Math","random","backgroundColor","blackText","length","iconStyle","source","require","rest","_extends","create","position","right","top","flexDirection","flexWrap","alignItems","color","white","paddingHorizontal","paddingVertical","borderRadius","primary","marginRight","overflow","black"],"sourceRoot":"../../../../src","sources":["components/Dropdown/DropdownSelectedItemsView.tsx"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,IAAI,EACJC,IAAI,EACJC,SAAS,EACTC,UAAU,EACVC,UAAU,EACVC,KAAK,EACLC,gBAAgB,QACX,cAAc;AACrB,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,WAAW,QAAQ,oBAAoB;AAEhD,MAAMC,yBAAyB,GAAGA,CAAC;EACjCC,WAAW;EACXC,KAAK;EACLC,qBAAqB;EACrBC,SAA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AA;IAAC3B,OAAO,EAAEA,CAAA,KAAMA,OAAO,CAAC;EAAE,GAAK0B,IAAI,gBAClDzD,KAAA,CAAA8B,aAAA,CAAC5B,IAAI;IAAC8B,KAAK,EAAEA;EAAM,GAAEH,KAAY,CACjB,CAAC;AAEvB,CAAC;AAED,MAAMa,MAAM,GAAGrC,UAAU,CAACsD,MAAM,CAAC;EAC/BL,SAAS,EAAE;IAAEM,QAAQ,EAAE,UAAU;IAAEC,KAAK,EAAE,EAAE;IAAEC,GAAG,EAAE;EAAG,CAAC;EACvDnB,sBAAsB,EAAE;IACtBoB,aAAa,EAAE,KAAK;IACpBC,QAAQ,EAAE,QAAQ;IAClBC,UAAU,EAAE;EACd,CAAC;EACDhD,aAAa,EAAE;IACbiD,KAAK,EAAE1D,MAAM,CAAC2D,KAAK;IACnBC,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,CAAC;IAClBC,YAAY,EAAE,EAAE;IAChBnB,eAAe,EAAE3C,MAAM,CAAC+D,OAAO;IAC/BC,WAAW,EAAE,EAAE;IACfC,QAAQ,EAAE;EACZ,CAAC;EACDrB,SAAS,EAAE;IAAEc,KAAK,EAAE1D,MAAM,CAACkE;EAAM;AACnC,CAAC,CAAC;AAEF,eAAehE,yBAAyB","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownListItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/DropdownListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;8JAajC,GAAG;AA+BN,wBAAsC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare const DropdownSelectedItemsView: ({ placeholder, error, labelsOfSelectedItems, openModal, isMultiple, selectedItem, selectedItems, dropdownIcon, dropdownStyle, dropdownIconStyle, selectedItemStyle, placeholderStyle, multipleSelectedItemStyle, dropdownErrorStyle, primaryColor, disabled, setIndexOfSelectedItem, }: any) => React.JSX.Element;
|
|
3
|
-
export default DropdownSelectedItemsView;
|
|
4
|
-
//# sourceMappingURL=DropdownSelectedItemsView.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownSelectedItemsView.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/DropdownSelectedItemsView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,QAAA,MAAM,yBAAyB,GAAI,wRAkBhC,GAAG,sBAyEL,CAAC;AA6BF,eAAe,yBAAyB,CAAC"}
|