@riebel/react-native-multiple-select 0.6.0

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/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * react-native-multi-select
3
+ * Copyright(c) 2017 Mustapha Babatunde Oluwaleke
4
+ * MIT Licensed
5
+ */
6
+ export { default } from './MultiSelect';
@@ -0,0 +1,162 @@
1
+ /*!
2
+ * react-native-multi-select
3
+ * Copyright(c) 2017 Mustapha Babatunde Oluwaleke
4
+ * MIT Licensed
5
+ */
6
+ export declare const colorPack: {
7
+ readonly primary: "#00A5FF";
8
+ readonly primaryDark: "#215191";
9
+ readonly light: "#FFF";
10
+ readonly textPrimary: "#525966";
11
+ readonly placeholderTextColor: "#A9A9A9";
12
+ readonly danger: "#C62828";
13
+ readonly borderColor: "#e9e9e9";
14
+ readonly backgroundColor: "#b1b1b1";
15
+ };
16
+ declare const styles: {
17
+ footerWrapper: {
18
+ flexWrap: "wrap";
19
+ alignItems: "flex-start";
20
+ flexDirection: "row";
21
+ };
22
+ footerWrapperNC: {
23
+ width: number;
24
+ flexDirection: "column";
25
+ };
26
+ subSection: {
27
+ backgroundColor: "#FFF";
28
+ borderBottomWidth: number;
29
+ borderColor: "#e9e9e9";
30
+ paddingLeft: number;
31
+ paddingRight: number;
32
+ flex: number;
33
+ flexDirection: "row";
34
+ alignItems: "center";
35
+ };
36
+ greyButton: {
37
+ height: number;
38
+ borderRadius: number;
39
+ elevation: number;
40
+ backgroundColor: "#b1b1b1";
41
+ };
42
+ indicator: {
43
+ fontSize: number;
44
+ color: "#A9A9A9";
45
+ };
46
+ indicatorPadded: {
47
+ paddingLeft: number;
48
+ paddingRight: number;
49
+ };
50
+ selectedItem: {
51
+ flexDirection: "row";
52
+ alignItems: "center";
53
+ paddingLeft: number;
54
+ paddingTop: number;
55
+ paddingRight: number;
56
+ paddingBottom: number;
57
+ margin: number;
58
+ borderRadius: number;
59
+ borderWidth: number;
60
+ };
61
+ button: {
62
+ height: number;
63
+ flexDirection: "row";
64
+ justifyContent: "center";
65
+ alignItems: "center";
66
+ };
67
+ buttonText: {
68
+ color: "#FFF";
69
+ fontSize: number;
70
+ };
71
+ inputGroup: {
72
+ flexDirection: "row";
73
+ alignItems: "center";
74
+ paddingLeft: number;
75
+ backgroundColor: "#FFF";
76
+ };
77
+ dropdownView: {
78
+ flexDirection: "row";
79
+ alignItems: "center";
80
+ height: number;
81
+ marginBottom: number;
82
+ };
83
+ searchIconMargin: {
84
+ marginRight: number;
85
+ };
86
+ tagLabel: {
87
+ flex: number;
88
+ fontSize: number;
89
+ };
90
+ tagRemoveIcon: {
91
+ fontSize: number;
92
+ marginLeft: number;
93
+ };
94
+ rowWrap: {
95
+ flexDirection: "row";
96
+ flexWrap: "wrap";
97
+ };
98
+ rowItemText: {
99
+ flex: number;
100
+ fontSize: number;
101
+ paddingTop: number;
102
+ paddingBottom: number;
103
+ };
104
+ rowPadding: {
105
+ paddingLeft: number;
106
+ paddingRight: number;
107
+ };
108
+ rowAlignCenter: {
109
+ flexDirection: "row";
110
+ alignItems: "center";
111
+ };
112
+ disabledText: {
113
+ color: string;
114
+ };
115
+ checkIcon: {
116
+ fontSize: number;
117
+ };
118
+ noItemsText: {
119
+ flex: number;
120
+ marginTop: number;
121
+ textAlign: "center";
122
+ color: "#C62828";
123
+ };
124
+ noItemsRow: {
125
+ flexDirection: "row";
126
+ alignItems: "center";
127
+ };
128
+ searchInputFlex: {
129
+ flex: number;
130
+ };
131
+ backArrowMargin: {
132
+ marginLeft: number;
133
+ };
134
+ selectorContent: {
135
+ flexDirection: "column";
136
+ backgroundColor: string;
137
+ };
138
+ subSectionPadded: {
139
+ paddingTop: number;
140
+ paddingBottom: number;
141
+ };
142
+ dropdownTouchable: {
143
+ flex: number;
144
+ flexDirection: "row";
145
+ alignItems: "center";
146
+ };
147
+ dropdownLabelBase: {
148
+ flex: number;
149
+ fontSize: number;
150
+ };
151
+ selectedItemLayout: {
152
+ justifyContent: "center";
153
+ height: number;
154
+ };
155
+ };
156
+ export declare const selectorViewStyle: (fixedHeight: boolean) => {
157
+ height?: number | undefined;
158
+ flexDirection: "column";
159
+ marginBottom: number;
160
+ elevation: number;
161
+ };
162
+ export default styles;
package/dist/styles.js ADDED
@@ -0,0 +1,163 @@
1
+ /*!
2
+ * react-native-multi-select
3
+ * Copyright(c) 2017 Mustapha Babatunde Oluwaleke
4
+ * MIT Licensed
5
+ */
6
+ import { StyleSheet } from 'react-native';
7
+ export const colorPack = {
8
+ primary: '#00A5FF',
9
+ primaryDark: '#215191',
10
+ light: '#FFF',
11
+ textPrimary: '#525966',
12
+ placeholderTextColor: '#A9A9A9',
13
+ danger: '#C62828',
14
+ borderColor: '#e9e9e9',
15
+ backgroundColor: '#b1b1b1'
16
+ };
17
+ const styles = StyleSheet.create({
18
+ footerWrapper: {
19
+ flexWrap: 'wrap',
20
+ alignItems: 'flex-start',
21
+ flexDirection: 'row'
22
+ },
23
+ footerWrapperNC: {
24
+ width: 320,
25
+ flexDirection: 'column'
26
+ },
27
+ subSection: {
28
+ backgroundColor: colorPack.light,
29
+ borderBottomWidth: 1,
30
+ borderColor: colorPack.borderColor,
31
+ paddingLeft: 0,
32
+ paddingRight: 20,
33
+ flex: 1,
34
+ flexDirection: 'row',
35
+ alignItems: 'center'
36
+ },
37
+ greyButton: {
38
+ height: 40,
39
+ borderRadius: 5,
40
+ elevation: 0,
41
+ backgroundColor: colorPack.backgroundColor
42
+ },
43
+ indicator: {
44
+ fontSize: 30,
45
+ color: colorPack.placeholderTextColor
46
+ },
47
+ indicatorPadded: {
48
+ paddingLeft: 15,
49
+ paddingRight: 15
50
+ },
51
+ selectedItem: {
52
+ flexDirection: 'row',
53
+ alignItems: 'center',
54
+ paddingLeft: 15,
55
+ paddingTop: 3,
56
+ paddingRight: 3,
57
+ paddingBottom: 3,
58
+ margin: 3,
59
+ borderRadius: 20,
60
+ borderWidth: 2
61
+ },
62
+ button: {
63
+ height: 40,
64
+ flexDirection: 'row',
65
+ justifyContent: 'center',
66
+ alignItems: 'center'
67
+ },
68
+ buttonText: {
69
+ color: colorPack.light,
70
+ fontSize: 14
71
+ },
72
+ inputGroup: {
73
+ flexDirection: 'row',
74
+ alignItems: 'center',
75
+ paddingLeft: 16,
76
+ backgroundColor: colorPack.light
77
+ },
78
+ dropdownView: {
79
+ flexDirection: 'row',
80
+ alignItems: 'center',
81
+ height: 40,
82
+ marginBottom: 10
83
+ },
84
+ searchIconMargin: {
85
+ marginRight: 10
86
+ },
87
+ tagLabel: {
88
+ flex: 1,
89
+ fontSize: 15
90
+ },
91
+ tagRemoveIcon: {
92
+ fontSize: 22,
93
+ marginLeft: 10
94
+ },
95
+ rowWrap: {
96
+ flexDirection: 'row',
97
+ flexWrap: 'wrap'
98
+ },
99
+ rowItemText: {
100
+ flex: 1,
101
+ fontSize: 16,
102
+ paddingTop: 5,
103
+ paddingBottom: 5
104
+ },
105
+ rowPadding: {
106
+ paddingLeft: 20,
107
+ paddingRight: 20
108
+ },
109
+ rowAlignCenter: {
110
+ flexDirection: 'row',
111
+ alignItems: 'center'
112
+ },
113
+ disabledText: {
114
+ color: 'grey'
115
+ },
116
+ checkIcon: {
117
+ fontSize: 20
118
+ },
119
+ noItemsText: {
120
+ flex: 1,
121
+ marginTop: 20,
122
+ textAlign: 'center',
123
+ color: colorPack.danger
124
+ },
125
+ noItemsRow: {
126
+ flexDirection: 'row',
127
+ alignItems: 'center'
128
+ },
129
+ searchInputFlex: {
130
+ flex: 1
131
+ },
132
+ backArrowMargin: {
133
+ marginLeft: 5
134
+ },
135
+ selectorContent: {
136
+ flexDirection: 'column',
137
+ backgroundColor: '#fafafa'
138
+ },
139
+ subSectionPadded: {
140
+ paddingTop: 10,
141
+ paddingBottom: 10
142
+ },
143
+ dropdownTouchable: {
144
+ flex: 1,
145
+ flexDirection: 'row',
146
+ alignItems: 'center'
147
+ },
148
+ dropdownLabelBase: {
149
+ flex: 1,
150
+ fontSize: 16
151
+ },
152
+ selectedItemLayout: {
153
+ justifyContent: 'center',
154
+ height: 40
155
+ }
156
+ });
157
+ export const selectorViewStyle = (fixedHeight) => ({
158
+ flexDirection: 'column',
159
+ marginBottom: 10,
160
+ elevation: 2,
161
+ ...(fixedHeight ? { height: 250 } : {})
162
+ });
163
+ export default styles;
@@ -0,0 +1,82 @@
1
+ import type { ComponentType, ReactNode } from 'react';
2
+ import type { ViewStyle, TextStyle, TextInputProps, StyleProp, FlatListProps } from 'react-native';
3
+ export interface IconProps {
4
+ name: string;
5
+ size?: number;
6
+ color?: string;
7
+ style?: StyleProp<TextStyle | ViewStyle>;
8
+ onPress?: () => void;
9
+ }
10
+ export type IconComponentType = ComponentType<IconProps>;
11
+ export interface IconNames {
12
+ search?: string;
13
+ close?: string;
14
+ check?: string;
15
+ arrowDown?: string;
16
+ arrowRight?: string;
17
+ arrowLeft?: string;
18
+ }
19
+ export interface MultiSelectItem {
20
+ [key: string]: unknown;
21
+ disabled?: boolean;
22
+ }
23
+ export interface MultiSelectProps {
24
+ items: MultiSelectItem[];
25
+ iconComponent: IconComponentType;
26
+ iconNames?: Partial<IconNames>;
27
+ onSelectedItemsChange: (items: string[]) => void;
28
+ single?: boolean;
29
+ selectedItems?: string[];
30
+ uniqueKey?: string;
31
+ displayKey?: string;
32
+ tagBorderColor?: string;
33
+ tagTextColor?: string;
34
+ tagRemoveIconColor?: string;
35
+ tagContainerStyle?: StyleProp<ViewStyle>;
36
+ fontFamily?: string;
37
+ selectedItemFontFamily?: string;
38
+ selectedItemTextColor?: string;
39
+ selectedItemIconColor?: string;
40
+ itemFontFamily?: string;
41
+ itemTextColor?: string;
42
+ itemFontSize?: number;
43
+ searchIcon?: ReactNode;
44
+ searchInputPlaceholderText?: string;
45
+ searchInputStyle?: StyleProp<TextStyle>;
46
+ selectText?: string;
47
+ selectedText?: string;
48
+ altFontFamily?: string;
49
+ fontSize?: number;
50
+ textColor?: string;
51
+ fixedHeight?: boolean;
52
+ hideTags?: boolean;
53
+ hideSubmitButton?: boolean;
54
+ hideDropdown?: boolean;
55
+ submitButtonColor?: string;
56
+ submitButtonText?: string;
57
+ canAddItems?: boolean;
58
+ removeSelected?: boolean;
59
+ noItemsText?: string;
60
+ filterMethod?: 'partial' | 'full';
61
+ onAddItem?: (newItems: MultiSelectItem[]) => void;
62
+ onChangeInput?: (text: string) => void;
63
+ onClearSelector?: () => void;
64
+ onToggleList?: () => void;
65
+ textInputProps?: TextInputProps;
66
+ flatListProps?: Partial<FlatListProps<MultiSelectItem>>;
67
+ styleDropdownMenu?: StyleProp<ViewStyle>;
68
+ styleDropdownMenuSubsection?: StyleProp<ViewStyle>;
69
+ styleInputGroup?: StyleProp<ViewStyle>;
70
+ styleItemsContainer?: StyleProp<ViewStyle>;
71
+ styleListContainer?: StyleProp<ViewStyle>;
72
+ styleMainWrapper?: StyleProp<ViewStyle>;
73
+ styleRowList?: StyleProp<ViewStyle>;
74
+ styleSelectorContainer?: StyleProp<ViewStyle>;
75
+ styleTextDropdown?: StyleProp<TextStyle>;
76
+ styleTextDropdownSelected?: StyleProp<TextStyle>;
77
+ styleTextTag?: StyleProp<TextStyle>;
78
+ styleIndicator?: StyleProp<ViewStyle>;
79
+ }
80
+ export interface MultiSelectRef {
81
+ getSelectedItemsExt: (items?: string[]) => ReactNode;
82
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,65 @@
1
+ import js from '@eslint/js'
2
+ import tseslint from 'typescript-eslint'
3
+ import react from 'eslint-plugin-react'
4
+ import reactHooks from 'eslint-plugin-react-hooks'
5
+ import reactNative from 'eslint-plugin-react-native'
6
+ import prettier from 'eslint-config-prettier'
7
+
8
+ export default tseslint.config(
9
+ js.configs.recommended,
10
+ ...tseslint.configs.strictTypeChecked,
11
+ {
12
+ languageOptions: {
13
+ parserOptions: {
14
+ projectService: {
15
+ allowDefaultProject: ['src/__tests__/*.test.tsx'],
16
+ defaultProject: 'tsconfig.test.json'
17
+ },
18
+ tsconfigRootDir: import.meta.dirname
19
+ }
20
+ }
21
+ },
22
+ {
23
+ files: ['src/**/*.{ts,tsx}'],
24
+ plugins: {
25
+ react,
26
+ 'react-hooks': reactHooks,
27
+ 'react-native': reactNative
28
+ },
29
+ settings: {
30
+ react: {
31
+ version: 'detect'
32
+ }
33
+ },
34
+ rules: {
35
+ ...reactHooks.configs.recommended.rules,
36
+ 'react/jsx-uses-react': 'off',
37
+ 'react/react-in-jsx-scope': 'off',
38
+ 'react/jsx-no-duplicate-props': 'error',
39
+ 'react/jsx-no-undef': 'error',
40
+ 'react/no-direct-mutation-state': 'error',
41
+ 'react/self-closing-comp': 'error',
42
+ 'react-native/no-unused-styles': 'warn',
43
+ 'react-native/no-inline-styles': 'warn',
44
+ '@typescript-eslint/no-explicit-any': 'error',
45
+ '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }]
46
+ }
47
+ },
48
+ {
49
+ files: ['src/__tests__/**/*.{ts,tsx}'],
50
+ rules: {
51
+ '@typescript-eslint/no-unsafe-call': 'off',
52
+ '@typescript-eslint/no-unsafe-member-access': 'off',
53
+ '@typescript-eslint/no-unsafe-assignment': 'off',
54
+ '@typescript-eslint/no-unsafe-argument': 'off',
55
+ '@typescript-eslint/no-unsafe-return': 'off',
56
+ '@typescript-eslint/no-floating-promises': 'off',
57
+ 'react-native/no-unused-styles': 'off',
58
+ 'react-native/no-inline-styles': 'off'
59
+ }
60
+ },
61
+ prettier,
62
+ {
63
+ ignores: ['dist/', 'node_modules/', 'lib/']
64
+ }
65
+ )
package/jest.config.ts ADDED
@@ -0,0 +1,22 @@
1
+ import type { Config } from 'jest'
2
+
3
+ const config: Config = {
4
+ preset: 'react-native',
5
+ transform: {
6
+ '^.+\\.tsx?$': [
7
+ 'ts-jest',
8
+ {
9
+ tsconfig: 'tsconfig.test.json'
10
+ }
11
+ ],
12
+ '^.+\\.jsx?$': 'babel-jest'
13
+ },
14
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
15
+ testMatch: ['<rootDir>/src/__tests__/**/*.test.tsx'],
16
+ setupFiles: ['./jest.setup.ts'],
17
+ transformIgnorePatterns: [
18
+ 'node_modules/(?!(@react-native|react-native|@react-native-vector-icons)/)'
19
+ ]
20
+ }
21
+
22
+ export default config
package/jest.setup.ts ADDED
@@ -0,0 +1 @@
1
+ import '@testing-library/react-native/matchers'
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@riebel/react-native-multiple-select",
3
+ "version": "0.6.0",
4
+ "description": "Modernized Simple multi-select component for react-native",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc",
9
+ "prepublishOnly": "tsc",
10
+ "format": "prettier --write src/",
11
+ "format:check": "prettier --check src/",
12
+ "lint": "eslint src/",
13
+ "test": "tsc --noEmit && jest"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/riebel/react-native-multiple-select.git"
18
+ },
19
+ "keywords": [
20
+ "reactnative",
21
+ "multiselect",
22
+ "multi-select",
23
+ "react-native"
24
+ ],
25
+ "author": "Mustapha Babatunde Oluwaleke",
26
+ "license": "MIT",
27
+ "bugs": {
28
+ "url": "https://github.com/riebel/react-native-multiple-select/issues"
29
+ },
30
+ "homepage": "https://github.com/riebel/react-native-multiple-select#readme",
31
+ "devDependencies": {
32
+ "@eslint/js": "^9.0.0",
33
+ "@react-native/babel-preset": "^0.83.1",
34
+ "@testing-library/react-native": "^13.3.3",
35
+ "@types/jest": "^30.0.0",
36
+ "@types/react": "^19.0.0",
37
+ "@types/react-test-renderer": "^19.1.0",
38
+ "eslint": "^9.0.0",
39
+ "eslint-config-prettier": "^10.1.8",
40
+ "eslint-plugin-react": "^7.37.5",
41
+ "eslint-plugin-react-hooks": "^7.0.1",
42
+ "eslint-plugin-react-native": "^5.0.0",
43
+ "jest": "^30.2.0",
44
+ "prettier": "^3.8.1",
45
+ "react": "^19.2.4",
46
+ "react-native": "^0.83.1",
47
+ "react-test-renderer": "^19.2.4",
48
+ "ts-jest": "^29.4.6",
49
+ "typescript": "^5.4.0",
50
+ "typescript-eslint": "^8.0.0"
51
+ },
52
+ "peerDependencies": {
53
+ "react": ">=16.8.0",
54
+ "react-native": ">=0.60.0"
55
+ }
56
+ }